Button.FlatStyle : Button « System.Windows.Forms « VB.Net by API






Button.FlatStyle

  



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

   
    
  








Related examples in the same category

1.Button.Anchor
2.Button.BackColor
3.Button.Click
4.Button.HasChildren
5.Button.Image
6.Button.ImageAlign
7.Button.ImageIndex
8.Button.ImageList
9.Button.LostFocus
10.Button.MouseDown
11.Button.MouseEnter
12.Button.MouseHover
13.Button.MouseLeave
14.Button.MouseUp
15.Button.Paint
16.Button.Parent
17.Button.PerformClick
18.Button.Region
19.Button.Text
20.Button.TextAlign
21.Button.TopLevelControl
22.Button.UseVisualStyleBackColor