Apr 9th, 2012, 08:59 AM
[RESOLVED] Noob question on custom interface
I'm trying to get a button that filters out clicks based on transparency mask of a background image.
E.g. when I set FormBorderStyle to (none) and TransparencyKey to MyFormImage.GetPixel(0,0), then make a button with no border and a background image that uses the same transparency mask, I get the behavior that I want on the button, but it also punches a square hole in the form - not what I want.
Moreover, by using .maketransparent on the button image, I get the look, but not the behavior - same as clicking in a rectangular region.
Is there a simple way to make this work?
Any manual alternatives are looking rather involved if I happen to have multiple or overlapping buttons.
If not, can I turn off the border that appears around the button region during a click action?
Apr 9th, 2012, 10:18 AM
Re: Noob question on custom interface
Never mind, got it.
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim testButton As New Button
testButton.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(0)
tesButtont.FlatAppearance.BorderSize = 0
testButton.FlatAppearance.MouseDownBackColor = Color.Transparent
testButton.FlatAppearance.MouseOverBackColor = Color.Transparent
testButton.FlatStyle = FlatStyle.Flat
testButton.BackColor = Color.Transparent
testButton.AutoSize = False
Me.imgBackground = New Bitmap("../../Doodley.bmp")
testButton.Size = imgBackground.Size
testButton.BackgroundImage = imgBackground
testButton.Location = New Point(50, 100)
AddHandler test.Click, AddressOf testButton_Click
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs)
MessageBox.Show("Button1 was clicked!")
Click Here to Expand Forum to Full Width
Survey posted by VBForums.