frmbasewithsip.vb

来自「Microsoft Mobile Development Handbook的代码」· VB 代码 · 共 38 行

VB
38
字号
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms
Imports System.ComponentModel

Namespace CodeForChapter2
  Public Partial Class frmBaseWithSIP
	  Inherits Form
	Public Sub New()
	  InitializeComponent()
	End Sub

	' Add a TextBox to the Form and add the two event handlers
	' Add an InputPanel control to the Form
	Private Sub textBox1_GotFocus(ByVal sender As Object, ByVal e As EventArgs) Handles textBox1.GotFocus
	  inputPanel1.Enabled = True
	End Sub

	Private Sub textBox1_LostFocus(ByVal sender As Object, ByVal e As EventArgs) Handles textBox1.LostFocus
	  inputPanel1.Enabled = False
	End Sub

	Private Sub inputPanel1_EnabledChanged(ByVal sender As Object, ByVal e As EventArgs) Handles inputPanel1.EnabledChanged
	  If inputPanel1.Enabled Then
		textBox2.Top -= inputPanel1.Bounds.Height
	  Else
		textBox2.Top += inputPanel1.Bounds.Height
	  End If
	End Sub

	Private Sub frmBaseWithSIP_Closing(ByVal sender As Object, ByVal e As CancelEventArgs) Handles MyBase.Closing
	  ' must do this to make sure the inputpanel releases 
	  ' its reference to this form
	  RemoveHandler inputPanel1.EnabledChanged, AddressOf inputPanel1_EnabledChanged
	End Sub

  End Class
End Namespace

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?