Option Strict Off
Option Explicit On
Friend 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()
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
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents Text2 As System.Windows.Forms.TextBox
Public WithEvents Command1 As System.Windows.Forms.Button
Public WithEvents Text1 As System.Windows.Forms.TextBox
Public WithEvents Label6 As System.Windows.Forms.Label
Public WithEvents Label4 As System.Windows.Forms.Label
Public WithEvents Label5 As System.Windows.Forms.Label
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents Picture1 As System.Windows.Forms.Panel
Public WithEvents Image1 As System.Windows.Forms.PictureBox
Public WithEvents Frame1 As System.Windows.Forms.Panel
Public WithEvents Label3 As System.Windows.Forms.Label
Public WithEvents Label1 As System.Windows.Forms.Label
'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.
<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.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.Text2 = New System.Windows.Forms.TextBox
Me.Command1 = New System.Windows.Forms.Button
Me.Text1 = New System.Windows.Forms.TextBox
Me.Picture1 = New System.Windows.Forms.Panel
Me.Label6 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Frame1 = New System.Windows.Forms.Panel
Me.Image1 = New System.Windows.Forms.PictureBox
Me.Label3 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.Picture1.SuspendLayout()
Me.Frame1.SuspendLayout()
Me.SuspendLayout()
'
'Text2
'
Me.Text2.AcceptsReturn = True
Me.Text2.AutoSize = False
Me.Text2.BackColor = System.Drawing.SystemColors.Window
Me.Text2.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Text2.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text2.Location = New System.Drawing.Point(3, 175)
Me.Text2.MaxLength = 0
Me.Text2.Name = "Text2"
Me.Text2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text2.Size = New System.Drawing.Size(333, 25)
Me.Text2.TabIndex = 10
Me.Text2.Text = "Put your mouse on me"
'
'Command1
'
Me.Command1.BackColor = System.Drawing.SystemColors.Control
Me.Command1.Cursor = System.Windows.Forms.Cursors.Default
Me.Command1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Command1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Command1.Location = New System.Drawing.Point(224, 64)
Me.Command1.Name = "Command1"
Me.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Command1.Size = New System.Drawing.Size(108, 23)
Me.Command1.TabIndex = 8
Me.Command1.Text = "Test Password"
'
'Text1
'
Me.Text1.AcceptsReturn = True
Me.Text1.AutoSize = False
Me.Text1.BackColor = System.Drawing.SystemColors.Window
Me.Text1.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text1.Font = New System.Drawing.Font("Courier New", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Text1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text1.Location = New System.Drawing.Point(78, 64)
Me.Text1.MaxLength = 0
Me.Text1.Name = "Text1"
Me.Text1.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.Text1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text1.Size = New System.Drawing.Size(139, 22)
Me.Text1.TabIndex = 2
Me.Text1.Text = ""
'
'Picture1
'
Me.Picture1.BackColor = System.Drawing.Color.White
Me.Picture1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Picture1.Controls.Add(Me.Label6)
Me.Picture1.Controls.Add(Me.Label4)
Me.Picture1.Controls.Add(Me.Label5)
Me.Picture1.Controls.Add(Me.Label2)
Me.Picture1.Cursor = System.Windows.Forms.Cursors.Default
Me.Picture1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Picture1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Picture1.Location = New System.Drawing.Point(2, 207)
Me.Picture1.Name = "Picture1"
Me.Picture1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Picture1.Size = New System.Drawing.Size(507, 116)
Me.Picture1.TabIndex = 1
Me.Picture1.TabStop = True
'
'Label6
'
Me.Label6.BackColor = System.Drawing.Color.Transparent
Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
Me.Label6.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label6.Location = New System.Drawing.Point(4, 56)
Me.Label6.Name = "Label6"
Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label6.Size = New System.Drawing.Size(122, 17)
Me.Label6.TabIndex = 7
Me.Label6.Text = "API"
'
'Label4
'
Me.Label4.BackColor = System.Drawing.Color.Transparent
Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
Me.Label4.Font = New System.Drawing.Font("Courier New", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.ForeColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(0, Byte), CType(0, Byte))
Me.Label4.Location = New System.Drawing.Point(4, 74)
Me.Label4.Name = "Label4"
Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label4.Size = New System.Drawing.Size(498, 53)
Me.Label4.TabIndex = 6
Me.Label4.Text = "ClientToScreen, CreateWindowEx, DestroyWindow, GetKeyState, InitCommonControls, S" & _
"endMessage, SendMessageLong"
'
'Label5
'
Me.Label5.BackColor = System.Drawing.Color.Transparent
Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
Me.Label5.Font = New System.Drawing.Font("Courier New", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.Color.Blue
Me.Label5.Location = New System.Drawing.Point(4, 21)
Me.Label5.Name = "Label5"
Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label5.Size = New System.Drawing.Size(498, 41)
Me.Label5.TabIndex = 4
Me.Label5.Text = "This demo will show you how to create a balloon style tooltip using API. For more" & _
" information please check our API Dictionary."
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Location = New System.Drawing.Point(4, 3)
Me.Label2.Name = "Label2"
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.Size = New System.Drawing.Size(122, 17)
Me.Label2.TabIndex = 5
Me.Label2.Text = "Example Description"
'
'Frame1
'
Me.Frame1.BackColor = System.Drawing.Color.Black
Me.Frame1.Controls.Add(Me.Image1)
Me.Frame1.Cursor = System.Windows.Forms.Cursors.Default
Me.Frame1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Frame1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Frame1.Location = New System.Drawing.Point(0, 0)
Me.Frame1.Name = "Frame1"
Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Frame1.Size = New System.Drawing.Size(667, 49)
Me.Frame1.TabIndex = 0
'
'Image1
'
Me.Image1.Cursor = System.Windows.Forms.Cursors.Default
Me.Image1.Image = CType(resources.GetObject("Image1.Image"), System.Drawing.Image)
Me.Image1.Location = New System.Drawing.Point(8, 8)
Me.Image1.Name = "Image1"
Me.Image1.Size = New System.Drawing.Size(276, 33)
Me.Image1.TabIndex = 0
Me.Image1.TabStop = False
'
'Label3
'
Me.Label3.BackColor = System.Drawing.SystemColors.Control
Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
Me.Label3.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(0, Byte), CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(6, 89)
Me.Label3.Name = "Label3"
Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label3.Size = New System.Drawing.Size(322, 30)
Me.Label3.TabIndex = 9
Me.Label3.Text = "To test on demand warning balloon tool tip turn CAPS LOCK on"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.Control
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(8, 69)
Me.Label1.Name = "Label1"
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.Size = New System.Drawing.Size(64, 19)
Me.Label1.TabIndex = 3
Me.Label1.Text = "Password"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.SystemColors.Control
Me.ClientSize = New System.Drawing.Size(511, 325)
Me.Controls.Add(Me.Text2)
Me.Controls.Add(Me.Command1)
Me.Controls.Add(Me.Text1)
Me.Controls.Add(Me.Picture1)
Me.Controls.Add(Me.Frame1)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label1)
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ForeColor = System.Drawing.Color.Black
Me.Location = New System.Drawing.Point(4, 23)
Me.Name = "Form1"
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text = "Ballon Style ToolTip Demo"
Me.Picture1.ResumeLayout(False)
Me.Frame1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim TT1 As New CBalloonToolTip '//Demo for On Demand tooltip
Dim TT2 As New CBalloonToolTip '//Demo for mouse over tooltip
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As Short
Public Function CapsLockOn() As Boolean
Dim iKeyState As Short
iKeyState = GetKeyState(System.Windows.Forms.Keys.Capital)
CapsLockOn = (iKeyState = 1 Or iKeyState = -127)
End Function
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
If Text1.Text <> "mypassword" Then
TT1.Style = CBalloonToolTip.ttStyleEnum.TTBalloon
TT1.Icon = CBalloonToolTip.ttIconType.TTIconError
TT1.Title = IIf(Text1.Text = "", "Blank Password", "Invalid Password")
TT1.TipText = "Please Enter Correct Password..."
TT1.PopupOnDemand = True
TT1.CreateToolTip(Text1.Handle.ToInt32)
'TT1.Show(0, VB6.PixelsToTwipsY(Text1.Height) / VB6.TwipsPerPixelX - 1, Text1.Handle.ToInt32) '//In Pixel only
TT1.Show(0, Text1.Height - 1, Text1.Handle.ToInt32) '//In Pixel only
End If
End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
TT2.Style = CBalloonToolTip.ttStyleEnum.TTBalloon
TT2.Icon = CBalloonToolTip.ttIconType.TTIconInfo
TT2.Title = "Information"
TT2.TipText = "tooltip with kool color and font for Textbox2"
TT2.PopupOnDemand = False
TT2.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.White)
TT2.BackColor = &HCE7110
TT2.VisibleTime = 6000 'After 6 Seconds tooltip will go away
Dim myFont As New Font("Tahoma", 10, FontStyle.Italic Or FontStyle.Underline)
TT2.TipFont = myFont
TT2.CreateToolTip(Text2.Handle.ToInt32)
End Sub
Private Sub Form1_MouseDown(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Dim Button As Short = eventArgs.Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
TT1.Destroy()
End Sub
Private Sub Form1_Paint(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
TT1.Destroy()
End Sub
Private Sub Form1_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize
TT1.Destroy()
End Sub
Private Sub Form1_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
TT1.Destroy()
TT2.Destroy()
End Sub
Private Sub Text1_KeyDown(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyEventArgs) Handles Text1.KeyDown
Dim KeyCode As Short = eventArgs.KeyCode
Dim Shift As Short = eventArgs.KeyData \ &H10000
If CapsLockOn() Then
TT1.Style = CBalloonToolTip.ttStyleEnum.TTBalloon
TT1.Icon = CBalloonToolTip.ttIconType.TTIconWarning
TT1.Title = "Caps Lock is on"
TT1.TipText = "Check your caps lock key..."
TT1.CreateToolTip(Text1.Handle.ToInt32)
'TT1.Show(0, VB6.PixelsToTwipsY(Text1.Height) / VB6.TwipsPerPixelX - 1, Text1.Handle.ToInt32)
TT1.Show(0, Text1.Height - 1, Text1.Handle.ToInt32)
Else
TT1.Destroy()
End If
End Sub
Private Sub Text1_MouseDown(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles Text1.MouseDown
Dim Button As Short = eventArgs.Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
TT1.Destroy()
End Sub
End Class