Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
QuestionReading and storing variables from data files Pin
ReynaW12239-Jul-09 16:18
ReynaW12239-Jul-09 16:18 
AnswerRe: Reading and storing variables from data files Pin
N a v a n e e t h9-Jul-09 17:10
N a v a n e e t h9-Jul-09 17:10 
GeneralRe: Reading and storing variables from data files Pin
ReynaW122313-Jul-09 5:27
ReynaW122313-Jul-09 5:27 
QuestionProgressBar Pin
peishen889-Jul-09 16:12
peishen889-Jul-09 16:12 
AnswerRe: ProgressBar Pin
N a v a n e e t h9-Jul-09 17:13
N a v a n e e t h9-Jul-09 17:13 
GeneralRe: ProgressBar Pin
peishen889-Jul-09 17:29
peishen889-Jul-09 17:29 
GeneralRe: ProgressBar Pin
Mycroft Holmes9-Jul-09 19:52
professionalMycroft Holmes9-Jul-09 19:52 
Questionurgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
_Maxxx_9-Jul-09 13:56
professional_Maxxx_9-Jul-09 13:56 
We have an existing application (so I can't make wholescale changes) that has a number of user controls that are displayed as follows:

Call a method (MyUserControl.ShowVaseline(Control parentControl) which
1. Creates a bitmap from the parentControl.
2. 'Grayscales' the bitmap
3. Creates an empty usercontrol with this bitmap as the background
4. Docks this newly created user control within the parentControl (so it LOOKS as if the parent control is disabled, whereas in fact it is invisible, hidden behind the newly created control)
4. Positions MyUserControl centrally within this newly created user control

The effect is that MyUserControl is shown on top of the parent control, will move with the parent control, and the parent control is disabled and appears 'greyed out'

In most cases this is fine and dandy for its purposes - which is essentially a desire to be able to access some top-level controls on the parent form at all times, while maintaining workflow through apparent modality of dialogs).

But when shown like this it is not 'Modal' in the Windows sense of the word - ie the code following MyUserControl.ShowVaseline(parentControl) is executed without waiting for MyUserControl to complete.

So the 'closing' of the user control is handled by it events which are handled by the parent :
...
  MyUserControl.Close += MyUserControlClosed;
  MyUserControl.ShowVaseline(Control parentControl);
}
private void MyUserControlClosed(Dialogresult dialogResult)
{
  if (DialogResult.OK)
  {
      SoSomeStuff();
  }
}


I would dearly like the ability to treat the control just like a modal dialog form, in some cases - so the LOOK would be the same (centered on an apparently disabled background) but I could do something like

DialogResult dialogResult = MyControl.ShowVaselineModal(parentControl);
if (dialogresult == DialogResult.Ok)
{
  DoSomeStuff();
}



I don't really understand, technically, how a dialog form 'works' so don't really know where to begin.

I can think of having my main program enter a loop, checking the user control for a modal result

MyControl.ShowVaselineModal(parentControl);
while (MyControl.DialogResult == DialogResult.None)
{
  Application.ProcessMessages();
}
if (MyControl.Dialogresult == DialogResult.Ok)
{
  DoSomeStuff();
}


But surely there's something clever I'm missing?

Incidentally, the reason I want to do this is for the occasional situation where, for example, I am iterating a collection, and want to open a 'dialog' for (possibly) several items in the collection - with a true dialog I can just put the code in the loop - but using the existing Vaseline stuff, I have to faff about keeping references to where I am in the collection and/or what has been handled so I can continually reprocess the collection until I have done. It's not so much hard as annoying.

All help gratefully appreciated.

___________________________________________
.\\axxx
(That's an 'M')

AnswerRe: urgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
Mycroft Holmes9-Jul-09 14:06
professionalMycroft Holmes9-Jul-09 14:06 
GeneralRe: urgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
_Maxxx_9-Jul-09 15:51
professional_Maxxx_9-Jul-09 15:51 
GeneralRe: urgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
Mycroft Holmes9-Jul-09 19:50
professionalMycroft Holmes9-Jul-09 19:50 
QuestionIE automation Pin
yogesh_softworld1239-Jul-09 13:02
yogesh_softworld1239-Jul-09 13:02 
AnswerRe: IE automation Pin
schiebel-t9-Jul-09 21:14
schiebel-t9-Jul-09 21:14 
Question64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 11:32
professionalDaveyM699-Jul-09 11:32 
AnswerRe: 64bit fixed point timestamp to and from DateTime Pin
Luc Pattyn9-Jul-09 12:24
sitebuilderLuc Pattyn9-Jul-09 12:24 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 22:28
professionalDaveyM699-Jul-09 22:28 
AnswerRe: 64bit fixed point timestamp to and from DateTime Pin
Henry Minute9-Jul-09 12:29
Henry Minute9-Jul-09 12:29 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 22:20
professionalDaveyM699-Jul-09 22:20 
AnswerRe: 64bit fixed point timestamp to and from DateTime [modified] Pin
Luc Pattyn9-Jul-09 13:41
sitebuilderLuc Pattyn9-Jul-09 13:41 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 22:16
professionalDaveyM699-Jul-09 22:16 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 23:05
professionalDaveyM699-Jul-09 23:05 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
Luc Pattyn9-Jul-09 23:22
sitebuilderLuc Pattyn9-Jul-09 23:22 
GeneralRe: 64bit fixed point timestamp to and from DateTime [modified] Pin
DaveyM6910-Jul-09 4:00
professionalDaveyM6910-Jul-09 4:00 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
Luc Pattyn10-Jul-09 7:28
sitebuilderLuc Pattyn10-Jul-09 7:28 
GeneralRe: 64bit fixed point timestamp to and from DateTime [modified] Pin
DaveyM6910-Jul-09 8:48
professionalDaveyM6910-Jul-09 8:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.