Results 1 to 4 of 4

Thread: Binding multiple bitmaps

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    Binding multiple bitmaps

    Hello!
    I'm currently working on a project where I need to bind 3 different bitmaps.
    Bitmap1, Bitmap2, Bitmap3.

    I tried :
    bitmaps = Bitmap1 & Bitmap2 & Bitmap3

    But of course, that didn't work.

    If it's possible, I also need Bitmap1 and Bitmap3 to have a fixed size and Bitmap2 to change its width if the form is resized.

    Any ideas?

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

    Re: Binding multiple bitmaps

    Are we talking about a WinForms project? The Bitmap class is not a visual element. It contains the data for a bitmap image but it can't display anything on its own. You would need to use a PictureBox to display the Bitmap, by assigning the Bitmap to its Image property.

    As with all controls, a PictureBox will remain the same size by deafult. You would use its Anchor or Dock property to make it resize with its container. If you want more specific information then you'll have to provide more specific information on exactly what layout and behaviour you want.
    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

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    Re: Binding multiple bitmaps

    Hi jmcilhinney!
    Yes, we are indeed talking about a WinForms project.

    So you think that a good idea would be creating 3 pictureboxes where picturebox2 (the middle one) has it's anchor property manipulated so that it resizes itself when the form resizes?

    I'm gonna try this out, tell me if you have a better idea

    //Zeelia

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

    Re: Binding multiple bitmaps

    Here's what I think you have: there are three PictureBoxes in a row and when you resize the form you want the left one to remain the same size adjacent to the left side of the form, the right one to remain the same size adjacent to the right side of the form and the middle one to stretch and shrink to occupy the space in between. Is that correct? That's the sort of full and clear description you should be providing.

    If that's correct then you should use a TableLayoutPanel. You would give it one row and three columns. The left and right columns would be given a specific width and then the middle column would be given a relative width of 100%. You then add your PictureBoxes to the three cells and set the Dock of each one to Fill. You would also set the Anchor property of the TLP to Left,Top,Right. Now, as you resize the form, the TLP will resize with it. Internally, the left and right columns will maintain a constant width and the middle column will resize with the TLP. The PictureBox docked inside will resize with its cell.
    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

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