|
-
Apr 24th, 2010, 05:23 PM
#1
Thread Starter
Fanatic Member
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?
-
Apr 24th, 2010, 11:19 PM
#2
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.
-
Apr 25th, 2010, 08:47 AM
#3
Thread Starter
Fanatic Member
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
-
Apr 25th, 2010, 10:47 PM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|