I have constructed many dialogs in my apps where I would do the following:
Build the dialog as a form within the project
Fill out the dialog box with everything I wanted to collect form the user.
Expose those items with public accessors
Add an Okay button which sets DialogResult = DialogResult.OK; etc.
(example: AskForFiles has englishDict frenchDict and germanDict exposed as public accessors. The user can click buttons to browse for the dictionary files in the dialog)
This way you can issue a dialog, get the results from that dialog, with OK indicating they set all the values and Cancel indicating they changed their minds. You need to make sure you never issue a return without a this.Close() and setting this.DialogResult.
I also make the form properties for Abort and Accept set to the corresponding buttons on the form so any key input creates the desired results as well. For example: the user enters all dictionary names and hits enter is the same as clicking the Okay button. the user hits Esc is the same as clicking the Cancel button. etc...
_____________________________________________ The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
is a very good book for learning and understanding C#
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
byte RSAOutput = RSA.Decrypt(bytearrayinput, false);
// Write out the DES encrypted file.
fsDecrypted.Write(RSAOutput, 0, RSAOutput.Length);
i obtain the error state that "Object reference not set to an instance of an object" which occur at line fs.Read(param.P, 0, param.P.Length) in method ReadPrivateKeyFromFile.
i was wondering whether u can give me any suggestion how can i solve this problem?
Can anyone suggest the best way to constrain a form to horizontal resizing only?
Delegating a Resize handler doesn't work so great. If I set Height=400; in the Resize handler, it does indeed force the window to a height of 400 (or whatever you like) but when the user drags the window border, the window momentarily resizes to fit the mouse, and then the handler kicks in and pushes it back to 400 and back and forth causes a nasty flicker.
I've seen some Win32 examples that process WM_NCHITTEST messages and return 0; but I don't see a way to do this with C# .NET Framework. Any ideas?
I have a question about these System Objects. What if the user changes his/her properties in Display Settings while the app is running? Do these colors change?
Quote from MSDN:
ActiveBorder: Gets a SolidBrush object that is the color of the active window's border.
ActiveCaption: Gets a SolidBrush object that is the color of the background of the active window's title bar.
ActiveCaptionText: Gets a SolidBrush object that is the color of the text in the active window's title bar. "
To me this would imply that the colors are changing. But then again I have been known to be wrong at times.
Hmmm... what's a signature?