DevExpress PopupContainerEdit 可编辑 多行文本
2014-10-16 10:05
267 查看
先上效果图:
1. 可编辑:设置Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
2. 多行显示,需要重写PopupContainerEdit控件:
1. 可编辑:设置Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
2. 多行显示,需要重写PopupContainerEdit控件:
public partial class YnPopupModuleEdit : PopupContainerEdit { static YnPopupModuleEdit() { RepositoryItemCustomContainerEdit.RegisterCustomEdit(); } public YnPopupModuleEdit() { InitializeComponent(); } protected override bool AcceptsReturn { get { return true; } } protected override bool AcceptsTab { get { return true; } } //Return the unique name public override string EditorTypeName { get { return RepositoryItemCustomContainerEdit.CustomEditName; } } //Override the Properties property //Simply type-cast the object to the custom repository item type [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public new RepositoryItemCustomContainerEdit Properties { get { return base.Properties as RepositoryItemCustomContainerEdit; } } protected override void UpdateMaskBox(bool always) { base.UpdateMaskBox(always); if (MaskBox == null) return; MaskBox.Multiline = true; MaskBox.WordWrap = true; MaskBox.ScrollBars = System.Windows.Forms.ScrollBars.None; } } //The attribute that points to the registration method [UserRepositoryItem("RegisterCustomEdit")] public class RepositoryItemCustomContainerEdit : RepositoryItemPopupContainerEdit { //The static constructor which calls the registration method //static RepositoryItemCustomComboBoxEdit() { RegisterCustomEdit(); } //Initialize new properties public RepositoryItemCustomContainerEdit() { } //The unique name for the custom editor public const string CustomEditName = "CustomComboBoxEdit"; //Return the unique name public override string EditorTypeName { get { return CustomEditName; } } //Register the editor public static void RegisterCustomEdit() { //Icon representing the editor within a container editor's Designer EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo( CustomEditName, typeof(YnPopupModuleEdit), typeof(RepositoryItemCustomContainerEdit), typeof(CustomContainerViewInfo), new ButtonEditPainter(), true, null, typeof(DevExpress.Accessibility.PopupEditAccessible) )); } //Override the Assign method public override void Assign(RepositoryItem item) { BeginUpdate(); try { base.Assign(item); } finally { EndUpdate(); } } protected override bool NeededKeysContains(Keys key) { if (key == Keys.Enter) return true; if (key == Keys.Tab) return true; if (key == Keys.Up) return true; if (key == Keys.Down) return true; return base.NeededKeysContains(key); } public override bool IsNeededKey(Keys keyData) { if (keyData == (Keys.Enter | Keys.Control)) return false; bool res = base.IsNeededKey(keyData); if (res) return true; if (keyData == Keys.PageUp || keyData == Keys.PageDown) return true; return false; } protected override bool UseMaskBox { get { return false; } } } public class CustomContainerViewInfo : PopupContainerEditViewInfo { public CustomContainerViewInfo(RepositoryItem item) : base(item) { } protected override void CalcContentRect(Rectangle bounds) { base.CalcContentRect(bounds); this.fMaskBoxRect = ContentRect; } }
相关文章推荐
- C# DevExpress PopupContainerEdit 下拉树列表的应用
- 在DevExpress程序中使用PopupContainerEdit和PopupContainer实现数据展示
- textarea中的多行文本(有换行)的内容提交到access数据库中 ,如何读取出来和编辑时一样
- 改变 propertygrid 控件的编辑风格(2)——编辑多行文本
- qnx neutrino 6.5.0 开机进入text edit mode(文本编辑模式)
- 使用PopupContainerEdit和PopupContainerControl制作下拉菜单树小记
- 当EditText是多行文本时, 光标如何设置在从左上角
- 当EditText是多行文本时, 光标如何设置在从左上角
- android EditText多行文本输入的若干问题
- EditText+ListPopupWindow实现可编辑的下拉列表
- vim复制多行文本(多行编辑)的方法
- 关于DevExpress.XtraTreeList.TreeList控件的使用——给TreeList添加RepositoryItem以实现文本编辑功能
- android EditText多行文本输入的若干问题
- 使用PopupContainerEdit和PopupContainerControl制作下拉菜单树小记(转)
- android EditText多行文本输入的若干问题
- 使用PopupContainerEdit和PopupContainerControl制作下拉菜单树小记
- EditText为多行文本时,如何让光标显示在左上角
- android EditText多行文本输入的若干问题
- 使用Swing组件编写一个支持中文文本编辑程序ChineseTextEdit.java
- MFC将edit编辑框内的多行字符串,根据“\n”换行符分割成多个单行字符串