zoukankan      html  css  js  c++  java
  • DevExpress07、DataNavigator、 ControlNavigator

    https://documentation.devexpress.com/WindowsForms/DevExpress.XtraEditors.DataNavigator.class

    1、DataNavigator

    使用方法

    绑定数据源:例如:

    List<int> datasource = new List<int>();
    datasource.AddRange(new int[] { 0, 1, 2, 3, 4 });
    myDataNavigator1.DataSource = datasource;

    DataNavigator刚拖到窗体上默认的样子:

    image

    设置DataNavigator控件常用属性:

    Dock=Bottom;
    TextLocation=End;
    TextStringFormat=第 {0}页 ,共 {1}页;

    运行效果如下:

    image

    绑定同步数据源

    使用System.Windows.Forms.BindingSource控件,绑定同步资源。

    sampleBindingSource.DataSource = ds;
    sampleBindingSource.DataMember = dh.DataMember;
    //DataBinding
    txtBox1.DataBindings.Add("EditValue", sampleBindingSource, "value1");
    gridControl1.DataSource = sampleBindingSource;
    dataNavigator1.DataSource = sampleBindingSource;

    显示按钮的ToolTip

    需把ShowToolTips设置为True,同时可设置Button的Hint为自己想要显示的内容。

    比如:

    在运行时会有下面效果:

    自定义按钮图片

    上图中的首页、前一页、后一页、尾页的图片是自定义的,那么怎么使用自定义图片呢?方法如下:

    1. 拖拽一个imageList控件,

    2. 然后在imageList中选择要使用的自定义图片

    3. 然后在Buttons选项卡下将ImageList属性 设置为刚才选择过图片的imageList1控件,

    4. 然后在DataNavigator控件 buttons下, 选择ImageIndex即可,

    比如下图的First


    按钮事件处理:

    private void dataNavigator1_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e)
    {
        //下一页
        if ((e.Button).ButtonType == DevExpress.XtraEditors.NavigatorButtonType.NextPage)
        {
        }
        //上一页
        if ((e.Button).ButtonType == DevExpress.XtraEditors.NavigatorButtonType.PrevPage)
        {
        }
        //首页
        if ((e.Button).ButtonType == DevExpress.XtraEditors.NavigatorButtonType.First)
        {
        }
        //尾页
        if ((e.Button).ButtonType == DevExpress.XtraEditors.NavigatorButtonType.Last)
        {
        }
    }
  • 相关阅读:
    Mybatis 使用Mybatis时实体类属性名和表中的字段名不一致
    getResourceAsStream 地址
    Memory Allocation with COBOL
    静态call 动态call LINK
    反编译
    eclipse 设置英文
    WAR/EAR 概念
    application.xml
    对ContentProvider中getType方法的一点理解
    总结使人进步,可视化界面GUI应用开发总结:Android、iOS、Web、Swing、Windows开发等
  • 原文地址:https://www.cnblogs.com/springsnow/p/10298612.html
Copyright © 2011-2022 走看看