All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP也可以当成Shell,Script进行使用_php资料_编程技术
PHP编程中break及continue两个流程控制指令_php资料_编程技术
温故知新ASP.NET,2.0(C#)(2),-,Themes(主题)_[Asp.Net教程]
SQL,Server,数据库连接字符串的声明_[SQL,Server教程]
PHP利用cookie做的投票程序_[PHP教程]
GDI+ 绘制折线图分析网站流量
SQL,Server,2005,Express,Edition安装步骤详解_mssql学习_编程技术
使用Asp.Net2.0,编写类似GMail的文件上传系统_[Asp.Net教程]
病毒及流氓软件自我复制的简单实现
GridView中实现并列排名的例子_[Asp.Net教程]
Reading number is top 10 pictures
Sell the barbecue as says father du breul1
Hunan province aizhai super-large suspension bridge open to traffic and 4 world first1
运动的范冰冰1
Beautiful Japanese beauty(漂亮的日本美女)3
Sora aoi calligraphy show
奇趣的世界记录1
The money of more than 100 countries and regions6
这还能睡得着?
Green sweet joey wong young old photos exposure
A letter to parents choose world of warcraft seven big reason
Download software ranking
Boxer vs Yellow4
Boxer's Top ten classic battle4
jdk1.6 for windows
电脑知识及技巧大合集
都市狐狸姑娘传
传奇私服架设教程-chm
星际争霸1.08硬盘免安装版
JSP+Ajax Web development typical examples
实战黑客不求人
Tram sex maniac 2 (H) rar bag19
qq published in(发表于) 2014/7/11 9:17:40 Edit(编辑)
C#中Panel控件应用实例

C#中Panel控件应用实例

C#中Panel控件应用实例

Panel控件

1.功能

Panel控件用于为其他控件提供可识别的分组。开发Windows应用程序时,通常使用Panel控件按功能细分窗体。在窗体设计时,所有控件都可以自由移动,而当移动Panel控件时,它包含的所有控件也将随着移动。图1为Panel控件。



图1 Panel控件

2.属性

Panel控件常用属性及说明如表1所示。



表1 Panel控件常用属性及说明

下面详细介绍BackColor属性,此属性用来获取或设置控件的背景色。

语法:

public virtual Color BackColor { get; set; }

属性值:表示控件背景色的Color。默认为DefaultBackColor属性的值。

示例

BackColor属性的使用

本示例中,当程序运行时,单击【颜色】按钮,面板显示背景色。示例运行结果如图2所示。



图2 BackColor属性的使用

程序主要代码如下:

private void button1_Click(object sender, EventArgs e)

{

this.panel1.BackColor = Color.Gray;

}

完整程序代码如下:本教程来自http://www.isstudy.com/

★★★★★主程序文件完整程序代码网站源代码★★★★★

using System;

using System.Collections.Generic;

using System.Windows.Forms;

namespace _8_20

{

static class Program

{

///



/// 应用程序的主入口点。

///


[STAThread]

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new frmPanel());

}

}

}

★★★★★frmPanel窗体设计文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace _8_20

{

public partial class frmPanel : Form

{

public frmPanel()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

this.panel1.BackColor = Color.Gray;

}

private void button2_Click(object sender, EventArgs e)

{

}

private void button3_Click(object sender, EventArgs e)

{

}

private void frmPanel_Load(object sender, EventArgs e)

{

}

}

}

★★★★★frmPanel窗体代码文件完整程序代码网站源代码★★★★★

namespace _8_20

{

partial class frmPanel

{

///

/// 必需的设计器变量。

///


private System.ComponentModel.IContainer components = null;

///

/// 清理所有正在使用的资源。

///


/// 如果应释放托管资源,为 true;否则为 false。

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Windows 窗体设计器生成的代码

///

/// 设计器支持所需的方法 - 不要

/// 使用代码编辑器修改此方法的内容。

///


private void InitializeComponent()

{

this.panel1 = new System.Windows.Forms.Panel();

this.label1 = new System.Windows.Forms.Label();

this.checkBox1 = new System.Windows.Forms.CheckBox();

this.button4 = new System.Windows.Forms.Button();

this.button1 = new System.Windows.Forms.Button();

this.button2 = new System.Windows.Forms.Button();

this.button3 = new System.Windows.Forms.Button();

this.panel1.SuspendLayout();

this.SuspendLayout();

//

// panel1

//

this.panel1.Controls.Add(this.label1);

this.panel1.Controls.Add(this.checkBox1);

this.panel1.Controls.Add(this.button4);

this.panel1.Location = new System.Drawing.Point(12, 12);

this.panel1.Name = "panel1";

this.panel1.Size = new System.Drawing.Size(200, 100);

this.panel1.TabIndex = 0;

//

// label1

//

this.label1.AutoSize = true;


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.