I was creating a Windows Forms based application in C#. I want to display a custom main UI. I have a source Bitmap image for the same. But I cannot find the solution so as to how to do this in C#.
Here is my main window for the UI in which I would display the buttons and the display.
Can anyone tell me how to do this??
Thanks.
You can't do that using WinForms, you must use WPF.
Some links (there are many helpful resources, check on google for more):
WPFtutorial
Designing with Windows Presentation Foundation
Advantage of WPF app vs Winform for business apps
Related
I have a GLFW3 OpenGL project written in C++. I was looking to create a modern GUI to go with it. I have limited experience with XAML and windows WPF but it is intuitive to work with so I really want this to work.
I found 'WpfUnmanagedOpenGL' template from Github https://github.com/kopaka1822/WpfUnmanagedOpenGL and it runs great with a C++ DLL communicating with the Csharp OpenGL host window that is already working within the form using GLAD, not GLFW.
I managed to create a GLFW window with my existing code and it displays as a second popup window when the WPF form is compiled and run. See:
How can I embed this correctly?
I found this question on StackOverflow: embed window(glfwCreateWindow) as child to C++ MFC parent form .
Essentially it says I can set the GLFW window to be a child window of the WPF form. However I cannot get the WPF parent window handle to set it all up.
PLEASE help.
Thanks,
You may want to try to do the opposite. Rather than embedding your Win32 app inside your WPF form, embed your WPF form within your Win32 app instead.
Official docs:
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/walkthrough-hosting-wpf-content-in-win32?view=netframeworkdesktop-4.8
A really neat tutorial:
https://www.codeproject.com/Articles/5253279/Create-An-Awesome-WPF-UI-for-Your-Cplusplus-QT-App
This is for the legacy .NET Framework though. I have no clue if the same technique can be applied in the new .NET Core framework though.
I want to design a modern looking UI using visual studio designer in xaml. It gives me a nice toolbox which I can use to create a UI visually by drag and drop. As it is almost behaving like HTML, I was wondering if it too has a rich library of themes. I found some, but they are not editable through designer.
Can someone please help me out and direct me to appropriate links where I can find editable themes for xaml for my WPF project?
I use this:
Mahapps.metro http://mahapps.com/
I very good looking thems and it is free. More info https://stackoverflow.com/a/15500408/5816153
Others:
Modern UI for WPF (MUI) - https://github.com/firstfloorsoftware/mui
And for more info on SO: Making WPF applications look Metro-styled, even in Windows 7? (Window Chrome / Theming / Theme)
I've created an WPF based application showing me thumbnails of external windows. As an example i pick up icq, firefox and some other windows, create thumbnails of these and render them onto my WPF based application.
That works fine already and looks like this:
http://img560.imageshack.us/img560/1170/oijoijio.jpg
(Just showing one thumbnail in here, but there will be multiple in future)
The WPF application will also contain some controls to actually select the windows being "thumbnailed" and a few others.
The next step and my actual question is about how i would redirect these content being rendered into a Bitmap instead of the "WPF window" itself.
Is there a way to accomblish that goal? All the windows content (WPF containers and the drawn thumbnails) need to be rendered into a bitmap which i can display in directx window being owned by a game.
I know that it is possible todo that somehow, as a programm called overwolf also uses WPF inside of their application. They actually install device inline detours to hook into the rendering process of the game, where they render their wpf content. I am not sure if they use some kind of bitmap they render in there, or if they directly render the wpf content onto the dx-surface somehow.
Other ideas besides the bitmap based style i plan to go for are welcome aswell!
Thanks for your reading until here, and another big hug for any answer :)
Any WPF Visual object can be rendered into a bitmap using RenderTargetBitmap.
For a project I decided to use Dynamic Data Display to generate charts (more specifically: heat maps) of certain data.
Now for as far as I could read (and see from the demos) Dynamic Data Display uses WPF forms.
I have no experience whatsoever with WPF, but I was wondering if it is possible to integrate Dynamic Data Display in a normal windows forms project (even if this means "mixing" Dynamic Data Display's WPF forms with my project's normal windows forms).
Thanks in advance!
You will need to use System.Windows.Forms.Integration.ElementHost control in your Windows Forms project, more information on how to use ElementHost to host WPF forms inside Windows Forms is at:
http://msdn.microsoft.com/en-us/library/ms751797.aspx (Interoperability in WPF and Winforms and vice versa)
http://msdn.microsoft.com/en-us/library/ms742215.aspx (Walkthrough)
I am integrating a webcam in a WPF application. I can see the camera feed in the main window, as I pass its HANDLE on to the DirectShow functions. But this is not what I want.
The main form has a Image control, where I'd like to see the output. However, in order to do this, I need the control's Handle.
Any hint on how to do this?
Thanks in advance,
Gianluca.
An Image Control in WPF, unlike Windows Forms, doesn't actually have an HWND.
WPF works differently than Windows Forms - each control is not a wrapper around a native "window" with a handle, but rather composed together using Direct3D at runtime by the layout system.
If you need to actually host output from a Webcam inside of a WPF window, you should look at using HwndHost (or a subclass). The simplest way is often to just host a Windows Forms control inside of a WindowsFormsHost, though managing an HWND yourself via HwndHost is more efficient.
Using an WindowsFormsHost and a picture box inside is a good solution that I used for a similar problem where I needed a handle to display a video stream. But be careful, in order to work, the Window that is hosting the WindowsFormsHost control must have AllowsTransparency="false"!