关键代码:

        /// <summary>
        /// 设置ChartControl滚动条【默认X,Y轴都出现】
        /// </summary>
        /// <param name="chart">ChartControl</param>
        /// <param name="backColor">滚动条背景颜色</param>
        /// <param name="barColor">滚动条颜色</param>
        /// <param name="borderColor">滚动条边框颜色</param>
        /// <param name="barThickness">滚动条宽度</param>
        public static ScrollBarOptions SetScrollBar(this ChartControl chart, Color backColor, Color barColor, Color borderColor, int barThickness)
        {
            XYDiagram _diagram = (XYDiagram)chart.Diagram;
            if (_diagram != null)
            {
                _diagram.EnableAxisXScrolling = true;
                _diagram.EnableAxisYScrolling = true;
                _diagram.EnableAxisXZooming = true;
                _diagram.EnableAxisYZooming = true;
                ScrollBarOptions _scrollBarOptions = _diagram.DefaultPane.ScrollBarOptions;
                _scrollBarOptions.BackColor = backColor;
                _scrollBarOptions.BarColor = barColor;
                _scrollBarOptions.BorderColor = borderColor;
                _scrollBarOptions.BarThickness = barThickness;
                return _scrollBarOptions;
            }
            return null;
        }
        /// <summary>
        /// 设置ChartControl X轴滚动条
        /// </summary>
        /// <param name="chart">ChartControl</param>
        /// <param name="backColor">滚动条背景颜色</param>
        /// <param name="barColor">滚动条颜色</param>
        /// <param name="borderColor">滚动条边框颜色</param>
        /// <param name="barThickness">滚动条宽度</param>
        /// <param name="barAlignment">滚动条位置</param>
        public static void SetAxisXScrollBar(this ChartControl chart, Color backColor, Color barColor, Color borderColor, int barThickness, ScrollBarAlignment barAlignment)
        {
            ScrollBarOptions _scrollBarOptions = SetScrollBar(chart, backColor, barColor, borderColor, barThickness);
            if (_scrollBarOptions != null)
            {
                _scrollBarOptions.XAxisScrollBarAlignment = barAlignment;
                _scrollBarOptions.XAxisScrollBarVisible = true;
                _scrollBarOptions.YAxisScrollBarVisible = false;
            }
        }
        /// <summary>
        /// 设置ChartControl Y轴滚动条
        /// </summary>
        /// <param name="chart">ChartControl</param>
        /// <param name="backColor">滚动条背景颜色</param>
        /// <param name="barColor">滚动条颜色</param>
        /// <param name="borderColor">滚动条边框颜色</param>
        /// <param name="barThickness">滚动条宽度</param>
        /// <param name="barAlignment">滚动条位置</param>
        public static void SetAxisYScrollBar(this ChartControl chart, Color backColor, Color barColor, Color borderColor, int barThickness, ScrollBarAlignment barAlignment)
        {
            ScrollBarOptions _scrollBarOptions = SetScrollBar(chart, backColor, barColor, borderColor, barThickness);
            if (_scrollBarOptions != null)
            {
                _scrollBarOptions.XAxisScrollBarVisible = false;
                _scrollBarOptions.YAxisScrollBarVisible = true;
                _scrollBarOptions.YAxisScrollBarAlignment = barAlignment;
            }
        }

运行效果:

希望有所帮助,谢谢!

[DevExpress]ChartControl之滚动条示例的更多相关文章

  1. [DevExpress]ChartControl之柱状图示例

    关键代码: using System; using System.Data; using System.Windows.Forms; using CSharpUtilHelpV2; using Dev ...

  2. [DevExpress]ChartControl之SeriesTemplate示例

    关键代码: using System; using System.Data; using System.Windows.Forms; using CSharpUtilHelpV2; using Dev ...

  3. [DevExpress]ChartControl之基准线示例

    关键代码: /// <summary> /// 创建基准线ConstantLine /// </summary> /// <param name="chart& ...

  4. DevExpress ChartControl大数据加载时有哪些性能优化方法

    DevExpress ChartControl加载大数据量数据时的性能优化方法有哪些? 关于图表优化,可从以下几个方面解决: 1.关闭不需要的可视化的元素(如LineMarkers, Labels等) ...

  5. [DevExpress]ChartControl之时间轴示例

    关键代码: using System; using System.Data; using System.Windows.Forms; using DevExpress.XtraCharts; name ...

  6. [DevExpress]ChartControl之创建X,Y轴Title示例

    关键代码: /// <summary> /// 设置X轴Title /// </summary> /// <param name="chart"> ...

  7. [DevExpress]ChartControl之饼状图百分比示例

    关键代码: using System; using System.Data; using System.Windows.Forms; using DevExpress.XtraCharts; name ...

  8. DevExpress .NET界面开发示例大全

    说到做.net界面开发,很多人应该都会想到DevExpress. 它的 .net界面开发系列一共有7个版本:WinForms.ASP.NET.MVC.WPF.Silverlight.Windows 8 ...

  9. 初识Devexpress ChartControl 之 动态添加stepline及TextAnnotation

    最近在用devexpress 第三方软件做项目. devexpress 的控件使用简单.功能强大.类型丰富.界面优美.扩展性强.今天主要是动态生成了一条StepLine.生成后的效果(能力不强,所以做 ...

随机推荐

  1. Linux下php安装phpredis

    说明:php安装目录:/usr/local/php5php.ini配置文件路径:/usr/local/php5/etc/php.iniNginx安装目录:/usr/local/nginxNginx网站 ...

  2. WinServer 之 Windows Server 2008 R2安装IIS

    1.在"服务器管理器"中选择"添加角色",如下图: 2.在"服务器角色"步骤选择"Web 服务器(IIS)",如下图: ...

  3. Android进阶笔记05:View、SurfaceView 和GLSurfaceView 的关系和区别

    1.  Android游戏当中主要的除了控制类外就是显示类View.SurfaceView是从View基类中派生出来的显示类.android游戏开发中常用的三种视图是:    (1) view.Sur ...

  4. Debian 7.4 中配置PHP环境

    准备工作 导入密钥 wget http://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg 添加源 vi /etc/apt/sources. ...

  5. Kali+Win7双系统

    ----------------------------------------------------------前言---------------------------------------- ...

  6. Halcon C++混合编程学习之Qt 实现检测焊接点

    1 # include "HalconCpp.h" # include "HDevThread.h" # include <X11/Xlib.h> ...

  7. javaweb学习总结十二(JAXP对XML文档进行SAX解析)

    一:JAXP使用SAX方式解析XML文件 1:dom解析与sax解析异同点 2:sax解析特点 二:代码案例 1:xml文件 <?xml version="1.0" enco ...

  8. 转:android 设计模式合集

    转: http://mobile.51cto.com/android-419145.htm

  9. C# WPF 连接数据库Sqlhelper类

    从视频上学习到的WPF连接数据库的方法 需要配置一个 configuration 文件,包含 SQL instance 的相关信息 using System; using System.Collect ...

  10. Java开发的一个简单截屏工具

    //源代码 import java.awt.*;import java.awt.datatransfer.DataFlavor;import java.awt.datatransfer.Transfe ...