Place form 10px from right side of screen.
-
Hi, I want to place my windows form 10 pixels from the right side of my user's screen. But they have different screen resolutions, so i cant place it with a value in pixels. So do anyone know how to do it? I'm using this code on my form-load, to place the window:
this.Height = 175; this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
Thanks, Elias Sorensen -
Hi, I want to place my windows form 10 pixels from the right side of my user's screen. But they have different screen resolutions, so i cant place it with a value in pixels. So do anyone know how to do it? I'm using this code on my form-load, to place the window:
this.Height = 175; this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
Thanks, Elias Sorensenint distanceFromRight=10; int distanceFromBottom=10; int screenWidth=Screen.PrimaryScreen.WorkingArea.Width; int screenHeight = Screen.PrimaryScreen.WorkingArea.Height; this.Left = screenWidth - this.Width - distanceFromRight; this.Top=screenHeight-this.Height-distanceFromBottom;
or you can useint x = screenWidth - this.Width - distanceFromRight; int y= screenHeight-this.Height-distanceFromBottom; this.SetBounds(x,y,this.Width,this.Height);
-
Hi, I want to place my windows form 10 pixels from the right side of my user's screen. But they have different screen resolutions, so i cant place it with a value in pixels. So do anyone know how to do it? I'm using this code on my form-load, to place the window:
this.Height = 175; this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
Thanks, Elias SorensenHi, your code is placing the window at the bottom end of the screen, but flush left since you specified zero for X. you could replace that zero by an expression that is basically the same as you did for Y, substituting widths for heights of course. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi, I want to place my windows form 10 pixels from the right side of my user's screen. But they have different screen resolutions, so i cant place it with a value in pixels. So do anyone know how to do it? I'm using this code on my form-load, to place the window:
this.Height = 175; this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
Thanks, Elias Sorensen