P
Peder Y
I'm trying to make a custom color dialog. At this point I've designed it
as about 200 buttons on a form with different background colors. This
works, but is somewhat slow. Now, the effect I'm trying to produce is
the same as is used in most major text editing and drawing applications.
If the user shifts focus to anything else in the application, the dialog
should disappear. Hence ShowDialog won't work. I use a LostFocus
listener to close the dialog and form.Show(), but this disables the
application from "waiting" at the Show() call so the main application
can collect the return color value once the color dialog closes. Hence,
I want the ShowDialog-style halting of the caller process plus the
possibility of externaly closing the dialog and thus make the caller
process continue. Can this be done elegantly? Anyone knows the common
way of doing this?
Example:
MyColorDialog frm = new MyColorDialog();
frm.Show();
// Wait politely for either color chosen or lost focus...
someButton.BackColor = frm.ReturnColor;
Thanks!
as about 200 buttons on a form with different background colors. This
works, but is somewhat slow. Now, the effect I'm trying to produce is
the same as is used in most major text editing and drawing applications.
If the user shifts focus to anything else in the application, the dialog
should disappear. Hence ShowDialog won't work. I use a LostFocus
listener to close the dialog and form.Show(), but this disables the
application from "waiting" at the Show() call so the main application
can collect the return color value once the color dialog closes. Hence,
I want the ShowDialog-style halting of the caller process plus the
possibility of externaly closing the dialog and thus make the caller
process continue. Can this be done elegantly? Anyone knows the common
way of doing this?
Example:
MyColorDialog frm = new MyColorDialog();
frm.Show();
// Wait politely for either color chosen or lost focus...
someButton.BackColor = frm.ReturnColor;
Thanks!