Click here to Skip to main content
15,911,039 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threading Puzzles. Pin
stan2822-Sep-04 4:44
stan2822-Sep-04 4:44 
GeneralRe: Threading Puzzles. Pin
stan2822-Sep-04 4:53
stan2822-Sep-04 4:53 
Generalsql Pin
cmarmr22-Sep-04 3:42
cmarmr22-Sep-04 3:42 
GeneralRe: sql Pin
exhaulted22-Sep-04 6:24
exhaulted22-Sep-04 6:24 
GeneralWeb Browser Control Pin
Asif Rehman22-Sep-04 3:09
Asif Rehman22-Sep-04 3:09 
GeneralRe: Web Browser Control Pin
Heath Stewart22-Sep-04 9:07
protectorHeath Stewart22-Sep-04 9:07 
Generalkeep popup completely visible Pin
ddelapasse22-Sep-04 2:12
ddelapasse22-Sep-04 2:12 
GeneralRe: keep popup completely visible Pin
Heath Stewart22-Sep-04 9:18
protectorHeath Stewart22-Sep-04 9:18 
There are several ways of doing this. If you're using a system modal dialog (set TopMost to true on your Form), you can determine if the PaintEventArgs.ClipRectangle is equal to your client Bounds in your OnPaint override:
protected override void OnPaint(PaintEventArgs e)
{
  if (e.ClipRectangle != Bounds) { /* we're partly hidden */ }
  base.OnPaint(e);
}
This works because you're a system modal dialog. The only thing hiding it is either another system modal dialog (the likeliness of another is unlikely in most circumstances, especially based on what your dialog is prompting for) or it's outside the screen area.

There's much better ways of doing this, though. You could use properties of the Screen class and methods of the Rectangle struct to determine extents. You could even prevent the dialog from extending past the screen, something we've discussed in the past here (click "Search comments" above).

Yet another way - and most likely more pleasing to users and better regarding usability - is to popup the window directly above or below the DateTimePicker (or whatever you're using), much like the standard DateTimePicker does. This is a common user interface and presents a common user experience, something the Windows UI Guidelines drive. Having a popup window appear distant from the value could be consfusing for some users and annoying for others that get frustrated with having to look all over their screen (I know I would). Just make the popup window borderless and they can't move it. That's much like specifing the WS_POPUP window style for the dialog if you were natively coding such a control.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles]
GeneralRe: keep popup completely visible Pin
ddelapasse23-Sep-04 1:25
ddelapasse23-Sep-04 1:25 
GeneralUsing DataGrid With SQL in C# Pin
MarkMokris22-Sep-04 1:44
MarkMokris22-Sep-04 1:44 
GeneralRe: Using DataGrid With SQL in C# Pin
exhaulted22-Sep-04 1:52
exhaulted22-Sep-04 1:52 
GeneralRe: Using DataGrid With SQL in C# Pin
MarkMokris22-Sep-04 2:20
MarkMokris22-Sep-04 2:20 
GeneralRe: Using DataGrid With SQL in C# Pin
exhaulted22-Sep-04 3:04
exhaulted22-Sep-04 3:04 
GeneralScrollbar movement Notification: Pin
Sudhakar Pasupunuri22-Sep-04 0:45
Sudhakar Pasupunuri22-Sep-04 0:45 
GeneralRe: Scrollbar movement Notification: Pin
Heath Stewart22-Sep-04 9:38
protectorHeath Stewart22-Sep-04 9:38 
GeneralProcessStartInfo Pin
exhaulted22-Sep-04 0:34
exhaulted22-Sep-04 0:34 
GeneralRe: ProcessStartInfo Pin
Heath Stewart22-Sep-04 7:27
protectorHeath Stewart22-Sep-04 7:27 
GeneralRe: ProcessStartInfo Pin
exhaulted22-Sep-04 22:33
exhaulted22-Sep-04 22:33 
QuestionHow to remember selection of user after program is closed? Dynamic properties? Pin
mitreviper22-Sep-04 0:34
mitreviper22-Sep-04 0:34 
AnswerRe: How to remember selection of user after program is closed? Dynamic properties? Pin
exhaulted22-Sep-04 0:43
exhaulted22-Sep-04 0:43 
AnswerRe: How to remember selection of user after program is closed? Dynamic properties? Pin
Philip Fitzsimons22-Sep-04 3:06
Philip Fitzsimons22-Sep-04 3:06 
Questionhow to use sql pane Pin
rofida refat22-Sep-04 0:07
sussrofida refat22-Sep-04 0:07 
GeneralDataTable Access Problem Pin
Sakkijha22-Sep-04 0:02
Sakkijha22-Sep-04 0:02 
GeneralRe: DataTable Access Problem Pin
exhaulted22-Sep-04 0:25
exhaulted22-Sep-04 0:25 
GeneralRe: DataTable Access Problem Pin
Sakkijha22-Sep-04 23:00
Sakkijha22-Sep-04 23:00 

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.