Monday, 15 March 2010

image - VB.NET Picturebox Transparency? -



image - VB.NET Picturebox Transparency? -

i creating programme allows user select number of seats (whch pictureboxes) reserve seats want upcoming play. requires layout compact , require of images overap each other. images using transparent .png's, when 1 image box overlaps still cuts one. can help me this? thanks.

coding language: vb.net in microsoft visual studio 2010

problem:

controls in winforms don't handle transparency well. false drawing underlying form on themselves, not include other controls.

two possibilities:

consider switching wpf instead of winforms.

draw images in 1 bitmap , display in 1 big picturebox.

without knowing how code looks like. consider little image of seat seat.png in application directory. consider columncount , rowcount define how many seats there per row , how many rows there are. adjust bmpout size accordingly.

dim bmpout new bitmap(640,480) using seatimage new bitmap("seat.png") using g graphics = graphics.fromimage(bmpout) x = 0 columncount - 1 y = 0 rowcount - 1 g.drawimageunscaled(seatimage, x*seatimage.width, y*seatimage.height) next y next x end using end using if picturebox1.image isnot nil picturebox1.image.dispose() picturebox1.image = bmpout

this should utilize transparency of png correctly.

vb.net image transparency vb.net-2010 picturebox

No comments:

Post a Comment