http://www.cnblogs.com/Files/crystaller/Zhaozhao.Module.rar
以前写的模仿MSN一个窗体的代码
以前写的模仿MSN一个窗体的代码
解决方案 »
- 如何实现listbox的数据过滤
- 我的listview有2列,三行,
- 关于弹出Windows打开文件对话框
- 在.net中调用excel的Application.Save方法时为什么总是弹出保存文件对话框
- string类的Split方法到底是怎么用的?有疑惑,请高手解答
- 请cncxz,目标是五星等高手再进,关于重写textbox的另一问题.
- 請教使用UltraEdit的大大 UE如何运行C#程序
- 讨论有分,可再加!!各位大师看看我的数据实体设计思路?
- 如何用GPS结合visual2003(C#)获取本地的坐标?
- C#事务处理组件问题,事务处理组件安装出现问题~!各位老大多多帮忙~!~!~!
- 提供USB狗操作,数据加密类库,丰田美国公司的车行管理系统源码,回帖有分
- 对Excel操作问题
就可以实现上述功能了
我这有代码,需要的话我可以把代码发给你
E-mail:[email protected]
谢谢!
谢谢了,共同学习!
用TabControl就可以实现了
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
E-mail :[email protected]
E-mail:[email protected]
[email protected]
E-mail :[email protected]
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace qq
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button button1;
private Button[] btnMine=new Button[10];
//Array btnMine=Array.CreateInstance(typeof(Button),10);
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; 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.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Location = new System.Drawing.Point(4, 22);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(130, 244);
this.panel1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(142, 22);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(114, 26);
this.button1.TabIndex = 1;
this.button1.Text = "添加";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(206, 86);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(48, 21);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(206, 120);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(48, 21);
this.textBox2.TabIndex = 3;
this.textBox2.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(144, 92);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 16);
this.label1.TabIndex = 4;
this.label1.Text = "按钮数量:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(144, 124);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(62, 16);
this.label2.TabIndex = 5;
this.label2.Text = "选种按钮:";
//
// button2
//
this.button2.Location = new System.Drawing.Point(142, 50);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(114, 26);
this.button2.TabIndex = 6;
this.button2.Text = "移除";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(260, 273);
this.Controls.Add(this.button2);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
bool []bottom=new bool[10];//记录Button是否在下
int btnNumber=0;//Button数
int height=22;//按纽高度
int width=125;//按纽宽度
int x=2;//开始在窗体上排列按纽的初始横坐标
//添加
private void button1_Click(object sender, System.EventArgs e)
{
if(btnNumber>=10)
{
return;
} btnNumber=btnNumber+1;
int y=this.panel1.Height-height*btnNumber;//开始在窗体上排列按纽的初始纵坐标
this.panel1.Controls.Clear();
for(int i=0;i<btnNumber;i++)
{
this.btnMine[i]=new Button();
this.btnMine[i].Size=new System.Drawing.Size(width,height);
this.btnMine[i].Location=new System.Drawing.Point(x,y);
this.btnMine[i].Text=i.ToString();
this.btnMine[i].BackColor=System.Drawing.Color.Coral;
this.btnMine[i].Click+=new EventHandler(btnMineAll_Click);
this.panel1.Controls.Add(this.btnMine[i]);
y=y+height;
bottom[i]=true;
}
this.textBox1.Text=btnNumber.ToString();
}
//按钮单击事件
private void btnMineAll_Click(object sender, System.EventArgs e)
{
int index=((Button)sender).TabIndex;
this.textBox2.Text=this.btnMine[index].Text;
if(bottom[index]==true)
{
moveUp(index);
}
else
{
moveDown(index);
}
}
private void moveUp(int index)
{
int y=this.panel1.Top-height;//开始在窗体上排列按纽的初始纵坐标
for(int i=0;i<=index;i++)
{
this.btnMine[i].Location=new System.Drawing.Point(x,y);
y=y+height;
bottom[i]=false;
} }
private void moveDown(int index)
{
int y=this.panel1.Height-height;//开始在窗体上排列按纽的初始纵坐标
for(int i=btnNumber-1;i>index;i--)
{
this.btnMine[i].Location=new System.Drawing.Point(x,y);
y=y-height;
bottom[i]=true;
}
} private void button2_Click(object sender, System.EventArgs e)
{
// this.btnMine[1].r
}
// private void remove(int index)
// {
// for()
// }
}
}
[email protected]