Integrate WinForms project into WPF - c#

I've been working on a project for some time, and it requires alphablended non rectangular forms...
which in a little research I found can be easily done in WPF. So I decided to port my project from WinForms to WPF.
There are a few complications like a reference DLL based on WinForms I've been using doesn't work under WPF; it doesn't even show in the designer toolbox. I already tried loading it into the toolbox by right clicking and selecting Choose Items.., but it does not show there either.
I have never worked on WPF before, but it looks so promising for my requirements.
So is there anything I could do to integrate my project into WPF?

There is a control named 'WindowsFormsHost' in WPF. You can find it in toolbox. Drag it on the form and then you can use windows controls and user controls on it.
Hope this information will help.

Related

How can I set focus to explorer in C# WindowsApiCodepack, when used in WPF via WindowsFormsHost

i´m writing a small C# Wpf application and I integrated the ExplorerBrowser of the WindowsApiCodepack.
This is working really nice.
The only problem I have and where I haven´t found a solution so far is:
How can I programatically set the focus (keyboard focus) to the ExplorerBrowser control, so that I can select a folder without clicking on it with the mouse before?
Does someone have exerience with the control?
Additional Note:
What I found out so far is, that focus problems are a common problem for winform controls, which are inserted into a wpf window via the WindowsFormsHost class.
But i haven´t found a good workaround so far.
I don't have a clue about the WindowsApiCodepack, but I think u just have to call the ".Focus()" function of the control.

Native UI using WPF

I'm switching from Windows Forms to WPF, but WPF's GUI is really ugly. It looks like Windows 95 or something like that.
Example:
Left is a new WPF project
Right is a new Windows Forms project
Both only have a button and textbox added to the project, no other changes.
As you can see, WPF doesn't have the "native Windows GUI". I know that I can use themes, but I just want the native Windows GUI. Isn't there any setting to do this without themes? I've found this but I didn't change anything in the project except for the button and the textbox and it still doesn't look native.
See this workaround. there's some button styles there to make the buttons look more similar to the native ones. Other than that, see here the official statement from Microsoft that this difference is actually by design. They made intentional changes to the themes to make them more lightweight by removing gradients and such.

Windows Forms Application C# Style

I am developing a Windows Form Application in Visual Studio 2008 (C#)
And I want to add Style to the items.
I have been investigating a few ideas about it but I have not found an example about how to do it. Is it really possible?
My app looks like:
But I really want to add more style in buttons, textboxs and other items I have:
My boss insists on using Visual Studio 2008.
To do this without purchasing anything else, you could create your own custom button and text box controls, either from scratch or as controls derived from the existing windows forms controls and then overriding OnPaint etc. Take a look at what's been done here:
http://dotnetrix.co.uk/button.htm
You could also investigate third party options.
Or, use WPF if that's a possibility as others have said. I'd push for WPF! If there's an existing WinForms Code base you can always host WPF Elements in WinForms. See:
Walkthrough: Hosting a Windows Presentation Foundation Control in Windows Forms
IF you wana to use Winforms than you have to buy this one for example:
http://devcomponents.com/
You have to bind the new assemblies in your application that is not a lot of work!
But better way do that with WPF
http://wpftutorial.net/DataGrid.html

How can I make the mainMenuStrip look glossy in a Windows forms application

I'm trying to make a nice looking UI with Windows Forms but the main problem I have is that the MenuStrip in Windows Forms looks flat. In WPF everything is shiny and pops out, how can I make it so that it looks like that? I tried using a gradient background image but the buttons stayed as blue rectangles. I am also willing to use an alternative control. Any ideas?
I forgot to mention, regarding alternative controls I am looking for something free and open-source.
My personal suggestion would be that you move from menustrips to "Office-like" menus / ribbons.
Please go through the following links / search through these sites
for more custom controls for winforms
Code Project
http://www.codeproject.com/Articles/12204/Flat-style-menu-bar-and-popup-menu-control-for-Win
Windows Ribbon for WinForms (Part 1-21)
http://www.codeproject.com/Articles/62412/Windows-Ribbon-for-WinForms-Part-1-Introduction
Code Plex
http://ribbon.codeplex.com
http://fluent.codeplex.com
http://windowsribbon.codeplex.com

C# Control Name

I have two questions.
I am usinq Devexpress Winforms
What is the name of control of the
Visual studio toolbox.I wanna add a
control list like visual studi
toolbox.What is the name?
How can I add the flow chart to my
c# project?
For Dev Express, I would perhaps try something like the XtraNavBar:
Windows Side Bar Control
For a flow chart, I don't think Dev Express has a C# winforms flow chart right now.
See comments from Dev Express
#Deneme, The style of control that you see as the Visual Studio Toolbox is called 'an accordion control'. There is not one in the standard forms toolset, but it is not too difficult to build your own out of buttons & panels, and you can tailor it to your own needs and situation.
As for your second question about adding a flow chart, I am not aware of a single tool that you can drag and drop on to a form and set your users loose, but again, it should not be too difficult for you to create panels & buttons to create your own. Depending your needs you may be able to use some pieces of the Office Developers Toolkit to help you get there.

Categories