实现winform 中的分割窗体效果

原创 2006年05月17日 23:26:00

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace 分割窗体
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.PictureBox pictureBox1;
  private System.Windows.Forms.Splitter splitter1;
  private System.Windows.Forms.PictureBox pictureBox2;
  private System.Windows.Forms.NotifyIcon notifyIcon1;
  private System.Windows.Forms.ContextMenu contextMenu1;
  private System.Windows.Forms.MenuItem menuItem1;
  private System.Windows.Forms.MenuItem menuItem2;
  private System.Windows.Forms.MenuItem menuItem3;
  private System.ComponentModel.IContainer components;

  public Form1()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.components = new System.ComponentModel.Container();
   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
   this.pictureBox1 = new System.Windows.Forms.PictureBox();
   this.splitter1 = new System.Windows.Forms.Splitter();
   this.pictureBox2 = new System.Windows.Forms.PictureBox();
   this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
   this.contextMenu1 = new System.Windows.Forms.ContextMenu();
   this.menuItem1 = new System.Windows.Forms.MenuItem();
   this.menuItem2 = new System.Windows.Forms.MenuItem();
   this.menuItem3 = new System.Windows.Forms.MenuItem();
   this.SuspendLayout();
   //
   // pictureBox1
   //
   this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Left;
   this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
   this.pictureBox1.Location = new System.Drawing.Point(0, 0);
   this.pictureBox1.Name = "pictureBox1";
   this.pictureBox1.Size = new System.Drawing.Size(100, 266);
   this.pictureBox1.TabIndex = 0;
   this.pictureBox1.TabStop = false;
   //
   // splitter1
   //
   this.splitter1.Location = new System.Drawing.Point(100, 0);
   this.splitter1.Name = "splitter1";
   this.splitter1.Size = new System.Drawing.Size(3, 266);
   this.splitter1.TabIndex = 1;
   this.splitter1.TabStop = false;
   //
   // pictureBox2
   //
   this.pictureBox2.Dock = System.Windows.Forms.DockStyle.Fill;
   this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
   this.pictureBox2.Location = new System.Drawing.Point(103, 0);
   this.pictureBox2.Name = "pictureBox2";
   this.pictureBox2.Size = new System.Drawing.Size(441, 266);
   this.pictureBox2.TabIndex = 2;
   this.pictureBox2.TabStop = false;
   //
   // notifyIcon1
   //
   this.notifyIcon1.ContextMenu = this.contextMenu1;
   this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
   this.notifyIcon1.Text = "notifyIcon1";
   this.notifyIcon1.Visible = true;
   //
   // contextMenu1
   //
   this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                       this.menuItem1,
                       this.menuItem2,
                       this.menuItem3});
   //
   // menuItem1
   //
   this.menuItem1.Index = 0;
   this.menuItem1.Text = "显示";
   this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
   //
   // menuItem2
   //
   this.menuItem2.Index = 1;
   this.menuItem2.Text = "隐藏";
   this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
   //
   // menuItem3
   //
   this.menuItem3.Index = 2;
   this.menuItem3.Text = "退出";
   this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(544, 266);
   this.Controls.Add(this.pictureBox2);
   this.Controls.Add(this.splitter1);
   this.Controls.Add(this.pictureBox1);
   this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
   this.MaximumSize = new System.Drawing.Size(552, 300);
   this.MinimumSize = new System.Drawing.Size(552, 300);
   this.Name = "Form1";
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text = "分割窗体and状态区";
   this.Load += new System.EventHandler(this.Form1_Load);
   this.ResumeLayout(false);

  }
  #endregion

  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main()
  {
   Application.Run(new Form1());
  }

  private void menuItem1_Click(object sender, System.EventArgs e)
  {
   this.Show();
  }

  private void menuItem2_Click(object sender, System.EventArgs e)
  {
   this.Hide();
  }

  private void menuItem3_Click(object sender, System.EventArgs e)
  {
   this.Close();
  }

  private void Form1_Load(object sender, System.EventArgs e)
  {
  
  }
 }
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

教你实现Winform窗体的四边阴影效果

本文转载于CSKIN论坛,地址:http://bbs.cskin.net/thread-61-1-1.html
  • Joyhen
  • Joyhen
  • 2014-11-01 01:41
  • 4057

Winform窗体效果

WinForm 窗体缩放动画效果

Winform 窗体缩放动画效果代码

Winform窗体半透明,控件不透明,及皮肤美化效果

先看效果图:        其实网上实现窗体半透明,控件不透明的方法很多,能用微软的API做出效果固然很好,然而其实现方法上有点点复杂,我个人没怎么去深究这个问题,因为我只想实现这个效果而已,选...

Winform窗体动画效果

  • 2015-01-06 16:57
  • 55KB
  • 下载

C#让WinForm窗体拥有动画效果(淡入淡出等…)

转载处 某些程序会有弹窗,在屏幕右下角缓缓出来,又缓缓关闭,这类效果自然使用原生态的API最合适不过了。 首先API声明: /// /// 窗体动画函数 /// /// 指定产生动画的窗...
  • chenep
  • chenep
  • 2011-12-16 21:16
  • 3765

C# winform窗体实现简单打印

如果不需要打印设置和打印预览,只是想点击按钮就能实现打印功能,只需要添加printDocument控件即可, 然后在form窗体上添加一个button控件并将其text属性改为“打印”,双击butto...

c# WinForm窗体实现动态时间展示

动态展示时间窗体组件Timer启动,单位1000毫秒Timer事件using System; using System.Collections.Generic; using System.Compon...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)