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






Button.TextAlign

  


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.FlatStyle
5.Button.HasChildren
6.Button.Image
7.Button.ImageAlign
8.Button.ImageIndex
9.Button.ImageList
10.Button.LostFocus
11.Button.MouseDown
12.Button.MouseEnter
13.Button.MouseHover
14.Button.MouseLeave
15.Button.MouseUp
16.Button.Paint
17.Button.Parent
18.Button.PerformClick
19.Button.Region
20.Button.Text
21.Button.TopLevelControl
22.Button.UseVisualStyleBackColor