Jump to content

Recommended Posts

Posted

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() { };
Posted (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 by Richard Robertson
Posted

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.

  • Administrators
Posted

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.


 

Posted (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 by Manadar

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...