可能重复:
我定义了具有一些属性的AppSettings类。在我的表单中,当我click Button1时,我想要显示属性1和2(1,2是显示,其他属性是隐藏还是不显示),当click Button2,我想要显示属性2和3(1是隐藏,2,3是显示,其他属性是隐藏还是没有显示),我怎么做呢?
public class AppSettings
{
[BrowsableAttribute(true), CategoryAttribute("Document Settings"), DefaultValueAttribute(true)]
public boo
我正在创建一个图形界面,并想给用户的选择,以编辑图形外观,即系列颜色,BackColor,数据点大小等…图表是使用以下命令创建的
System.Windows.Forms.DataVisualization.Charting
为了允许用户编辑这些选项,我在表单中放置了一个PropertyGrid。但是,有些属性我不想让用户访问。我希望能够在我的表单中设置一个图表,然后创建一个属性网格,该属性网格连接到该图表,但将某些属性从网格中删除。到目前为止我尝试的是..。
public partial class Form1: Form
{
PropertyGrid propG1 = new P
我将类PGMain作为属性网格中的SelectedObject
[DefaultPropertyAttribute("Basic")]
[Serializable]
public class PGMain
{
private TestClass m_TEST = new TestClass();
[CategoryAttribute("TEST")]
public TestClass TEST
{
get { return m_TEST; }
set { m_TEST =
我正在尝试使用System.Windows.Forms.PropertyGrid。
要使属性在此网格中不可见,应该使用BrowsableAttribute设置为false。但是,添加此属性会使属性不可绑定。
示例:创建一个新的Windows项目,并将TextBox和PropertyGrid放到Form1上。使用下面的代码,TextBox的宽度不会绑定到Data.Width
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Data data =
这肯定很简单,但即使在阅读了之后,我也无法理解。
如何将DataGridViewColumn类型存储在声明的变量中?它必须提供一个类型集合,类似于为DataGridViewContentAlignment声明变量:
Dim GridAlignment as DataGridViewContentAlignment ' declare
GridAlignment = DataGridViewContentAlignment.MiddleCenter ' set
所以应该是这样:
Dim GridColType1 as DataGridViewColumn
我有一个属性网格,让用户能够为我的应用程序中要使用的任何插件配置对象。我希望能够告诉编写插件的开发人员为其成员使用ComponentModel属性,如下所示:
[CategoryAttribute("On Screen Display Settings"),
DescriptionAttribute("Whether or not to show the session timer."),
DisplayName("Show Session Timer")]
public bool ShowTimer
{
get;
set
我有一个包含两个类别的PropertyGrid:“客户测试1”和“客户测试2”
如果我在BrowseableAttributes中只有一个类别,则会显示ONE CategoryAttribute。如果我在BrowseableAttributes中有两个/两个类别属性,则不会显示任何类别。
为什么呢?
public class Customer
{
[DisplayName("first name...:")]
[Category("Customer Test 1")]
public string First