frmbasewithsip.cs

来自「Microsoft Mobile Development Handbook的代码」· CS 代码 · 共 47 行

CS
47
字号
using System;
using System.Windows.Forms;
using System.ComponentModel;

namespace CodeForChapter2
{
  public partial class frmBaseWithSIP : Form
  {
    public frmBaseWithSIP()
    {
      InitializeComponent();
    }

    // Add a TextBox to the Form and add the two event handlers
    // Add an InputPanel control to the Form
    private void textBox1_GotFocus(object sender, EventArgs e)
    {
      inputPanel1.Enabled = true;
    }

    private void textBox1_LostFocus(object sender, EventArgs e)
    {
      inputPanel1.Enabled = false;
    }

    private void inputPanel1_EnabledChanged(object sender, EventArgs e)
    {
      if (inputPanel1.Enabled)
      {
        textBox2.Top -= inputPanel1.Bounds.Height;
      }
      else
      {
        textBox2.Top += inputPanel1.Bounds.Height;
      }
    }

    private void frmBaseWithSIP_Closing(object sender, CancelEventArgs e)
    {
      // must do this to make sure the inputpanel releases 
      // its reference to this form
      inputPanel1.EnabledChanged -=
          new EventHandler(this.inputPanel1_EnabledChanged);
    }

  }
}

⌨️ 快捷键说明

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