Results 1 to 4 of 4

Thread: Making the Form bottom right

  1. #1
    Join Date
    Nov 2008
    Posts
    1,514

    Making the Form bottom right

    Just wondering if anyone has a way to do this, that works, that they can recommend. Would like it so that my program do all the way down to the right when it starts up, that is on the main screen, right above the clock and system tray. Tried to put Location by using screenbounds and withdraw from the height and width, but then found only 1 / 4 of the window, then the other 3 / 4 was off the screen and both down on the side. Something I do not completely made. So when I wondered if there was maybe something muffins with these screen bounds issues. Some who have mirrors?

  2. #2
    Join Date
    May 2008
    Posts
    3,971

    Re: Making the Form bottom right

    Have you tried with Screen.PrimaryScreen.WorkingArea ? If not try this code:

    Code:
    this.Location = new Point (Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

  3. #3
    Join Date
    May 2008
    Posts
    271

    Re: Making the Form bottom right

    Quote Originally Posted by switchblade327 View Post
    Have you tried with Screen.PrimaryScreen.WorkingArea ? If not try this code:

    Code:
    this.Location = new Point (Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
    The code works poorly, if start is not located in the bottom ...

    Below code takes into account the start: (it is in VB.NET, convert it to C# even)

    Code:
     
    Public Shared Sub SetLoc(ByVal FName As System.Windows.Forms.Form, ByVal Padding As Integer, ByVal ScrLoc As Publics.Lcs) 
    
    Dim XLoc As Integer 
    Dim YLoc As Integer 
    
    YLoc = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - FName.Size.Height 
    XLoc = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - FName.Size.Width 
    
    If ScrLoc = Publics.Lcs.Upper_Left Then 
    FName.Location = New System.Drawing.Point (Padding + Screen.PrimaryScreen.WorkingArea.X, Padding + Screen.PrimaryScreen.WorkingArea.Y) 
    Elseif ScrLoc = Publics.Lcs.Upper_Right Then 
    FName.Location = New System.Drawing.Point (XLoc - Padding + Screen.PrimaryScreen.WorkingArea.X, Padding + Screen.PrimaryScreen.WorkingArea.Y) 
    Elseif ScrLoc = Publics.Lcs.Bottom_Left Then 
    FName.Location = New System.Drawing.Point (Padding + Screen.PrimaryScreen.WorkingArea.X, YLoc - Padding + Screen.PrimaryScreen.WorkingArea.Y) 
    Elseif ScrLoc = Publics.Lcs.Bottom_Right Then 
    FName.Location = New System.Drawing.Point (XLoc - Padding + Screen.PrimaryScreen.WorkingArea.X, YLoc - Padding + Screen.PrimaryScreen.WorkingArea.Y) 
    End If 
    
    End Sub 
    
    Public Enum LCS As Integer 
    
    Upper_Left = 1 
    Upper_Right = 2 
    Bottom_Left = 3 
    Bottom_Right = 4 
    
    End Enum

  4. #4
    Join Date
    Nov 2008
    Posts
    1,514

    Re: Making the Form bottom right

    Quote Originally Posted by switchblade327 View Post
    Have you tried with Screen.PrimaryScreen.WorkingArea ? If not try this code:

    Code:
    this.Location = new Point (Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
    So it works, yes. Strange ... was sure it was about what I had done before ... must have been with some muffins in my code. Anyways thanks for your help.

Similar Threads

  1. Replies: 5
    Last Post: 25-05-2011, 10:21 PM
  2. Replies: 2
    Last Post: 02-05-2011, 07:06 AM
  3. How to Auto Populate fields from sub form to form?
    By mich43 in forum Windows Software
    Replies: 6
    Last Post: 09-11-2010, 11:29 PM
  4. Procedure in VB to create form inside another form
    By Jalabala in forum Software Development
    Replies: 3
    Last Post: 16-11-2009, 02:14 PM
  5. Problem reloading MDI child form in main form.
    By AFFAN in forum Software Development
    Replies: 3
    Last Post: 30-01-2009, 09:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,875,771.38628 seconds with 16 queries