zoukankan      html  css  js  c++  java
  • DevExpress09、SimpleButton、CheckButton、DropDownButton、HScrollBar控件和VScrollBar控件

    SimpleButton控件

    使用SimpleButton控件, 创建一个Button按钮,

    可以通过其Image属性添加图片;

    该控件与WinForm自带的Button按钮类似;

    效果如下:

    CheckButton 控件

    以按钮的形式显示Check 与否的操作;

    效果如下:


    代码如下:

    private void checkButton1_CheckedChanged(object sender, EventArgs e)
    {
        checkButton1.Text = checkButton1.Checked ? "Checked" : "UnChecked";
    }

    Button Style属性, 当状态发生改变时,修改其样式;

    可以在DX Image Gallery中使用自带图片,

    当Check的状态发生改变时,在事件处理代码中:

    // 改变其内部自带的图片
    this.checkButton1.Image = global::WindowsDev.Properties.Resources.clear_32x32;

    DropDownButton控件

    该控件以按钮的形式弹出上下文菜单,

    • 该控件通过DropDownControl属性绑定PopuMenu控件或PopupControlContainer控件。
    • 可以通过该控件的DropDownArrowStyle属性控制下拉箭头的显示模式,

    1. 拖一个DropDownButton

    2. 拖一个PopMenu

    3. 设置DropDownButton的DropDownControl属性为PopMenu

    4. 对PopMenu右击,进行Customize(会要求自动创建一个BarManager)

    HScrollBar控件和VScrollBar控件

    许多控件需要滚动条,像ListBoxControl、CheckedListControl控件中已经集成了滚动条,所以 就不需要另加滚动条,

    但有些控件没有集成,比如:PictureEdit控件,

    当显示的图片过长时,不能在其已有的区域显示,

    就需要HScrollbar控件 和VScrollBar控件;


    显示效果:


    示例代码:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Linq;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using DevExpress.XtraEditors;
    
    namespace DXApplication_1
    {
        public partial class ScrollBarForm : DevExpress.XtraEditors.XtraForm
        {
            public ScrollBarForm()
            {
                InitializeComponent();
            }
    
            private void ScrollBarForm_Load(object sender, EventArgs e)
            {
                // hScrollBar
                hScrollBar1.Width = pictureBox1.Width;
                hScrollBar1.Left = pictureBox1.Left;
                hScrollBar1.Top = pictureBox1.Bottom;
                hScrollBar1.Maximum = pictureBox1.Image.Width - pictureBox1.Width;
    
                // vScrollBar
                vScrollBar1.Height = pictureBox1.Height;
                vScrollBar1.Left = pictureBox1.Left + pictureBox1.Width;
                vScrollBar1.Top = pictureBox1.Top;
                vScrollBar1.Maximum = pictureBox1.Image.Height - pictureBox1.Height;
            }
    
            int tmpX = 0;
            private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
            {
                tmpX = hScrollBar1.Value;
                pictureBox1.Refresh();
            }
    
            int tmpY = 0;
            private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
            {
                tmpY = vScrollBar1.Value;
                pictureBox1.Refresh();
            }
    
            private void pictureBox1_Paint(object sender, PaintEventArgs e)
            {
                // draw image
                e.Graphics.DrawImage(pictureBox1.Image, e.ClipRectangle, tmpX, tmpY, e.ClipRectangle.Width, e.ClipRectangle.Height, GraphicsUnit.Pixel);
            }
        }
    }
  • 相关阅读:
    mysql中的几种join 及 full join问题
    MySQL基础练习题
    SQL之IFNULL()
    SQL之查找表中字段的值相同的记录
    Mysql之将一张表内容导入另一张表中
    selenium无界面操作浏览器与Chrome Options的启动项设置
    SQL UNION 和 UNION ALL 操作符
    Python断言方法assert
    Python标准库--contextlib模块
    Python标准库--itertools模块
  • 原文地址:https://www.cnblogs.com/springsnow/p/10298873.html
Copyright © 2011-2022 走看看