• ButtonEdit 参数配置


    ButtonPredefines kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph; //图案可由Image属性指定

    DevExpress.XtraEditors.Controls.ButtonPredefines 的属性对应图案

    Close , 一个x型图案
    SpinRight , 方向指向右侧的三角形箭头
    SpinLeft , 方向指向左侧的三角形箭头
    SpinDown , 方向指向下侧的三角形箭头
    SpinUp , 方向指向上侧的三角形箭头
    Combo , 同SpinDown
    Right , 同SpinRight
    Left , 同SpinLeft
    Up , 同SpinUp
    Down , 同SpinDown
    Glyph , 图案可由Image属性指定
    Ellipsis , 省略号 , 三个点 , 默认图案
    Delete , 一个x型图案 , 线条比Close要细一些
    OK , 一个√型图案
    Plus , 一个+型图案
    Minus , 一个-型图案
    Redo , 撤销图案 , 一个顺时针转动最后指向右侧的箭头
    Undo , 重做图案 , 一个逆时针转动最后指向右侧的箭头
    DropDown , 同SpinDown

                /*-------------------------------------------------*/
                ButtonPredefines kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Close;//按钮类型,按钮图标是关闭图标
                string caption = "标题";
                int width = -1;/*按钮宽度*/
                bool enabled = true; /*启用权限,可以显示按钮,true可以点击按钮,false不能点击按钮;*/
                bool visible = true;/*访问权限,true显示按钮,false隐藏按钮*/
                bool isLeft = false;/*停靠,true靠左,false靠右;*/
    
                /*------------------------------------------------------------------------------------------
                 当如此配置时: ButtonPredefines kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph; 
                //按钮图片为自定义图片,从ImageCollection对象获取图片,下面配置才有效果
                 * -------------------------------------*/
                EditorButtonImageOptions imageOptions = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
                imageOptions.ImageIndex = 0;//图片索引
                imageOptions.ImageList = this.imageCollection1;/*ImageCollection1: 图片集合;*/
                /*--------------------------------------------------------------------------*/
    
                DevExpress.Utils.KeyShortcut shortcut = new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None);
                /*-----------------------------------*/
                DevExpress.Utils.SerializableAppearanceObject appearance = new DevExpress.Utils.SerializableAppearanceObject();//提供对按钮外观设置的访问。
                DevExpress.Utils.SerializableAppearanceObject appearanceHovered = new DevExpress.Utils.SerializableAppearanceObject();//提供对禁用当前按钮时应用的外观设置的访问。
                DevExpress.Utils.SerializableAppearanceObject appearancePressed = new DevExpress.Utils.SerializableAppearanceObject();
                DevExpress.Utils.SerializableAppearanceObject appearanceDisabled = new DevExpress.Utils.SerializableAppearanceObject();
                /*--------------------------------------------------------------------------*/
    
                string toolTip = "这是:toolTip";/*鼠标放置按钮上时显示文字*/
                object tag = "Del";/*Tag值*/
    
                #region =================SuperToolTip:鼠标放置按钮上时显示信息设置====================
                DevExpress.Utils.SuperToolTip superTip = new DevExpress.Utils.SuperToolTip();/*SuperToolTip:鼠标放置按钮上时显示信息设置*/
                /*--------------------------------*/
                DevExpress.Utils.ToolTipTitleItem toolTipTitleItem = new DevExpress.Utils.ToolTipTitleItem();/*Title 标题 */
                DevExpress.Utils.ToolTipItem toolTipItem = new DevExpress.Utils.ToolTipItem();/*Contents 提示内容   */
                DevExpress.Utils.ToolTipTitleItem toolTipTitleItem2 = new DevExpress.Utils.ToolTipTitleItem();
                DevExpress.Utils.ToolTipSeparatorItem toolTipSeparatorItem1 = new DevExpress.Utils.ToolTipSeparatorItem();/*-----分隔符-----*/
    
                DevExpress.Utils.ToolTipItem toolTipItemtst = new DevExpress.Utils.ToolTipItem();/*Contents 提示内容   */
                /*--------------------------------
                toolTipTitleItem.ImageOptions.ImageUri.Uri = "图标名称";
                toolTipTitleItem.ImageOptions.Image = 图片image; 
                toolTipTitleItem.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("resource.SvgImage")));
                --------------------------------*/
                //toolTipTitleItem.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("resource.SvgImage")));
                toolTipTitleItem.Text = "01212";
                //toolTipItem.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("resource.SvgImage1")));
                toolTipItem.LeftIndent = 6;
                toolTipItem.Text = "6666";
                /*-----------------------------*/
                toolTipTitleItem2.ImageOptions.ImageUri.Uri = "ExportToHTML";
                toolTipTitleItem2.LeftIndent = 6;
                /*-----------------------------*/
                superTip.Items.Add(toolTipTitleItem);
                superTip.Items.Add(toolTipSeparatorItem1);/*添加分隔符*/
                superTip.Items.Add(toolTipItem);
                superTip.Items.Add(toolTipTitleItem2);
    
                toolTipItemtst.Text = "vvvvvvvvvvvvvsssss";
                superTip.Items.Add(toolTipItemtst);
                #endregion =================SuperToolTip:鼠标放置按钮上时显示信息设置====================
                DevExpress.Utils.ToolTipAnchor toolTipAnchor = DevExpress.Utils.ToolTipAnchor.Cursor;
                
                DevExpress.XtraEditors.Controls.EditorButton ebtn =  new DevExpress.XtraEditors.Controls.EditorButton
                (
                    kind  /*ButtonPredefines kind,  图案可由Image属性指定*/,
                    caption, /*标题:string caption,   */
                    width, /*按钮宽度:int width,   */
                    enabled, /*bool enabled, 启用权限,可以显示按钮,true可以点击按钮,false不能点击按钮; */
                    visible/*bool visible, false隐藏按钮,true显示按钮*/,
                    isLeft/*bool isLeft, 按钮位置:false右侧,true左侧*/,
                    imageOptions/*EditorButtonImageOptions imageOptions, 按钮图片属性*/,
                    shortcut,/*KeyShortcut shortcut,   */
                    appearance, /*AppearanceObject appearance,   */
                    appearanceHovered, /*AppearanceObject appearanceHovered,   */
                    appearancePressed, /*AppearanceObject appearancePressed,  */
                    appearanceDisabled, /*AppearanceObject appearanceDisabled,   */
                    toolTip, /*鼠标移动到控件上方时显示文本:string toolTip,   */
                    tag, /*Tag对象:object tag,   */
                    superTip, /*SuperToolTip对象:鼠标放置按钮上时显示信息配置  */
                    toolTipAnchor/*ToolTipAnchor toolTipAnchor  */
                );
                this.buttonEdit1.Properties.Buttons.Add(ebtn);
                this.buttonEdit1.Properties.PasswordChar = '*';
                this.buttonEdit1.Size = new System.Drawing.Size(223, 32);
            /// <summary>
            /// buttonEdit 内 按钮点击事件
            /// </summary> 
            private void buttonEdit1_Properties_ButtonClick(object sender, ButtonPressedEventArgs e)
            {
                #region ====================密码文本,显示和隐藏 ====================
                if (e.Button.Tag.ToString() == "eye") //
                {
                    if (e.Button.ImageOptions.ImageIndex == 0)
                    {
                        e.Button.ImageOptions.ImageIndex = 1;
                        this.buttonEdit1.Properties.PasswordChar = '*';
                    }
                    else
                    {
                        e.Button.ImageOptions.ImageIndex = 0;
                        this.buttonEdit1.Properties.PasswordChar = '';
                    }
                }
                #endregion ====================密码文本,显示和隐藏 ====================
    
                #region ====================右侧按钮关闭按钮点击后清理文本内容 ====================
                //右侧按钮关闭按钮点击后清理文本内容
                if (e.Button.Tag.ToString() == "Del")
                {
                    buttonEdit1.Text = "";
                }
                #endregion ====================右侧按钮关闭按钮点击后清理文本内容 ====================
            }

    1

  • 相关阅读:
    40-cut 简明笔记
    50-ln 简明笔记
    35-less 简明笔记
    37-more 简明笔记
    9-cat 简明笔记
    64-who 简明笔记
    60-chmod 修改文件的权限
    useradd 添加用户
    14-find 查找文件
    层次越低的人,越容易放弃自己
  • 原文地址:https://www.cnblogs.com/lanyubaicl/p/13099681.html
Copyright © 2020-2023  润新知