Imports AxSftButtonLib25
Imports SftButtonLib25
Imports Softelvdm.OLEConvert
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents SftHelperComponent1 As Softelvdm.OCXHelper.SftHelperComponent
Friend WithEvents label5 As System.Windows.Forms.Label
Friend WithEvents check2 As System.Windows.Forms.CheckBox
Friend WithEvents CloseButton As AxSftButtonLib25.AxSftButton
Friend WithEvents label2 As System.Windows.Forms.Label
Friend WithEvents label4 As System.Windows.Forms.Label
Friend WithEvents label3 As System.Windows.Forms.Label
Friend WithEvents label1 As System.Windows.Forms.Label
Friend WithEvents check1 As System.Windows.Forms.CheckBox
Friend WithEvents ImageList2 As System.Windows.Forms.ImageList
Friend WithEvents AxSftButtonCheck As AxSftButtonLib25.AxSftButton
Friend WithEvents AxSftButton2 As AxSftButtonLib25.AxSftButton
Friend WithEvents AxSftButton1 As AxSftButtonLib25.AxSftButton
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.SftHelperComponent1 = New Softelvdm.OCXHelper.SftHelperComponent(Me.components)
Me.label5 = New System.Windows.Forms.Label
Me.AxSftButtonCheck = New AxSftButtonLib25.AxSftButton
Me.check2 = New System.Windows.Forms.CheckBox
Me.AxSftButton2 = New AxSftButtonLib25.AxSftButton
Me.CloseButton = New AxSftButtonLib25.AxSftButton
Me.label2 = New System.Windows.Forms.Label
Me.label4 = New System.Windows.Forms.Label
Me.label3 = New System.Windows.Forms.Label
Me.label1 = New System.Windows.Forms.Label
Me.check1 = New System.Windows.Forms.CheckBox
Me.AxSftButton1 = New AxSftButtonLib25.AxSftButton
Me.ImageList2 = New System.Windows.Forms.ImageList(Me.components)
CType(Me.AxSftButtonCheck, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.AxSftButton2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.CloseButton, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.AxSftButton1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(30, 32)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.White
'
'label5
'
Me.label5.Location = New System.Drawing.Point(16, 376)
Me.label5.Name = "label5"
Me.label5.Size = New System.Drawing.Size(448, 32)
Me.label5.TabIndex = 22
Me.label5.Text = "We don't think you'll be using SftButton for check boxes, but it does demonstrate" & _
" the flexibility of the control quite nicely."
'
'AxSftButtonCheck
'
Me.AxSftButtonCheck.Location = New System.Drawing.Point(16, 344)
Me.AxSftButtonCheck.Name = "AxSftButtonCheck"
Me.AxSftButtonCheck.OcxState = CType(resources.GetObject("AxSftButtonCheck.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxSftButtonCheck.Size = New System.Drawing.Size(160, 24)
Me.AxSftButtonCheck.TabIndex = 21
'
'check2
'
Me.check2.Location = New System.Drawing.Point(176, 280)
Me.check2.Name = "check2"
Me.check2.Size = New System.Drawing.Size(168, 24)
Me.check2.TabIndex = 20
Me.check2.Text = "Auto-size this button"
'
'AxSftButton2
'
Me.AxSftButton2.Location = New System.Drawing.Point(16, 248)
Me.AxSftButton2.Name = "AxSftButton2"
Me.AxSftButton2.OcxState = CType(resources.GetObject("AxSftButton2.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxSftButton2.Size = New System.Drawing.Size(152, 80)
Me.AxSftButton2.TabIndex = 19
'
'CloseButton
'
Me.CloseButton.Location = New System.Drawing.Point(512, 24)
Me.CloseButton.Name = "CloseButton"
Me.CloseButton.OcxState = CType(resources.GetObject("CloseButton.OcxState"), System.Windows.Forms.AxHost.State)
Me.CloseButton.Size = New System.Drawing.Size(48, 48)
Me.CloseButton.TabIndex = 14
'
'label2
'
Me.label2.Location = New System.Drawing.Point(16, 40)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(416, 32)
Me.label2.TabIndex = 13
Me.label2.Text = "A SftButton control can define images for each state (hot, pressed, disabled or n" & _
"ormal). In this sample, they were defined using the property pages."
'
'label4
'
Me.label4.Location = New System.Drawing.Point(16, 104)
Me.label4.Name = "label4"
Me.label4.Size = New System.Drawing.Size(416, 32)
Me.label4.TabIndex = 16
Me.label4.Text = "To see the different images (or states), move the mouse cursor over the control, " & _
"click the button and disable it using the ""Disabled"" checkbox next to it."
'
'label3
'
Me.label3.Location = New System.Drawing.Point(16, 80)
Me.label3.Name = "label3"
Me.label3.Size = New System.Drawing.Size(416, 16)
Me.label3.TabIndex = 15
Me.label3.Text = "This sample uses translucent PNG images."
'
'label1
'
Me.label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.label1.Location = New System.Drawing.Point(16, 8)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(296, 24)
Me.label1.TabIndex = 12
Me.label1.Text = "Images Sample"
'
'check1
'
Me.check1.Location = New System.Drawing.Point(208, 172)
Me.check1.Name = "check1"
Me.check1.Size = New System.Drawing.Size(112, 24)
Me.check1.TabIndex = 18
Me.check1.Text = "Disabled"
'
'AxSftButton1
'
Me.AxSftButton1.Location = New System.Drawing.Point(16, 144)
Me.AxSftButton1.Name = "AxSftButton1"
Me.AxSftButton1.OcxState = CType(resources.GetObject("AxSftButton1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxSftButton1.Size = New System.Drawing.Size(184, 80)
Me.AxSftButton1.TabIndex = 17
'
'ImageList2
'
Me.ImageList2.ImageSize = New System.Drawing.Size(30, 32)
Me.ImageList2.ImageStream = CType(resources.GetObject("ImageList2.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList2.TransparentColor = System.Drawing.Color.White
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(586, 416)
Me.Controls.Add(Me.check2)
Me.Controls.Add(Me.AxSftButton2)
Me.Controls.Add(Me.CloseButton)
Me.Controls.Add(Me.label2)
Me.Controls.Add(Me.label4)
Me.Controls.Add(Me.label3)
Me.Controls.Add(Me.label1)
Me.Controls.Add(Me.check1)
Me.Controls.Add(Me.AxSftButton1)
Me.Controls.Add(Me.label5)
Me.Controls.Add(Me.AxSftButtonCheck)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "Form1"
Me.Text = "Softel vdm, Inc. - Images Sample"
CType(Me.AxSftButtonCheck, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.AxSftButton2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.CloseButton, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.AxSftButton1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
'--locate-marker--
Private savedSize As Size
Private savedLoc As Point
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' save the button size to demonstrate auto-sizing
savedSize = AxSftButton2.Size
savedLoc = AxSftButton2.Location
' initialize a SftButton control to look like a check box
AxSftButtonCheck.BorderAlways = False
#If VisualStudio2003AndEarlier Then
AxSftButtonCheck.AutoSize = SftButtonAutoSizeConstants.autosizeSftButtonLeftCenter
#Else
AxSftButtonCheck.CtlAutoSize = SftButtonAutoSizeConstants.autosizeSftButtonLeftCenter
#End If
AxSftButtonCheck.Bounce = SftButtonBounceStyleConstants.bounceSftButtonNo
AxSftButtonCheck.ButtonStyle = SftButtonStyleConstants.styleSftButtonNone
AxSftButtonCheck.ClickStyle = SftButtonClickStyleConstants.clickstyleSftButtonPictures
AxSftButtonCheck.HoverStyle = SftButtonHoverStyleConstants.hoverstyleSftButtonExact
AxSftButtonCheck.Image1.Appearance = SftPictureImageConstants.sftImageCheckboxYes
AxSftButtonCheck.Text = "A SftButton control that looks like a check box with a caption"
AxSftButtonCheck.ShowFocus = False
End Sub
Private Sub check1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles check1.CheckedChanged
' enable/disable the control so the image changes
AxSftButton1.Enabled = Not check1.Checked
End Sub
Private Sub check2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles check2.CheckedChanged
' resize the control
If check2.Checked Then
#If VisualStudio2003AndEarlier Then
AxSftButton2.AutoSize = SftButtonAutoSizeConstants.autosizeSftButtonLeftCenter
#Else
AxSftButton2.CtlAutoSize = SftButtonAutoSizeConstants.autosizeSftButtonLeftCenter
#End If
Else
#If VisualStudio2003AndEarlier Then
AxSftButton2.AutoSize = SftButtonAutoSizeConstants.autosizeSftButtonNone
#Else
AxSftButton2.CtlAutoSize = SftButtonAutoSizeConstants.autosizeSftButtonNone
#End If
AxSftButton2.Location = savedLoc
AxSftButton2.Size = savedSize
End If
End Sub
Private Sub CloseButton_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles CloseButton.ClickEvent
Application.Exit()
End Sub
Private Sub AxSftButtonCheck_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButtonCheck.ClickEvent
' toggle the check box
If AxSftButtonCheck.Image1.Appearance = SftPictureImageConstants.sftImageCheckboxYes Then
AxSftButtonCheck.Image1.Appearance = SftPictureImageConstants.sftImageCheckboxNo
Else
AxSftButtonCheck.Image1.Appearance = SftPictureImageConstants.sftImageCheckboxYes
End If
End Sub
Private Sub AxSftButtonCheck_DblClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButtonCheck.DblClick
AxSftButtonCheck_ClickEvent(Nothing, Nothing)
End Sub
End Class