Results 1 to 4 of 4

Thread: [RESOLVED] Align PictureBox

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    58

    Resolved [RESOLVED] Align PictureBox

    I have a picturebox on my form, on form load the form is maximized on the screen. What I want is to align this picture in the top right hand corner of the form. It seems simple, but I cant figure out how to do it. Any suggestions please let me know.

  2. #2
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: Align PictureBox

    Firstly, use the Form 'Activated' event. Secondly, you can align the picture box by doing something like..

    pictureBox.Location = new Point(this.Size.Width - pictureBox.Width, 0);

    That would be the top right of the form

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Align PictureBox

    Just set the Anchor property of the PictureBox to Top, Left and it will maintain its position relative to the top, left corner regardless of how you resize the form. You then set the Size and Location of the control such that it is the distance from those edges that you want it to maintain.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    58

    Re: Align PictureBox

    Thanks, setting the anchor worked perfectly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width