imports System
imports System.Drawing
imports System.Windows.Forms
public class ButtonFlatStyle : inherits Form
dim btn as Button
dim i as integer
dim theStyles as FlatStyle()
dim img as Image = Image.FromFile("yourfile.jpg")
public sub New()
Text = "Button Properties"
Size = new Size(300,200)
btn = new Button()
btn.Parent = me
btn.Text = btn.FlatStyle.ToString()
btn.Location = new Point(10,10)
btn.Size = new Size(200,100)
btn.BackColor = Color.LightGreen
AddHandler btn.Click, AddressOf btn_Click
btn.Image = img
btn.ImageAlign = ContentAlignment.MiddleRight
btn.TextAlign = ContentAlignment.MiddleLeft
dim theEnum as new FlatStyle()
theStyles = CType([Enum].GetValues(theEnum.GetType()), FlatStyle())
end sub
public shared sub Main()
Application.Run(new ButtonFlatStyle())
end sub
private sub btn_Click(ByVal sender as object, ByVal e as EventArgs)
Dim btn as Button = CType(sender, Button)
btn.FlatStyle = theStyles(i)
btn.Text = btn.FlatStyle.ToString()
if (i < theStyles.Length - 1) then
i = i + 1
else
i = 0
end if
end sub
end class
|