creating external Panel files in C# Winforms - c#

So I'm currently working on a C# Windows Form App in Visual Studio 2017
What I'd like to do is create several different external Panel files, then switch them out on the main form as the user navigates around.
I used this same technique for a Java GUI before and it worked great.
However I can't seem to figure out how to create the external Panel file, is it possible or am I just wasting my time and energy on the impossible?
(edit) So if anyone is interested I've found a work around for my problem.
By using a winforms user control class I was able to create a working substitute.

Related

Is it feasible to dock a exe inside c# winform? What kind of challenges will be there?

I have an application which is developed in c# WinForms. Now i am developing an another application using ReactJS and Electron. I am able to do that and i have generated EXE successfully.
Now i dont want to run both the applications as separate applications. So i docked ReactJS and Electron generated EXE inside a form container of existing WinForm application. I used this article to achieve that- Docking Window inside another Window
Now EXE is running inside WinForm but i am facing some issues in UI rednering. See that attached screenshot. Application is not properly.
Is it right way to do it? Does anybody has experience in this? What kind of other problems i am going to face in future?

How to create a VS 2008 Windows Forms project programmatically, that can be maintained just like any other project created manually

I have a bunch of control properties (type of control, location, size, etc.) derived as a text file from an old system on a different platform. I thought it would be fairly easy to load these "control descriptions" into a Windows Forms project in VS 2008 and then be able to maintain the new project in VS just as if it had been created manually.
I'm familiar with using VS and C# but it I'm not sure where to start with this.
I searched the web and found a number of articles about creating controls on forms at run time and that is not so hard, given the information I have, but I want the created form to be a permanent part of a Win Forms project, so I need to get what was created at run time into VS, and accessible in the project just as if it had been manually dropped on the designer surface. Is there a way I could create these forms with a program and then "save" them in a form acceptable to VS?
I manually created a windows Form project to try and use as a "template" and identify how VS does it. I have tried to understand the contents and the relationships between the various resource files, but it is a bit too much. There are also warnings that various files are created by VS and should not be amended manually.
I have almost 1000 forms from the old system so the thought of manually having to add each one to VS is pretty non-viable. I could translate the text descriptions into XML if there is a way to feed an XML description of a Form into a VS Forms project...?
Any advice\direction towards this would be greatly appreciated.
VS uses code generation to create controls in Windows Forms. If you look at a form e.g. Form1 that's in your project, it consists of three files, Form1.cs, Form1.designer.cs and Form1.resx. The Form1.designer.cs file contains the construction of the controls in the InitializeComponent method. VS executes this and parses it at design time to give you the design view of the form where you can make modifications. You could write a program to parse your text files and generate C# code for InitializeComponent to get the right effect. There are various options but you probably would want to use the CSharpCodeProvider class.
Another option is to use WPF. Forms are designed in WPF using XAML, which is an XML based format. (By that I mean, an XAML document is also a valid XML document, but the reverse is not true.) If you create a WPF project and add some controls to it then you could take a look at the XAML file to get an idea of the structure.

C# WinForms Generate Designer Code from Dynamic Form At Runtime

I am trying to find a way to generate bare bones windows form designer code from a dynamically created form at run time so I can then load that designer code into visual studio and have an exact replica of the form that was running (the UI anyways).
We have a .NET application that generates forms dynamically in a very convoluted manner (in house custom serialization coming from a Java app) so there is no actual windows forms code for these.
I have read and played with the DesignSurface stuff shown here: http://msdn.microsoft.com/en-us/magazine/cc163634.aspx
Which makes it seem like this is possible. This works for creating a form from scratch, but I cant figure out how I would create a DesignSurface from an already running form so I can then generate the code.
I could use Reflection and try to generate a decent InitializeComponent() function myself, but seems like there is a way to do this. Otherwise will have to do this by hand for a lot of forms.
Is there possibly an easier way to do this, or a free/commercial app that may do what I need?

Use WPF component from external .exe

Here's the situation:
We have an existing .NET executable that contains an application using WPF components (dialogs and forms). This executable was created using Gupta Team Developer 6.1, but I'm not sure that is relevant to my question. We'd like to re-use some of these forms in a C#-application, but this is proving difficult.
When we include the external components, either in XAML or by instantiating them in code, they look OK (i.e. fields, buttons, layout etc.), but the event wiring seems to be missing. Nothing happens when pressing buttons and tables/grids are empty.
I've read previous articles on this site on using external WPF components, but they all mention external assemblies compiled as control libraries. Are we trying to do something that's not really possible?
P.S As an experiment we've tried to instantiate the App-object from the executable directly and this brings up a fully functional version of the entire application (well, duh), but we'd really like to be able to pick and choose from the individual forms/dialogs.

Create Tabs and Drag/Drop Them In Application?

I currently have a program in .NET 3.5, written in Visual Studio C# using Windows Forms. I plan on rewriting this program from the ground up, its a very small and simple program, so its not that big of a feat.
With the new version of the program, I would like to give users the ability to add/remove tabs from a tabControl, as well as drag and drop them to re-arrange them in the order they like. I know they can not do this with Windows Form. Would I be able to do this if I create the program using WPF instead?
I also want to be able to load an webpage in the program, which would be AJAX based:
http://www.twitch.tv/chat/embed?channel=8wayrun&popout_chat=true
Would I be able to do all this with WPF, even though I cant do it in WF?
This project can help you: http://fabtab.codeplex.com

Categories