Click here to Skip to main content
16,013,592 members
Home / Discussions / C#
   

C#

 
GeneralRe: Switching Between Applications Pin
Heath Stewart21-May-04 6:08
protectorHeath Stewart21-May-04 6:08 
General.NET App Performance and Scalability Guide Pin
Dave Kreskowiak20-May-04 4:31
mveDave Kreskowiak20-May-04 4:31 
GeneralDir Search On Server Pin
IrishSonic20-May-04 4:14
IrishSonic20-May-04 4:14 
GeneralRe: Dir Search On Server Pin
Heath Stewart20-May-04 4:16
protectorHeath Stewart20-May-04 4:16 
GeneralRe: Dir Search On Server Pin
IrishSonic20-May-04 4:29
IrishSonic20-May-04 4:29 
GeneralRe: Dir Search On Server Pin
IrishSonic20-May-04 4:37
IrishSonic20-May-04 4:37 
GeneralRe: Dir Search On Server Pin
Heath Stewart20-May-04 4:43
protectorHeath Stewart20-May-04 4:43 
GeneralProblems with Screen.PrimaryScreen.Bounds Pin
kaloyan20-May-04 3:21
kaloyan20-May-04 3:21 
I'm writing a WinForms application that needs to update its user area on change of resolution by the user. I've overriden the WinProc method of my main form so that I can monitor the changes of the resolution and do what I need to do. Its body looks like this:

private const int WM_DISPLAYCHANGE = 0x007E; // this is the message notifying that the display resolution has been changed
protected override void WndProc(ref Message m)
{

base.WndProc (ref m);

if(m.Msg == WM_DISPLAYCHANGE)

{

MessageBox.Show("Width: " + Screen.PrimaryScreen.Bounds.Width + "\n" + "Height: " + Screen.PrimaryScreen.Bounds.Height);

}

}

The problem is that the Screen.PrimaryScreen.Bounds property doesn't work properly the first time the resolution is changed by the user after the application is started. It returns the previous resolution of the display. Here comes the strange part: all the following changes work fine.
I've tried using the Microsoft.Win32.SystemEvents.DisplaySettingsChanged event but the result is the same. Is there a way to get this right?

10x
K.
GeneralRe: Problems with Screen.PrimaryScreen.Bounds Pin
Heath Stewart20-May-04 4:14
protectorHeath Stewart20-May-04 4:14 
GeneralRe: Problems with Screen.PrimaryScreen.Bounds Pin
kaloyan20-May-04 21:52
kaloyan20-May-04 21:52 
GeneralRe: Problems with Screen.PrimaryScreen.Bounds Pin
Heath Stewart21-May-04 3:30
protectorHeath Stewart21-May-04 3:30 
GeneralSingle Instance of a class as long as it is in use Pin
SmithaC20-May-04 3:03
SmithaC20-May-04 3:03 
GeneralRe: Single Instance of a class as long as it is in use Pin
Grimolfr20-May-04 3:08
Grimolfr20-May-04 3:08 
GeneralRe: Single Instance of a class as long as it is in use Pin
Heath Stewart20-May-04 3:24
protectorHeath Stewart20-May-04 3:24 
GeneralRe: Single Instance of a class as long as it is in use Pin
scadaguy20-May-04 5:57
scadaguy20-May-04 5:57 
GeneralA general question about objects Pin
Christer Claesson20-May-04 2:47
Christer Claesson20-May-04 2:47 
GeneralRe: A general question about objects Pin
Heath Stewart20-May-04 3:08
protectorHeath Stewart20-May-04 3:08 
GeneralRe: A general question about objects Pin
Christer Claesson20-May-04 3:30
Christer Claesson20-May-04 3:30 
GeneralRe: A general question about objects Pin
Heath Stewart20-May-04 3:41
protectorHeath Stewart20-May-04 3:41 
GeneralRe: A general question about objects Pin
Christer Claesson20-May-04 4:02
Christer Claesson20-May-04 4:02 
GeneralRe: A general question about objects Pin
Grimolfr20-May-04 3:13
Grimolfr20-May-04 3:13 
GeneralRe: A general question about objects Pin
Heath Stewart20-May-04 3:34
protectorHeath Stewart20-May-04 3:34 
GeneralRe: A general question about objects Pin
Grimolfr20-May-04 5:09
Grimolfr20-May-04 5:09 
GeneralRe: A general question about objects Pin
Heath Stewart20-May-04 5:25
protectorHeath Stewart20-May-04 5:25 
GeneralRe: A general question about objects Pin
Grimolfr20-May-04 5:52
Grimolfr20-May-04 5:52 

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.