transparent button upon an image

G

Guest

Hi!

I have a windowsform with an imagebox inside a groupbox. The imagebox shows
a image of a man with joints (for medical purose - shoulder, ancle, wrist
etc.). The user is able to mark the jonts by clicking on the spesific joint.
I solved this by using checkbox (with button-appearance) upon each joint.

I know wish to further develop my windows-application. How can I make my
button-appearance checkboxs to be transparent? I wish to to se the joint
(image) through the checkbox, not the default backcolor of the groupbox
control.

Any help or guideline appreciates.

Best regard
Hans Årsjö
 
B

Brian Schwartz

You might have to use ControlPaint.DrawBorder. You'd eliminate your
checkboxes and add a property to your form for each boolean value. Then in
your form's paint event, call ControlPaint.DrawBorder for each one, passing
in a ButtonBorderStyle of Inset or Outset depending on whether the value is
true or false. In MouseDown or MouseUp, check whether the mouse coordinates
are within one of the rectangles you've drawn, and if so, flip the boolean
value and Invalidate your picture box.

If you want to have complete professionalism in the mouse handling of your
drawn rectangles so they behave like buttons it gets more involved, but this
will get you started on the basic idea.
 
G

Guest

Hi Brian!

Thank you for your reply. I'm greatful for your help.

I'm afraid that my application will be more complicated when the drawborder
aslo should apeare as buttons...

But as you said.... It is a start :)
 
Top