private void Gauge2()
{
// Infragistics.WebUI.UltraWebGauge.UltraGauge ultraGauge2 =
//new Infragistics.WebUI.UltraWebGauge.UltraGauge();

RadialGauge myRadialGauge = new RadialGauge();
RadialGaugeScale myScale = new RadialGaugeScale();
NumericAxis numericAxis1 = new NumericAxis();
RadialGaugeNeedle myNeedle = new RadialGaugeNeedle();
SolidFillBrushElement mySolidFillBrushElement = new SolidFillBrushElement();
SolidFillBrushElement mySolidFillBrushElementMajor =
new SolidFillBrushElement();
SolidFillBrushElement mySolidFillBrushElementMinor =
new SolidFillBrushElement();
SolidFillBrushElement mySolidFillBrushElementMinorStroke =
new SolidFillBrushElement();
StrokeElement myStrokeElement = new StrokeElement();
SolidFillBrushElement mySolidFillBrushElement2 = new SolidFillBrushElement();
SimpleGradientBrushElement mySimpleGradientBrushElement =
new SimpleGradientBrushElement();
SolidFillBrushElement mySolidFillBrushElement1 = new SolidFillBrushElement();
mySolidFillBrushElement.Color = System.Drawing.Color.Black;
myRadialGauge.Dial.BrushElement = mySolidFillBrushElement;
myRadialGauge.Margin = new Margin(10, 10, 10, 10, Measure.Pixels);
//Set the following Axis properties and add the Axis to your scale:
numericAxis1.EndValue = 120; //仪盘表最大数值
myScale.Axes.Add(numericAxis1);
//Set the following Scale properties
myScale.EndAngle = 405;
myScale.StartAngle = 135;

mySolidFillBrushElement1.Color = System.Drawing.Color.White;
myScale.Labels.BrushElement = mySolidFillBrushElement1;

//Set the following Label properties
myScale.Labels.Extent = 65;
myScale.Labels.Font =
new System.Drawing.Font("Arial", 14F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
myScale.Labels.Frequency = 20;//大间隔显示数值:0 20 40 60
myScale.Labels.Orientation =
Infragistics.UltraGauge.Resources.RadialLabelOrientation.Horizontal;
myScale.Labels.SpanMaximum = 18;

//Set the following major Tickmark properties:
mySolidFillBrushElementMajor.Color =
System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))),
((int)(((byte)(189)))));
myScale.MajorTickmarks.BrushElement = mySolidFillBrushElementMajor;
myScale.MajorTickmarks.EndExtent = 95;
myScale.MajorTickmarks.EndWidth = 3;
myScale.MajorTickmarks.Frequency = 10; //大间隔显示频率
myScale.MajorTickmarks.StartExtent = 85;
myScale.MajorTickmarks.StartWidth = 3;

//Set the following minor Tickmark properties:
mySolidFillBrushElementMinor.Color =
System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))),
((int)(((byte)(240)))));
myScale.MinorTickmarks.BrushElement = mySolidFillBrushElementMinor;
myScale.MinorTickmarks.EndExtent = 90;
myScale.MinorTickmarks.EndWidth = 1;
myScale.MinorTickmarks.Frequency = 2;
//小间隔频率=myScale.MajorTickmarks.Frequency/myScale.MinorTickmarks.Frequency=10/2=5
myScale.MinorTickmarks.StartExtent = 85;
mySolidFillBrushElementMinorStroke.Color =
System.Drawing.Color.FromArgb(((int)(((byte)(135)))), ((int)(((byte)(135)))),
((int)(((byte)(135)))));
myStrokeElement.BrushElement = mySolidFillBrushElementMinorStroke;
myScale.MinorTickmarks.StrokeElement = myStrokeElement;

//Set the following Anchor properties:
myNeedle.Anchor.BrushElement = mySimpleGradientBrushElement;
mySimpleGradientBrushElement.EndColor = System.Drawing.Color.WhiteSmoke;
mySimpleGradientBrushElement.GradientStyle =
Infragistics.UltraGauge.Resources.Gradient.BackwardDiagonal;
mySimpleGradientBrushElement.StartColor = System.Drawing.Color.Gray;
myNeedle.Anchor.RadiusMeasure =
Infragistics.UltraGauge.Resources.Measure.Percent;

//设置指针属性
mySolidFillBrushElement2.Color = System.Drawing.Color.Red;
myNeedle.BrushElement = mySolidFillBrushElement2;
myNeedle.EndExtent = 65;
myNeedle.EndWidth = 1;
myNeedle.MidExtent = 0;
myNeedle.MidWidth = 3;
myNeedle.Precision = 1;
myNeedle.StartExtent = -20;
myNeedle.StartWidth = 3;
myNeedle.Value = int.Parse(TextBox2.Text.Trim());//指针显示值
myNeedle.WidthMeasure = Measure.Percent;
myScale.Markers.Add(myNeedle);

myRadialGauge.Scales.Add(myScale);
UltraGauge2.Gauges.Add(myRadialGauge);
//图形的大小
UltraGauge2.Height = Unit.Pixel(200);
UltraGauge2.Width = Unit.Pixel(200);

//显示文本框
BoxAnnotation boxAnnotation1 = new BoxAnnotation();
SolidFillBrushElement solidFillBrushElement1 = new SolidFillBrushElement();
SolidFillBrushElement solidFillBrushElement2 = new SolidFillBrushElement();
boxAnnotation1.Bounds = new System.Drawing.Rectangle(38, 70, 25, 10);
boxAnnotation1.BoundsMeasure = Infragistics.UltraGauge.Resources.Measure.Percent;
solidFillBrushElement2.Color = System.Drawing.Color.White;
boxAnnotation1.Label.BrushElement = solidFillBrushElement2;
boxAnnotation1.Label.FormatString = "Speed";
this.UltraGauge2.Annotations.Add(boxAnnotation1);

this.Controls.Add(UltraGauge2);

---------------------
作者:厦门德仔
来源:CSDN
原文:https://blog.csdn.net/david_520042/article/details/7394188
版权声明:本文为博主原创文章,转载请附上博文链接!

infra 仪表盘效果的更多相关文章

  1. iOS仿支付宝芝麻信用仪表盘效果

    概述 自定义View之高仿支付宝芝麻信用分数仪表盘动画效果 详细 代码下载:http://www.demodashi.com/demo/10654.html 仿支付宝芝麻信用仪表盘效果 一.主要思路 ...

  2. 基于canvas的仪表盘效果

    概述 基于Canvas实现的仪表盘及效果.通过配置参数,可以任意修改仪表盘颜色,刻度,动画过渡时间等,满足不同场景下的使用.同时使用原生的Canvas,也是学习Canvas的很好的例子. 详细 代码下 ...

  3. canvas/CSS实现仪表盘效果

    手机上看比较虚 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <t ...

  4. canvas/CSS仪表盘效果

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. Dynamics CRM 2011 仪表盘(dashbord)中加入公告(announcement)模块

    具体步骤如下: 1.将一下代码黏贴入一个取名叫"announcementsondashboard.htm"的html文件中,当然文件名你随便起无所谓. <span style ...

  6. WPF - 简单的UI框架 - 仪表盘

    源码链接:https://github.com/DuelWithSelf/WPFEffects 参考:https://www.cnblogs.com/duel/p/duel_clock.html 更新 ...

  7. Android 开源库和项目 2

    1.带尾巴的RecyclerViewPager 特点:1.像viewPager一样滑动一次就滑动一页 2.像画廊gallery一样,滑动一次可以滑动很多页 3.竖向滑动 4.支持点击事件,没有错乱   ...

  8. 秀才提笔忘了字:javascript使用requestAnimationFrame实现动画

    requestAnimationFrame优于setTimeout/setInterval的地方在于它是由浏览器专门为动画提供的API,在运行时浏览器会自动优化方法的调用,并且如果页面不是激活状态下的 ...

  9. 转--2014年最新810多套android源码2.46GB免费一次性打包下载

    转载自:http://www.eoeandroid.com/thread-497046-1-1.html 感谢该博客主人无私奉献~~ 下面的源码是从今年3月份开始不断整理源码区和其他网站上的安卓例子源 ...

随机推荐

  1. js 技巧(智能社教程温故)

    1.js 中  NaN === NaN  值为false; 2.parseInt("abc") === NaN;(不是数字) 3.tab 纯js 实现.可以给当前循环的元素添加.i ...

  2. Python之路----迭代器与生成器

    一.迭代器 L=[1,,2,3,4,5,] 取值:索引.循环for 循环for的取值:list列表 dic字典 str字符串 tuple元组 set f=open()句柄 range() enumer ...

  3. 重启eclips后启动项目出现监听文件找不到

    重启eclips后启动项目出现监听文件找不到 问题: 重启eclips后启动项目出现Error configuring application listener of class com.thinkg ...

  4. 编译安装 http

    1. 安装 apr http服务依赖 apr和apr-util ,安装 http 前需先安装这两个程序 apr 简介:http://www.cnblogs.com/Alight/p/3997777.h ...

  5. C_Learning (1)

    /数据类型及占用字节 char   1个字节{-128~127} int    2.4个字节,取决于平台是16位还是32位机子{-65536~65535} short int  2个字节{-32768 ...

  6. 20145105 《Java程序设计》第6周学习总结

    20145105 <Java程序设计>第6周学习总结 教材学习内容总结 第十章 输入/输出 一.InputStream与OutputStream (一)串流设计的概念 输入串流代表对象:j ...

  7. Wannafly14挑战赛 C(tarjan缩点)题解

    题目:牛客题目链接 思路:这道题有点像这道题 先缩点,缩完之后判断一下整个强连通分量入度是不是0,如果是的话向ans压入该强连通分量最小的那个值.最后排序一下ans输出就行了. 思路一下就想到了,就是 ...

  8. 卸载vs2017

    卸载enterprise版本 Microsoft.FSharp.SDK.Core卸载失败Package 'Microsoft.FSharp.SDK.Core,version=15.7.20180605 ...

  9. Sql 最简单的Sqlserver连接

    string name = txtUserName.Text.Trim();//移除用户名前部和后部的空格 string pwd = txtUserPwd.Text.Trim();//移除密码前部和后 ...

  10. Ubuntu 12.04 安装JDK

    为了在Ubuntu上安装好eclipse,按照步骤先进行JDK的安装. (1) 新建java文件夹 命令行操作: (2) 下载解压JDK安装包后无法移动文件夹至File System 移动时提示:Pe ...