-
大小: 6KB文件类型: .7z金币: 1下载: 0 次发布日期: 2021-05-16
- 语言: C#
- 标签: PropertyGrid
资源简介
我们在编写程序时可以直接通过属性窗口对程序界面参数进行修改。十分方便,我们也可以通过 PropertyGrid 控件,来对我们的类或是控件进行快速修改。
代码片段和文件信息
//C#源码下载站:www.sourcecsharp.com
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PropertyGridApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e)
{
propertyGrid1.Selectedobject = new Go();
}
class Go
{
private float _TieMu = 5.5f;
private string _Rule = “数子法“;
[CategoryAttribute(“规则“) DescriptionAttribute(“贴目“)]
public float TieMu
{
get { return _TieMu; }
set { _TieMu = TieMu; }
}
[CategoryAttribute(“规则“) DescriptionAttribute(“计算法“)]
public string Rule
{
get { return _Rule; }
set { _Rule = Rule; }
}
private int _Black = 0;
private int _White = 0;
[CategoryAttribute(“围棋“) DescriptionAttribute(“黑“)]
public int Black
{
get { return _Black; }
set { _Black = Black; }
}
[CategoryAttribute(“围棋“) DescriptionAttribute(“白“)]
public int White
{
get { return _White; }
set { _White = White; }
}
private Color _BoardColor = Color.Yellow;
[CategoryAttribute(“围棋“) DescriptionAttribute(“棋盘颜色“)]
public Color BoardColor
{
get { return _BoardColor; }
set { _BoardColor = BoardColor; }
}
private Image _Background;
[CategoryAttribute(“围棋“) DescriptionAttribute(“棋盘背景“)]
public Image Background
{
get { return _Background; }
set { _Background = Background; }
}
}
}
}
- 上一篇:C#和PLC利用modbus通信
- 下一篇:otsu阈值分割c#语言
评论
共有 条评论