propertygrid选择日期的简单介绍

风水2023-02-1838

C#中自定义propertygrid控件的属性,要求当点击不同的其他控件时,能在propertygrid控件中显示基本的信息

双击控件后边代码: private void btnExample_Click(object sender, EventArgs e)

{

propertyGrid1.SelectedObject = btnExample;

}

其中btnExample是控件名。

有无针对VB.net的PropertyGrid控件详细用法?

查MSDN啊,什么语言都有,安装VB.net时就要一起安装帮助文档,以后找起来方便很多。暂时可以去网络版的msdn,那些例子的代码可以切换各种语言,还附有一个完整例子

;cs-lang=vb#code-snippet-1

propertyGrid自定义排序以及[...]按钮的实现等

我明白你的第一个问题,但是后两个不好意思没明白

第一个问题是这样

//

// 摘要:

// 使用该集合的默认排序(通常为字母顺序)对集合中的成员进行排序。

public virtual PropertyDescriptorCollection Sort();

//

// 摘要:

// 使用指定的 System.Collections.IComparer 对此集合中的成员排序。

public virtual PropertyDescriptorCollection Sort(IComparer comparer);

//

// 摘要:

// 对此集合中的成员排序。首先应用指定的顺序,然后应用此集合的默认排序,后者通常为字母顺序。

public virtual PropertyDescriptorCollection Sort(string[] names);

//

// 摘要:

// 对此集合中的成员排序。首先应用指定的顺序,然后使用指定的 System.Collections.IComparer 进行排序。

public virtual PropertyDescriptorCollection Sort(string[] names, IComparer comparer);

/// summary

/// 返回此类型说明符所表示的对象的已筛选属性描述符的集合。

/// /summary

/// param name="attributes"用作筛选器的属性数组。它可以是 null。/param

/// returns

/// 一个 see cref="T:System.ComponentModel.PropertyDescriptorCollection"/see,包含此类型说明符所表示的对象的属性说明。默认为 see cref="F:System.ComponentModel.PropertyDescriptorCollection.Empty"/see。

/// /returns

public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)

{

int i = 0;

//parameterList是外面传入的待显示数据。

PropertyDescriptor[] newProps = new PropertyDescriptor[parameterList.Count];

foreach (ConfigParameter parameter in parameterList)

{

//由ConfigParameter,你自己定义的类型,转成PropertyDescriptor类型:

newProps[i++] = new SystemOptionsPropertyDescriptor(parameter, true, attributes);

}

//取得了PropertyDescriptor[] newProps;现在可以对它排序,否则就按照newProps的原有顺序显示;

//1.直接返回

PropertyDescriptorCollection tmpPDC = new PropertyDescriptorCollection(newProps);

return tmpPDC;

//2.默认字母顺序

PropertyDescriptorCollection tmpPDC = new PropertyDescriptorCollection(newProps);

return tmpPDC.Sort();

//3.数组的顺序:sortName就是属性的顺序,内容就是各个属性名。

string[] sortName = new string[] { "a","b","c","d" };

return tmpPDC.Sort(sortName);

//4.comparer规则定义的排序方式

ParameterListComparer myComp = new ParameterListComparer();//ParameterListComparer : IComparer

return tmpPDC.Sort(myComp);

//5.先数组,后comparer

return tmpPDC.Sort(sortName,myComp);

//而我采用的是把数据传入之前就排序完毕的方法:即调用之前,把数据parameterList排好顺序,再 1.直接返回。

}

//对于数组排序方法,可以声明称一个事件,由外部传入属性的实现顺序:

public delegate string[] SortEventHandler();

public class CustomTypeDescriptorExtend : CustomTypeDescriptor

{

public SortEventHandler OnSort;

//......其它代码

public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)

{

string[] sortName = OnSort();

PropertyDescriptorCollection tmpPDC = TypeDescriptor.GetProperties(typeof(CustomTypeDescriptorExtend), attributes);

return tmpPDC.Sort(sortName);

}

}

//使用时:

public MyMethod()

{

CustomTypeDescriptorExtend s = new CustomTypeDescriptorExtend();

s.OnSort += new SortEventHandler(SetSortors);

PropertyGrid1.SelectedObject = s;

PropertyGrid1.PropertySort = PropertySort.Categorized;

}

public string[] SetSortors()

{

return new string[] { "B", "A", "C" };

}

当然这也不是我写的,给你个原始链接吧,呵呵

Extjs GridPanel构造器参数意思

如楼上所说,其实都是一些简写,当然你可以把cm写成ColumModel,

系统定义了一套简写模式,叫做:ExtJs中的xtype类型.

定义

xtype就是一个代表类(Class)的标识名字。

譬如,你有这个类,名字是Ext.ux.MyGrid。正常情况下你需要用这个名字来实例化这个类(创建类的对象)。

除了类名外,你还可以这样登记类的xtype:

Ext.reg(\'mygrid\', Ext.ux.MyGrid);

其中xtype 是 mygrid 而类名的一般形式是Ext.ux.MyGrid。上面的语句登记了新的xtype ,换种说法说,xtype mygrid 与类 Ext.ux.MyGrid是连在一起的。

到底有什么好处?

延时实例化

下面是一些资料,但是不全,你在网上再找找吧,我也初学

.基本组件:

xtype Class 描述

button Ext.Button 按钮

splitbutton Ext.SplitButton 带下拉菜单的按钮

cycle Ext.CycleButton 带下拉选项菜单的按钮

buttongroup Ext.ButtonGroup 编组按钮(Since 3.0)

slider Ext.Slider 滑动条

progress Ext.ProgressBar 进度条

statusbar Ext.StatusBar 状态条,2.2加进来,3.0 又去了

colorpalette Ext.ColorPalette 调色板

datepicker Ext.DatePicker 日期选择面板

容器及数据类组件

xtype Class 描述

window Ext.Window 窗口

viewport Ext.ViewPort 视口,即浏览器的视口,能随之伸缩

box Ext.BoxComponent 盒子组件,相当于一个 div

component Ext.Component 组件

container Ext.Container 容器

panel Ext.Panel 面板

tabpanel Ext.TabPanel 选项面板

treepanel Ext.tree.TreePanel 树型面板

flash Ext.FlashComponent 显示 Flash 的组件(Since 3.0)

grid Ext.grid.GridPanel 表格

editorgrid Ext.grid.EditorGridPanel 可编辑的表格

propertygrid Ext.grid.PropertyGrid 属性表格

editor Ext.Editor 编辑器

dataview Ext.DataView 数据显示视图

listview Ext.ListView 列表视图

工具栏组件:

xtype Class 描述

paging Ext.PagingToolbar 分页工具条

toolbar Ext.Toolbar 工具栏

tbbutton Ext.Toolbar.Button 工具栏按钮

tbfill Ext.Toolbar.Fill 工具栏填充区

tbitem Ext.Toolbar.Item 工具条项目

tbseparator Ext.Toolbar.Separator 工具栏分隔符

tbspacer Ext.Toolbar.Spacer 工具栏空白

tbsplit Ext.Toolbar.SplitButton 工具栏分隔按钮

tbtext Ext.Toolbar.TextItem 工具栏文本项

菜单组件:

xtype Class 描述

menu Ext.menu.Menu 菜单

colormenu Ext.menu.ColorMenu 颜色选择菜单

datemenu Ext.menu.DateMenu 日期选择菜单

menubaseitem BaseItem

menucheckitem Ext.menu.CheckItem 选项菜单项

menuitem Ext.menu.Item

menuseparator Ext.menu.Separator 菜单分隔线

menutextitem Ext.menu.TextItem 文本菜单项

表单及表单域组件:

xtype Class 描述

form Ext.FormPanel/Ext.form.FormPanel 表单面板

checkbox Ext.form.Checkbox 多选框

combo Ext.form.ComboBox 下拉框

datefield Ext.form.DateField 日期选择项

timefield Ext.form.TimeField 时间录入项

field Ext.form.Field 表单字段

fieldset Ext.form.FieldSet 表单字段组

hidden Ext.form.Hidden 表单隐藏域

htmleditor Ext.form.HtmlEditor HTML 编辑器

label Ext.form.Label 标签

numberfield Ext.form.NumberField 数字编辑器

radio Ext.form.Radio 单选按钮

textarea Ext.form.TextArea 多行文本框

textfield Ext.form.TextField 表单文本框

trigger Ext.form.TriggerField 触发录入项

checkboxgroup Ext.form.CheckboxGroup 编组的多选框(Since 2.2)

displayfield Ext.form.DisplayField 仅显示,不校验/不被提交的文本框

radiogroup Ext.form.RadioGroup 编组的单选按钮(Since 2.2)

图表组件:

xtype Class 描述

chart Ext.chart.Chart 图表组件

barchart Ext.chart.BarChart 柱状图

cartsianchart Ext.chart.CartesianChart

columnchart Ext.chart.ColumnChart

linechart Ext.chart.LineChart 连线图

piechart Ext.chart.PieChart 扇形图

数据集 Store:

xtype Class 描述

arraystore Ext.data.ArrayStore

directstore Ext.data.DirectStore

groupingstore Ext.data.GroupingStore

jsonstore Ext.data.JsonStore

simplestore Ext.data.SimpleStore

store Ext.data.Store

xmlstore Ext.data.XmlStore

EasyUI propertygrid问题

var tab = $(\'#tt\').tabs(\'getTab\',0); // 取得第一个tab

$(\'#tt\').tabs(\'update\', {

tab: tab,

options: {

title: \'New Title\'

}

});

extjs属性表格PropertyGrid使用

Ext.onReady(function(){

Ext.create("Ext.grid.property.Grid",{

title:"MyPropertyGrid",

width:400,

renderTo:Ext.getBody(),

source:{

"name":"Crossci",

"Created": Ext.Date.parse(\'2012-05-15\', \'Y-m-d\'),

"available":true,

"age":19,

"desc":"good stu"

}

});

});

你可以试试

好了,propertygrid选择日期的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于、propertygrid选择日期的信息别忘了在本站进行查找哦。

分享到: