is it possible to take an application such as the mysql command line or notepad and display it in a windows forms application as an MDI form?
I have a relatively complex application that I would like to be able to access mysql directly through, for convenience. I would also like to be able to open notepad to allow simple text editing, but it seems foolish to reinvent the wheel and write my own text editor and incorporate it within the app just for convenience.
I just need a pointer as to where to go, as I currently have no clue, although I did consider using COM interop but I am not sure which of the native dlls to use.
I am using C# with Visual Studio 2012 Ultimate.
First I am not quite sure why you would want to do this however your best bet is going to be to find something on codeplex.com and integrate it into your application.
An example would be
http://dbexecutor.codeplex.com/
Then you can take the source and integrate it into your mdi application
Related
At a broader level, I'm converting a MFC application (MFC 6.0) into Windows Forms application (Visual Studio 2013). I read certain blogs that describes that this conversion is possible. By this conversion I can re-use code written in MFC, only I will need to create UI. However I will need to understand the previous code and may need to re-write it a bit.
I got the motivation from here and here.
I have performed following steps so far.
Opened Visual C++ 6.0 project in Visual Studio 2013.
Build it successfully.
Then added CLR support to it, and fixed errors.
Added a Windows form, and added controls to it. As mentioned here.
Added functionality and build it successfully.
Now when I run this application, then it still point to old MFC window.
I'm missing certain settings which will change the rendering window from MFC to WindowsForm. What am I missing here?
Addition to that, I see problem with this approach as described by #Roger in comments, and I understand that. So, I wanted to know for any tool/utility which may convert legacy code into C#. Does such utility available?
TIA.
The code you are referring to seems suitable for amending a MFC application with a few forms as child windows to make use of .NET features. However, the main window is another story. You wrote the application is huge, so I suppose you don't want a simple form as your main window and rather have some kind of MDI interface in mind. If you replace the CMainFrame in the legacy MFC application, it just doesn't make sense to maintain an old CWinApp class. Anyway, if you are hell-bent on going down that path, you may want to have a look at an old CodeProject articel (.NET1.x, .NET2.x) to get a better grasp at the whole concept.
But as Roger already suggested, it would be a wise choice to find a nice GUI framework, perhaps even WPF instead of WindowsForms, and do a GUI rewrite -- especially if one part of the motivation for the conversion is to move to newer UI concepts. If your C++ program logic is well separated in your MFC project, put it in a COM server and make use of interoperability.
I have a win form application and i'm trying to run it inside the web browser,i rummaged through web and found some links:
I tried this link:Embedding a .NET WinForms Application in an Internet Browser Using WPF
,this works fine but the problem is that the end-user has to install dot net frame work for running the application.
I found another link here for running a WinForms Application Inside Web Browser,with Visual WebGui development framework.
Has anyone had any experience with WebGui?
Well, Visual WebGui is web over ASP.NET. Its developing experience is the same/similar to that of Windows Forms using the Visual WebGui designer integrated into Visual Studio. You do your code behind just the same as you would on Windows Forms and the WebGui runtime transforms it into HTML5/CSS/JS.
The efforts needed to convert your Windows Forms application to a equivialend Visual WebGui web application will depend on the (3rd party / .NET) components used in your Windows Forms application. The Visual WebGui API is farily similar to that of Windows Forms, so in some cases you can add a few references to WebGui specific assemblies and then to a search/replace for a couple of namespaces. There are of course some differences, as these are two different platforms, but the developing experience is quite similar to Windows Forms.
winforms is not web. Web is Web.
Web means HTML + something (usually JavaScript, CSS and probably jQuery or such).
1 - If you need a web application, and want to do it with .Net, create an ASP.Net Application.
2 - If you need a Windows application (Desktop), create a WPF application.
3 - If you need a Windows 8 "Metro" style application (a.k.a Windows Store App), create a WinRT XAML application.
4 - winforms is completely useless. Forget that.
If your customers don't want to install any version of the .Net Framework, your only option is #1.
A winforms application will NEVER be a web application, regardless of any hacks you do to make it run inside a web browser.
an XBAP (WPF Browser Application) is also NOT a web application. It's just a regular WPF client application that does not have it's own window.
Edit:
If you did things the right way (that is, maintaing separation of concerns and putting application logic in Controllers or ViewModels instead of the horrible code behind practices most winforms developers are generally used to), It should not be that hard to reuse your application logic and create a new application (web or otherwise) while maintaining the Data Access and Business Logic layers intact.
I think this question is very similar to this one:
Is it possible to convert a WinForm to a WebForm in .NET?
As mentioned before, the only way to run the application "as is" inside a browser will be through the use of some activex control and that would require IE + .NET Framework.
There are tools that you can use to automatically migrate the application to the Web, but there will always be some manual effort involved and it won't be the same as building the application from scratch as a web app.
In my limited experience with Visual WebGui, it is pretty cool technology. In simple terms, as I understand it, you can use the Windows Forms development IDE to create an HTML5-compliant ASP.NET client/server web application... not just a web site or page, with a look and feel very much like a Windows forms desktop application. It does this by converting Winforms controls to jquery code on the client side, and stores most of the executable code on the server side.
I've used it to create simple applications for testing purposes, and there are a few caveats. First, to create a "pretty" website, you need to rethink the Winforms layout to make it web-like, with headers, sidebars, etc. It's a different paradigm, and users expect certain things on a website. The good news is that this adjustment can often be done fairly easy by simply manipulating controls; i.e. a Panel control can become a container for a sidebar or header. You can also create "themes", which are like skins for the controls to modify the appearance.
Another consideration is that events for things like popup dialog boxes behave differently in a web environment. In Winforms program execution halts until the user clicks an "OK" button or something. Within Visual WebGui, all the execution happens on the server side; thus, program execution would continue without waiting for user input. This can be handled by creating a Form.Close handler for the popup box though. But these kinds of differences need to be kept in mind.
You also must consider object layout anomalies. Visual WebGui does a good job generally of mimicking the Winforms WYSIWYG benefit: Objects normally appear pretty close on the webpage to where you put them in the environment. But this isn't always the case; you need to play around with object padding, margins, etc. sometimes to get the right layout. Still it is often much easier than tediously changing spacing with CSS or div objects.
Thinfinity VirtualUI allows you to do so by adding a small line of code to your C# application so it can then be accessed from any OS and device via an HTML-able browser.
https://www.cybelesoft.com/thinfinity/virtualui/web-integration-for-windows-apps/
I've used VWG but it's not really an option anymore. One option not mentioned here is WiseJ, a proprietary framework which is still under active development and support in 2022. And it is fairly straightforward to convert a WinForms app to WiseJ, or begin using WiseJ like you would WinForms.
They are located here: https://wisej.com
I need to edit word templates inside my windows forms app, how can i do that? is there any control to do it?
Thanks for your help.
It is possible to host Word itself inside a WinForms application, but I doubt you want to do that.
Depending on your requirements you may want to use a third-party control for editing word files. There are many out there, so check with your favorite component provider.
Alternatively you could just launch Word outside your application and respond to when it's window is closed or when the template file is modified. This will probably be much easier and more stable than running hosting Word in winforms.
I think you can use the web browser control to host office documents. There was talk about a ActiveDocumentHost control but it seems it got canned.
What is the best approach and/or tool?
The trackBar in the MS Visual Studio 2008 Toolbox is inadequate.
It needs to be optimized for an 800x480 touch screen in extreme environmental conditions.
The button on the trackBar needs to be larger so it is easier for the user to move the control using a finger. Its possible with the existing widget, but difficult since the button is small. I am using C# in MS Visual Studio 2008, but don't know if it is WinForms or WPF (this is my 1st C# project). The target is an old windows-ce tablet. It would be great if step-by-step instructions on how to create a custom control already exist. An alternative would be a tool I could purchase.
Here are a couple tutorials on creating custom controls:
Using Winforms
http://blogs.msdn.com/b/jfoscoding/archive/2004/12/06/275505.aspx
http://msmvps.com/blogs/deborahk/archive/2009/10/13/winforms-user-controls-101.aspx
Using WPF
http://msdn.microsoft.com/en-us/library/cc295235.aspx
http://www.wpftutorial.net/HowToCreateACustomControl.html
It might be a good idea to read up on the basics, then ask more specific questions that you have regarding the nuances of creating a custom control.
I have a process which I break into multiple processes and even when using threading it takes a very long time to complete.
I'd like to give the user an indication of the status of the execution in a cute way (for each process % complete). Maybe betting on the right horse will ease the pain :)
I found this project long ago: A Guided Tour of WPF (XAML)
I have two questions:
This article was written in 2007. Is there better way to achieve this graphic effect?
I have not understood yet, how the application is started, so I'd like to know if I can integrate such "window" in my window application?
Adam Robinson pointed out that the second question is not clear:
The application generates a window as in the picture below - I like to know if it possible to insert it in my "normal" windows application.
This article was written in 2007, is there better way to achieve this graphic effect?
WPF is the current "best" (or at least most feature-rich) way to develop a Windows Application for the desktop.
I have not understood yet, how the application is started, so I'd like to know if I can
integrate such "window" in my window application?
Make your application a WPF Application. This will automatically give you an application, Window class, and everything else you need to get started. Making a WPF application is just like any other application, except that you need to start the message pump, create the application, setup your startup window, etc. The "WPF Application" template in Visual Studio does all of that for you...
Until you understand what all is happening, I'd recommend starting with that, and customizing from there.
If you choose to stick with a win form for the main app, you can still host the desired window/control via an ElementHostControl. (hosts wpf inside winform).
Blessings,
Jeff