?? viceform.cs
字號(hào):
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace DoubleWindows
{
/// <summary>
/// ViceForm 的摘要說(shuō)明。
/// </summary>
public class ViceForm : System.Windows.Forms.Form
{
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.Container components = null;
/// <summary>
/// 構(gòu)造函數(shù)。在構(gòu)造副窗口時(shí)應(yīng)傳入主窗口句柄以便于副窗口對(duì)主窗口進(jìn)行操作。
/// </summary>
/// <param name="mainForm">主窗口的句柄。</param>
public ViceForm(MainForm mainForm)
{
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
this.mainForm = mainForm;
Rectangle rect = Screen.GetWorkingArea(this);
this.Top = 0;
this.Left = rect.Width / 2;
this.Height = rect.Height;
this.Width = rect.Width / 2;
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
//
// ViceForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Name = "ViceForm";
this.Text = "窗口B";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ViceForm_KeyDown);
this.Resize += new System.EventHandler(this.ViceForm_Resize);
}
#endregion
/// <summary>
/// 主窗口的句柄。
/// </summary>
private MainForm mainForm;
private void ViceForm_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
//當(dāng)按下F1鍵時(shí),打開(kāi)或關(guān)閉副窗口,并設(shè)置兩個(gè)窗口的大小。
mainForm.DoubleWindowsForm_KeyDown(sender, e);
}
private void ViceForm_Resize(object sender, System.EventArgs e)
{
//窗口大小發(fā)生變化時(shí),調(diào)整窗口的大小。
if (this.Focused)
mainForm.Width = this.Left - mainForm.Left;
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -