改变 propertygrid 控件的编辑风格(2)——编辑多行文本
来源:互联网 发布:兄弟连php学费 编辑:程序博客网 时间:2024/06/06 01:18
适用场合:
1、 编辑多行文本;
2、 编辑长文本。
步骤一:定义从uitypeeditor 派生的类,示例如下:
using system;
using system.windows.forms;
using system.drawing.design;
using system.windows.forms.design;
namespace blog.csdn.net.zhangyuk
{
/// <summary>
/// propertygridmutitext 的摘要说明。
/// </summary>
public class propertygridrichtext : uitypeeditor
{
public override uitypeeditoreditstyle geteditstyle(
system.componentmodel.itypedescriptorcontext context)
{
return uitypeeditoreditstyle.dropdown;
}
public override object editvalue(
system.componentmodel.itypedescriptorcontext context,
system.iserviceprovider provider,
object value)
{
try
{
iwindowsformseditorservice edsvc = (iwindowsformseditorservice)
provider.getservice(typeof(iwindowsformseditorservice));
if( edsvc != null )
{
if( value is string )
{
richtextbox box = new richtextbox();
box.text = value as string;
edsvc.dropdowncontrol( box );
return box.text;
}
}
}
catch( exception ex )
{
system.console.writeline( "propertygridrichtext error : " + ex.message );
return value;
}
return value;
}
}
}
步骤二:编辑属性类,指定编辑属性。示例如下:
namespace blog.csdn.net.zhangyuk
{
public class someproperties
{
private string _finished_time = "";
……
// 多行文本编辑框
string _mutilinesample = "";
[
description("多行文本编辑框"),
category("属性"),
editorattribute(typeof(propertygridrichtext),
typeof(system.drawing.design.uitypeeditor))
]
]public string 多行文本
{
get { return _mutilinesample; }
set { _mutilinesample = value;}
}
……
}
}
步骤三:设置propertygrid的属性对象。示例如下:
private void form1_load(object sender, system.eventargs e)
{
this.propertygrid1.selectedobject = new someproperties();
}
- 改变 PropertyGrid 控件的编辑风格(2)——编辑多行文本
- 改变 propertygrid 控件的编辑风格(2)——编辑多行文本
- 改变 PropertyGrid 控件的编辑风格(1)——加入日期控件
- 改变 PropertyGrid 控件的编辑风格(3)——打开对话框
- 改变 PropertyGrid 控件的编辑风格(4)——加入选择列表
- 改变 propertygrid 控件的编辑风格(3)——打开对话框
- 改变 propertygrid 控件的编辑风格(4)——加入选择列表
- 改变 PropertyGrid 控件的编辑风格(1)——加入日期控件-.NET教程,组件控件开发
- pb中获取多行文本编辑框(mle控件)指定行的内容
- 改变PropertyGrid中Property的编辑方式
- SAP多行文本编辑实例
- DevExpress PopupContainerEdit 可编辑 多行文本
- 多行文本编辑时,同一行编辑不同类型的字符时自动换行的问题
- vim复制多行文本(多行编辑)的方法
- easyui行文本编辑,日期编辑
- 编辑框控件的风格
- easyui datagrid edit 取消单行,多行文本框编辑
- ABAP 多行文本编辑框实现方式
- CVS安装使用说明
- 自由软件来生成纯粹的Win32可执行文件的编译环境
- 伪类:first-child的测试
- 改变 PropertyGrid 控件的编辑风格(1)——加入日期控件-.NET教程,组件控件开发
- 形如p+p的有趣现象
- 改变 propertygrid 控件的编辑风格(2)——编辑多行文本
- 改变 propertygrid 控件的编辑风格(3)——打开对话框
- 合并图片,用CSS切割以减少图片请求次数
- 改变 propertygrid 控件的编辑风格(4)——加入选择列表
- CSS切割背景应用补遗
- 一种不错的网页下拉菜单
- 简单写了个时下比较流行的tabStrip
- 打开chm 打不开chm 解决 方案 方法
- 截断单行的溢出文本