Region and PictureBox.Image Resize

M

M West

continuation of my previous post, thanks to all those that contributed with
answers

I am creating a control that will take an image and make parts of it
transparent, this is done by creating and then applying a region to the
control. The control inherits from picturebox and works fine when loading
the image into the control, the problem that I am having now is, once the
control is loaded and the image is displayed, if the user resizes the
picturebox, the image does not extend to the new properties and is confined
to the specified region e.g. the image stretches correctly but can only be
seen in the area specified by a region, is there a way to disable this
region once the image is loaded and still maintain the transparency
correctly (irregular shape) or is this correct.

code bits...........

me.region = transparentregion
me.image = bmpNewTrans (after having transparent regions excluded)

graphics stuff to smooth the image and redraw it

me.refresh


thanks in advance

Mark
 
M

Mick Doherty

I don't recall seeing your last post, but to answer this query....

at the OnResize event of your control recreate transparentregion then set it
to the control.

Protected overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)
Region = CreateTransparentRegion()
End Sub

Function CreateTransparentRegion() As Region
'code to create and return a region
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top