vb.net - PictureBox - Opacity paint inside given coordinates -
i have picturebox , inside want paint (with opacity don't full hide painted region) determinated region of picture coordniates given.
so far i've 'if' statement when user click picturebox checks if region correct coordinates:
if localmouseposition.x >= 87 , localmouseposition.x <= 131 , localmouseposition.y >= 5 , localmouseposition.y <= 55 label1.text = "coordinate correct" else label1.text = "" end if
now i've no idea how paint clicked region.
thanks in advance.
try like...
public class form1 private intarget boolean = false private target new rectangle(new point(87, 5), new size(45, 51)) private sub picturebox1_click(sender system.object, e system.eventargs) handles picturebox1.click dim clientcoords point = picturebox1.pointtoclient(cursor.position) intarget = target.contains(clientcoords) label1.text = iif(intarget, "coordinate correct", "") picturebox1.refresh() end sub private sub picturebox1_paint(sender object, e system.windows.forms.painteventargs) handles picturebox1.paint if intarget using highlight new solidbrush(color.fromargb(128, color.yellow)) ' 0 255 e.graphics.fillrectangle(highlight, target) end using end if end sub end class
Comments
Post a Comment