C#程序开发范例宝典中,例子和说明,个人总结,给这些标签或图片加上点击事件,就可以运行了。
namespace WindowsXP
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.pictureBox7 = new System.Windows.Forms.PictureBox();
this.label4 = new System.Windows.Forms.Label();
this.pictureBox8 = new System.Windows.Forms.PictureBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.pictureBox9 = new System.Windows.Forms.PictureBox();
this.label7 = new System.Windows.Forms.Label();
this.pictureBox10 = new System.Windows.Forms.PictureBox();
this.pictureBox11 = new System.Windows.Forms.PictureBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox11)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.CausesValidation = false;
this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(49, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(91, 14);
this.label1.TabIndex = 4;
this.label1.Text = "产品基本信息";
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(49, 79);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(91, 14);
this.label2.TabIndex = 5;
this.label2.Text = "客户信息录入";
//
// label3
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.label3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(49, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(91, 14);
this.label3.TabIndex = 6;
this.label3.Text = "产品信息录入";
//
// pictureBox5
//
this.pictureBox5.Image = global::WindowsXP.Properties.Resources.XP小;
this.pictureBox5.Location = new System.Drawing.Point(171, 7);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(20, 20);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox5.TabIndex = 7;
this.pictureBox5.TabStop = false;
this.pictureBox5.Click += new System.EventHandler(this.pictureBox5_Click);
//
// pictureBox4
//
this.pictureBox4.Image = global::WindowsXP.Properties.Resources.Xp中1;
this.pictureBox4.Location = new System.Drawing.Point(-1, 31);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(189, 83);
this.pictureBox4.TabIndex = 3;
this.pictureBox4.TabStop = false;
//
// pictureBox3
//
this.pictureBox3.Image = global::WindowsXP.Properties.Resources.XP右;
this.pictureBox3.Location = new System.Drawing.Point(189, 1);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(323, 358);
this.pictureBox3.TabIndex = 2;
this.pictureBox3.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Image = global::WindowsXP.Properties.Resources.XP上;
this.pictureBox2.Location = new System.Drawing.Point(0, 1);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(188, 30);
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
//
// pictureBox1
//
this.pictureBox1.Image = global::WindowsXP.Properties.Resources.XP左背景;
this.pictureBox1.Location = new System.Drawing.Point(0, 1);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(188, 358);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// pictureBox6
//
this.pictureBox6.Image = global::WindowsXP.Properties.Resources.XP上;
this.pictureBox6.Location = new System.Drawing.Point(0, 120);
this.pictureBox6.Name = "pictureBox6";
this.pictureBox6.Size = new System.Drawing.Size(188, 30);
this.pictureBox6.TabIndex = 8;
this.pictureBox6.TabStop = false;
//
// pictureBox7
//
this.pictureBox7.Image = global::WindowsXP.Properties.Resources.XP小;
this.pictureBox7.Location = new System.Drawing.Point(171, 130);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(20, 20);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox7.TabIndex = 9;
this.pictureBox7.TabStop = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.BackColor = System.Drawing.Color.Transparent;
this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(49, 130);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(63, 14);
this.label4.TabIndex = 10;
this.label4.Text = "辅助信息";
//
// pictureBox8
//
this.pictureBox8.Image = global::WindowsXP.Properties.Resources.Xp中1;
this.pictureBox8.Location = new System.Drawing.Point(-1, 150);
this.pictureBox8.Name = "pictureBox8";
this.pictureBox8.Size = new System.Drawing.Size(189, 83);
this.pictureBox8.TabIndex = 11;
this.pictureBox8.TabStop = false;
//
// label5
//
this.label5.AutoSize = true;
this.label5.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.label5.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(49, 163);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(49, 14);
this.label5.TabIndex = 13;
this.label5.Text = "计算器";
//
// label6
//
this.label6.AutoSize = true;
this.label6.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.label6.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(49, 189);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(49, 14);
this.label6.TabIndex = 12;
this.label6.Text = "记事本";
//
// pictureBox9
//
this.pictureBox9.Image = global::WindowsXP.Properties.Resources.XP上;
this.pictureBox9.Location = new System.Drawing.Point(0, 239);
this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(188, 30);
this.pictureBox9.TabIndex = 14;
this.pictureBox9.TabStop = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.BackColor = System.Drawing.Color.Transparent;
this.label7.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(49, 250);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(77, 14);
this.label7.TabIndex = 15;
this.label7.Text = "操作员信息";
//
// pictureBox10
//
this.pictureBox10.Image = global::WindowsXP.Properties.Resources.XP小;
this.pictureBox10.Location = new System.Drawing.Point(168, 249);
this.pictureBox10.Name = "pictureBox10";
this.pictureBox10.Size = new System.Drawing.Size(20, 20);
this.pictureBox10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox10.TabIndex = 16;
this.pictureBox10.TabStop = false;
//
// pictureBox11
//
this.pictureBox11.Image = global::WindowsXP.Properties.Resources.Xp中1;
this.pictureBox11.Location = new System.Drawing.Point(-1, 269);
this.pictureBox11.Name = "pictureBox11";
this.pictureBox11.Size = new System.Drawing.Size(189, 83);
this.pictureBox11.TabIndex = 17;
this.pictureBox11.TabStop = false;
//
// label8
//
this.label8.AutoSize = true;
this.label8.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.label8.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(49, 292);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(63, 14);
this.label8.TabIndex = 19;
this.label8.Text = "修改密码";
//
// label9
//
this.label9.AutoSize = true;
this.label9.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.label9.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(49, 323);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(63, 14);
this.label9.TabIndex = 18;
this.label9.Text = "设置权限";
//
// label10
//
this.label10.AutoSize = true;
this.label10.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.label10.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.Location = new System.Drawing.Point(49, 213);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(56, 14);
this.label10.TabIndex = 20;
this.label10.Text = "Intenet";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(510, 357);
this.Controls.Add(this.label10);
this.Controls.Add(this.label8);
this.Controls.Add(this.label9);
this.Controls.Add(this.pictureBox11);
this.Controls.Add(this.pictureBox10);
this.Controls.Add(this.label7);
this.Controls.Add(this.pictureBox9);
this.Controls.Add(this.label5);
this.Controls.Add(this.label6);
this.Controls.Add(this.pictureBox8);
this.Controls.Add(this.label4);
this.Controls.Add(this.pictureBox7);
this.Controls.Add(this.pictureBox6);
this.Controls.Add(this.pictureBox5);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox4);
this.Controls.Add(this.pictureBox3);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pictureBox1);
this.Name = "Form1";
this.Text = "WindowsXP样式";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox11)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.PictureBox pictureBox7;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.PictureBox pictureBox8;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.PictureBox pictureBox9;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.PictureBox pictureBox10;
private System.Windows.Forms.PictureBox pictureBox11;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsXP
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void pictureBox5_Click(object sender, EventArgs e)
{
int i ;
i=80;
pictureBox5.Visible = false;
pictureBox4.Visible = false;
label2.Visible = false;
label3.Visible = false;
pictureBox6.Top -= i;
pictureBox8.Top -= i;
label4.Top -= i;
label5.Top -= i;
label6.Top -= i;
label10.Top -= i;
label7.Top -= i;
label8.Top -= i;
label9.Top -= i;
pictureBox9.Top -= i;
pictureBox11.Top -= i;
}
private void pictureBox2_Click(object sender, EventArgs e)
{
if (pictureBox5.Visible == false)
{
int i;
i = 80;
pictureBox5.Visible = true;
pictureBox4.Visible = true;
label2.Visible = true;
label3.Visible = true;
pictureBox6.Top += i;
pictureBox8.Top += i;
label4.Top += i;
label5.Top += i;
label6.Top += i;
label10.Top += i;
label7.Top += i;
label8.Top += i;
label9.Top += i;
pictureBox9.Top += i;
pictureBox11.Top += i;
}
}
private void Form1_Load(object sender, EventArgs e)
{
SetStyle(ControlStyles.SupportsTransparentBackColor,true);
}
}
}