Button FlatStyle : Button « GUI « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » GUI » Button 
14.3.3.Button FlatStyle
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 - 1then
      i = i + 1
    else
      i = 0
    end if
  end sub
end class
14.3.Button
14.3.1.Button PerformClickButton PerformClick
14.3.2.Button PropertiesButton Properties
14.3.3.Button FlatStyleButton FlatStyle
14.3.4.Button click eventButton click event
14.3.5.Add Button to a form and attach event handlerAdd Button to a form and attach event handler
14.3.6.Owner draw button
14.3.7.Button click event and text changed eventButton click event and text changed event
14.3.8.Button ImageListButton ImageList
14.3.9.Button with background imageButton with background image
14.3.10.Button AnchorButton Anchor
14.3.11.Irregular shape of ButtonIrregular shape of Button
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.