VB.Net Tutorial/GUI/HelpProvider — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 19:40, 26 мая 2010
Use Helper provider (press F1 to display the message)
<source lang="vbnet">Imports System.Windows.Forms public class UseHelpProvider
public Shared Sub Main Application.Run(New Form1) End Sub
End class Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load HelpProvider1.SetHelpString(txtName, "customer"s name.") HelpProvider1.SetHelpString(txtStreet, "street number and name.") HelpProvider1.SetHelpString(txtCity, "city.") HelpProvider1.SetHelpString(txtState, "state.") HelpProvider1.SetHelpString(txtZip, "ZIP code.") End Sub
End Class <Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Public Class Form1
Inherits System.Windows.Forms.Form "Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub "Required by the Windows Form Designer Private components As System.ruponentModel.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. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.HelpProvider1 = New System.Windows.Forms.HelpProvider Me.txtZip = New System.Windows.Forms.TextBox Me.Label6 = New System.Windows.Forms.Label Me.txtState = New System.Windows.Forms.TextBox Me.Label5 = New System.Windows.Forms.Label Me.txtCity = New System.Windows.Forms.TextBox Me.Label3 = New System.Windows.Forms.Label Me.txtStreet = New System.Windows.Forms.TextBox Me.Label4 = New System.Windows.Forms.Label Me.txtName = New System.Windows.Forms.TextBox Me.Label1 = New System.Windows.Forms.Label Me.SuspendLayout() " "txtZip " Me.txtZip.Location = New System.Drawing.Point(192, 80) Me.txtZip.Name = "txtZip" Me.txtZip.Size = New System.Drawing.Size(40, 20) Me.txtZip.TabIndex = 23 " "Label6 " Me.Label6.AutoSize = True Me.Label6.Location = New System.Drawing.Point(160, 80) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(20, 13) Me.Label6.TabIndex = 22 Me.Label6.Text = "ZIP" " "txtState " Me.txtState.Location = New System.Drawing.Point(88, 80) Me.txtState.Name = "txtState" Me.txtState.Size = New System.Drawing.Size(40, 20) Me.txtState.TabIndex = 21 " "Label5 " Me.Label5.AutoSize = True Me.Label5.Location = New System.Drawing.Point(8, 80) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(28, 13) Me.Label5.TabIndex = 20 Me.Label5.Text = "State" " "txtCity " Me.txtCity.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.txtCity.Location = New System.Drawing.Point(88, 56) Me.txtCity.Name = "txtCity" Me.txtCity.Size = New System.Drawing.Size(204, 20) Me.txtCity.TabIndex = 19 " "Label3 " Me.Label3.AutoSize = True Me.Label3.Location = New System.Drawing.Point(8, 56) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(20, 13) Me.Label3.TabIndex = 18 Me.Label3.Text = "City" " "txtStreet " Me.txtStreet.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.txtStreet.Location = New System.Drawing.Point(88, 32) Me.txtStreet.Name = "txtStreet" Me.txtStreet.Size = New System.Drawing.Size(204, 20) Me.txtStreet.TabIndex = 17 " "Label4 " Me.Label4.AutoSize = True Me.Label4.Location = New System.Drawing.Point(8, 32) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(31, 13) Me.Label4.TabIndex = 16 Me.Label4.Text = "Street" " "txtName " Me.txtName.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.txtName.Location = New System.Drawing.Point(88, 8) Me.txtName.Name = "txtName" Me.txtName.Size = New System.Drawing.Size(204, 20) Me.txtName.TabIndex = 13 " "Label1 " Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(8, 8) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(78, 13) Me.Label1.TabIndex = 12 Me.Label1.Text = "Customer Name" " "Form1 " Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(296, 107) Me.Controls.Add(Me.txtZip) Me.Controls.Add(Me.Label6) Me.Controls.Add(Me.txtState) Me.Controls.Add(Me.Label5) Me.Controls.Add(Me.txtCity) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.txtStreet) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.txtName) Me.Controls.Add(Me.Label1) Me.Name = "Form1" Me.Text = "UseHelpProvider" Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider Friend WithEvents txtZip As System.Windows.Forms.TextBox Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents txtState As System.Windows.Forms.TextBox Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents txtCity As System.Windows.Forms.TextBox Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents txtStreet As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents txtName As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label
End Class</source>
Use HelpProvider to launch a web page
<source lang="vbnet">Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class HelpProviderWebPage
public Shared Sub Main Application.Run(New Form1) End Sub
End class <Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Class Form1
Inherits System.Windows.Forms.Form "Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub "Required by the Windows Form Designer Private components As System.ruponentModel.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. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button Me.HelpProvider1 = New System.Windows.Forms.HelpProvider Me.Button2 = New System.Windows.Forms.Button Me.CheckBox1 = New System.Windows.Forms.CheckBox Me.CheckBox2 = New System.Windows.Forms.CheckBox Me.SuspendLayout() " "Button1 " Me.HelpProvider1.SetHelpString(Me.Button1, "This is a button.") Me.Button1.Location = New System.Drawing.Point(112, 72) Me.Button1.Name = "Button1" Me.HelpProvider1.SetShowHelp(Me.Button1, True) Me.Button1.Size = New System.Drawing.Size(80, 24) Me.Button1.TabIndex = 0 Me.Button1.Text = "OK" Me.Button1.UseVisualStyleBackColor = True " "HelpProvider1 " Me.HelpProvider1.HelpNamespace = "http://www.vbex.ru" " "Button2 " Me.HelpProvider1.SetHelpString(Me.Button2, "This is a button.") Me.Button2.Location = New System.Drawing.Point(200, 72) Me.Button2.Name = "Button2" Me.HelpProvider1.SetShowHelp(Me.Button2, True) Me.Button2.Size = New System.Drawing.Size(80, 24) Me.Button2.TabIndex = 1 Me.Button2.Text = "Cancel" Me.Button2.UseVisualStyleBackColor = True " "CheckBox1 " Me.CheckBox1.AutoSize = True Me.CheckBox1.Location = New System.Drawing.Point(8, 16) Me.CheckBox1.Name = "CheckBox1" Me.HelpProvider1.SetShowHelp(Me.CheckBox1, True) Me.CheckBox1.Size = New System.Drawing.Size(270, 17) Me.CheckBox1.TabIndex = 3 Me.CheckBox1.Text = "Start application automatically when Windows starts" Me.CheckBox1.UseVisualStyleBackColor = True " "CheckBox2 " Me.CheckBox2.AutoSize = True Me.CheckBox2.Location = New System.Drawing.Point(8, 40) Me.CheckBox2.Name = "CheckBox2" Me.CheckBox2.Size = New System.Drawing.Size(142, 17) Me.CheckBox2.TabIndex = 4 Me.CheckBox2.Text = "Show icon in system tray" Me.CheckBox2.UseVisualStyleBackColor = True " "Form1 " Me.AcceptButton = Me.Button1 Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(292, 107) Me.Controls.Add(Me.CheckBox2) Me.Controls.Add(Me.CheckBox1) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.HelpButton = True Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "Form1" Me.Text = "Application Configuration" Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
End Class</source>