Richard Robertson Posted August 24, 2008 Share Posted August 24, 2008 Ah, well... you could cover the Show function using the new keyword and prevent it from showing the form. That's not much work. Link to comment Share on other sites More sharing options...
Valik Posted August 24, 2008 Share Posted August 24, 2008 Richard, how would I do that? I guess you create a lamba and assign that to Show? Something like this (I don't know how to create lamba expressions in C#, obviously):this.Show = new void function() { }; Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 24, 2008 Share Posted August 24, 2008 (edited) Write the function as you would an override, but instead substitute the word new. That's the keyword used to hide inherited members.new (C#)class Form1 : Form { new public DialogResult Show() { ... } }You may have to hide several overloads though.Edit: Also, in case you are interested, information on anonymous methods. Edited August 24, 2008 by Richard Robertson Link to comment Share on other sites More sharing options...
Valik Posted August 24, 2008 Share Posted August 24, 2008 Ahh, see. I still want the program to show the GUI if no or invalid command line parameters are specified. That's why I wanted to know if I could do run-time hiding by re-assigning the Show function if I determined I didn't want to show. Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 24, 2008 Share Posted August 24, 2008 (edited) Yes, you can call base.Show inside your "new" method. Just check the command line variable inside your new Show. Edited August 24, 2008 by Richard Robertson Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 24, 2008 Author Administrators Share Posted August 24, 2008 Hmm, I guess C# is kind of neat in some ways.I'm liking it a lot so far. The Visual Studio IDE works 10 times better for c# than c++ - all sorts of refactoring stuff as well. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 25, 2008 Share Posted August 25, 2008 Yes, C# has much better tools than C++ now. Microsoft is really pushing it along. Link to comment Share on other sites More sharing options...
jvanegmond Posted August 27, 2008 Share Posted August 27, 2008 (edited) Valik, if you had some time on your hands you could convert the existing application to properly use a class library. Then you would be able to write both a console application or GUI application with minimal effort.Other then that, you can close the GUI almost at any time by sending a WM_CLOSE message to it's window handle, instead of trying to call the various Exit and Close functions.Edit: If you have time, check out what is new in VS2008 with WPF on the rise. Silverlight 2.0 applications in windows forms, that sort of stuff. It is really a time-saver too, if you are used to drawing using GDI+ with C#.( Make a standard winform and add a WPF Usercontrol to your project. The user control's file type should be XAML. ) Edited August 27, 2008 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now