一、TextEdit控件

以文本框的形式绑定各种形式的选择框;

文本框设置 输入 密码 字符 时, 要有 * 号掩盖输入的字符,

代码如下:

textEdit1.Properties.PasswordChar = ’ * ’;

二、ButtonEdit 控件

以 button按钮的形式 绑定各种形式的选择框;

1、控件样式

截图

2、设置文本框右侧的按钮

在属性中Properties下的Buttons项,进入EditorButton集合编辑器,

ButtonEdit的文本框右侧的按钮可以有多个,在EditorButton集合编辑器中都可以进行设置。

在文本框右侧的按钮,全是DevExpress.XtraEditors.Controls.EditorButton类型的。

注意: Caption和Kind选项

3、按钮类型

在每个按钮的Kind属性中,可以设置按钮的类型。

按钮类型保存在枚举DevExpress.XtraEditors.Controls.ButtonPredefines中,该枚举包括如下枚举值(共计19个):

  1. Close,一个x型图案

  2. Delete,一个x型图案,线条比Close要细一些

  3. SpinRight,右三角形箭头

  4. SpinLeft,左三角形箭头

  5. SpinDown,下三角形箭头

  6. SpinUp,上三角形箭头

  7. Combo,同SpinDown

  8. Right,同SpinRight

  9. Left,同SpinLeft

  10. Up,同SpinUp

  11. Down,同SpinDown

  12. DropDown,同SpinDown

  13. Glyph,图案可由Image属性指定(当Kind被设置为Glyph时,可以通过设置Image属性来指定图案)

  14. Ellipsis,省略号,三个点,(默认图案)

  15. OK,一个√型图案

  16. Plus,一个+型图案

  17. Minus,一个-型图案

  18. Redo,撤销图案,一个顺时针转动最后指向右侧的箭头

  19. Undo,重做图案,一个逆时针转动最后指向右侧的箭头

4、按钮的点击事件

可以在属性管理器中事件里Properties下的ButtonClick事件中指定

这里面就存在一个问题,如果文本框中放置了多个按钮,该如何分辨出我点的是哪个按钮呢?

可以在事件中根据Caption、Kind等属性判断当前鼠标点击的是哪个Button,再执行相应的逻辑。

如下所示:

包括两个按钮(类型分别是Ellipsis和Delete),其中Ellipsis类型的按钮用于浏览文件,Delete类型的按钮用于清空选中数据。

判断按钮类型(Kind)执行相应逻辑的代码如下:

private void buttonEdit1_Properties_ButtonClick(
object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis)
{
OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.AutoUpgradeEnabled = true;
openFileDialog.CheckFileExists = true;
openFileDialog.CheckPathExists = true;
openFileDialog.ReadOnlyChecked = false;
openFileDialog.Multiselect = false;
openFileDialog.FileName = ""; openFileDialog.Filter = "所有文件|*.*";
openFileDialog.Title = "浏览"; if (openFileDialog.ShowDialog() == DialogResult.OK)
{
this.buttonEdit1.Text = openFileDialog.FileName;
}
}
else if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Delete)
{
this.buttonEdit1.Text = "";
}
}

三、PictureEdit控件

可在控件里添加图片

PictureEdit 可以直接绑定Image 或者 Byte Array

当我们在PictureEdit中放置一个较大图片的时候,SizeMode属性可以设置为Zoom等

四、RadioGroup控件

其Columns属性决定显示的列数, 默认值为: 0时,效果如下:

示例代码:

private void CommonControlsForm_Load(object sender, EventArgs e)
{
object[] ageArr = new object[] { 8, 12, 16 };
string[] descriptionArr = new string[] { "baby", "loli", "teenage" };
for(int i = 0; i < ageArr.Length; i++)
{
RadioGroupItem item = new RadioGroupItem(ageArr[i], descriptionArr[i]);
radioGroup1.Properties.Items.Add(item);
}
//
radioGroup1.EditValue = 12;
}

当Columns属性值为2时,效果如下:

相关代码

void Main()
{
//生成一个radioGroup,动态生成选项
RadioGroup radioGroupY = new RadioGroup();
foreach (TitleModel s in nodeYList)
{
//每一个单元按钮对应的选项item
RadioGroupItem item = new RadioGroupItem();
//设置选项的value值
item.Value = s.TitleKey;
//设置选项的描述值 即 要显示的值
item.Description = s.Title;
//使选项启用
item.Enabled = true;
//将新增的选项添加到radiogroup的Items中
radioGroupY.Properties.Items.Add(item);
}
//设置默认选中值
radioGroupY.EditValue = yList[i].TitleKey;//设置value //获取选中项的值:RadioGroup.Properties.Items[RadioGroup.SelectIndex].Value //获取选中项的显示值:
this.radioGroup1.Properties.Items[RadioGroup.SelectIndex].Description
this.radioGroup1.Properties.Items.GetItemByValue(Convert.ToInt32(radioGroup1.EditValue)).Description; } //时间
private void chkReviewResultTotal_SelectedIndexChanged(object sender, EventArgs e)
{ if (chkReviewResultTotal.SelectedIndex == )
{
//----
}
}

五、PopupControlContainer控件

1、 概述

      PopupControlContainer控件能够以面板的形式包含其他控件,或者以DropDownButton控件的下拉框的形式出现。

      PopupControlContainer控件通过DropDownButton控件的DropDownControl属性进行绑定,在绑定后, PopupControlContainer控件的AllowDrop属性要设成True;

2、 用法

  • 与 DropDownButton组合使用 ,指派container 到DropDownButton.DropDownControl 属性。
  • 与 bar button组合使用 , 指派container 到 BarButtonItem.DropDownControl 属性。
  • 与 Ribbon Form中的Application Button 组合使用 , 指派container 到 RibbonControl.ApplicationButtonDropDownControl属性。

下拉弹出控件PopupContainerEdit 经常与 PopupContainerControl  组合使用

效果如下:

主要功能是在界面中点击PopupContainerEdit右侧的下拉箭头,然后,会弹出下拉弹窗控件PopupContainerControl,

最后选择完数据后关闭弹窗。

popupContainerControl1.OwnerEdit.ClosePopup();

主要用到的控件有 PopupContainerEdit 和 PopupContainerControl

PopupContainerControl主要负责显示下拉弹窗中的内容

PopupContainerEdit类似一个文本框,右边有一个下拉箭头。

PopupContainerEdit和PopupContainerControl产生关联,主要通过以下代码实现

this.popupContainerEdit1.Properties.PopupControl = this.popupContainerControl1;

相关代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; namespace WindowsFormsApplication1
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
} private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
{
var name = e.Node["Name"].ToString(); if (popupContainerEdit1.IsPopupOpen)
{
// 设置名称
popupContainerEdit1.Text = name;
// 关闭弹窗
popupContainerEdit1.ClosePopup();
}
} private void Form4_Load(object sender, EventArgs e)
{
treeList1.ExpandAll();
popupContainerEdit1.Text = "全部";
}
}
}

XtraEditors四、TextEdit、ButtonEdit、PictureEdit、RadioGroup、PopupContainerEdit的更多相关文章

  1. Android高仿qq及微信底部菜单的几种实现方式

    最近项目没那么忙,想着开发app的话,有很多都是重复,既然是重复的,那就没有必要每次都去写,所以就想着写一个app通用的基本框架,这里说的框架不是什么MVC,MVP,MVVM这种,而是app开发的通用 ...

  2. android 基础学习笔记1

    1.控件 XML种控件必须带有Layoutwidth 和height 1.textview 常用属性 text,textcolor,textsize Android 种颜色用十六进制数表示,共四种形式 ...

  3. DevExpress.XtraEditors.TextEdit 设为密码输入框

    DevExpress.XtraEditors.TextEdit 设为密码输入框,解决办法: 设计窗口-->属性Properties-->Mask节点-->PasswordChar输入 ...

  4. [DevExpress] - 使得 XtraEditors.TextEdit 失去焦点(LostFocus)的方法

    场景 WinForm 应用,使用了 DevExpress.XtraEditors.TextEdit 控件的 KeyPress 和 Leave 事件.期望在 TextEdit 上按下回车键或者当 Tex ...

  5. DevExpress的TextEdit、RadioGroup、ColorPickEdit设置默认值

    场景 Winform中实现ZedGraph的多条Y轴(附源码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/1001322 ...

  6. Winform中实现更改DevExpress的RadioGroup的选项时更改其他控件(TextEdit、ColorPickEdit)的值

    场景 Winform中实现读取xml配置文件并动态配置ZedGraph的RadioGroup的选项: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article ...

  7. XtraEditors一、总体介绍

    一.所有编辑器的公共功能 全部都可以绑定数据: 全部都可以独立使用或用于由 Developer Express 提供的容器控件 (XtraGrid.XtraVerticalGrid.XtraTreeL ...

  8. 在DevExpress程序中使用PopupContainerEdit和PopupContainer实现数据展示

    在一些数据的即时查询场景中,我们可能需要对输入信息进行模糊查询并进行选择,例如在一些文本输入场景,如输入某个站点编码或者设备编码,然后获取符合的列表供用户选择的场景,本篇随笔介绍在DevExpress ...

  9. RadioGroup实现导航栏

    ​[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/ ...

随机推荐

  1. map映照容器(常用的使用方法总结)

    map映照容器的数据元素是由一个键值和一个映照数据组成的,键值和映照数据之间具有一一对应的关系.map与set集合容器一样,不允许插入的元素的键值重复. /*关于C++STL中map映照容器的学习,看 ...

  2. Postsharp 破解工具(通杀版,持续更新)

    2019.04.18 重要说明 VS2019 正式版已经发布了,Postsharp v6.2.2-Preview(预览版)也开始支持VS2019.不过截至目前,该预览版还不是特别稳定,因此提醒下大家在 ...

  3. [转]本地 Windows 计算机密码登录 登录 腾讯云 Linux 实例

    本文转自:https://cloud.tencent.com/document/product/213/5436? 登录工具 使用 远程登录软件 ,采用密码登录 Linux 实例(本例中选择使用 Pu ...

  4. MVC删除操作前confirm提示

    本段时间,忙于公司的ERP问题,博客也没有怎样更新了.昨晚于家中学习了MVC时,对删除记录前,让用户有后悔选择.即是说,能先给用户一个提示,然后再让用户决定是否删除记录.以前练习MVC,对删除记录,均 ...

  5. Android.mk 中常用“LOCAL_” 变量

    编写模块的编译文件,实际就是定义一系列以“LOCAL_”开头的编译变量,因此我们有必要弄明白这些变量的具体含义.下面是一些经常使用的LOCAL_编译变量的说明: 变量名 说明 LOCAL_ASSET_ ...

  6. C#常见几道面试题

    首先碰到的是这样的一首题目:计算数组{1,1,2,3,5,8.......} 第30位值,不用递归,我写出了以下这样的代码: static void Main(string[] args) { ]; ...

  7. maven的注意点

    一.dependency的scope 取值范围:compile.test.runtime.provided.system compile 默认就是compile,什么都不配置也就是意味着compile ...

  8. MySQL5.7 常用用户操作

    目录 MySQL5.7 常用用户操作 1. 新建用户 2. 授权 3. 创建用户时授权 4. 设置与更改用户密码(root) 5. 撤销用户权限 6. 删除用户 7. 查看用户的授权 8. 显示当前用 ...

  9. 并发修改异常(ConcurrentModificationException)

    并发修改异常(ConcurrentModificationException) 这个异常,使用集合的时候应该很常见,这个异常产生的原因是因为java中不允许直接修改集合的结构. 先贴上个有趣的例子,给 ...

  10. python-状态模式

    源码地址:https://github.com/weilanhanf/PythonDesignPatterns 说明: 在软件开发过程中,各种应用程序可能会根据不同的情况做出不同的处理.最直接的方案就 ...