GaugeControl 数字时钟,温度计,仪表盘
https://documentation.devexpress.com/#WindowsForms/CustomDocument18217
This topic will guide you through the main terms, concepts and mechanics used in WinForms Gauges.
You will learn about the common workflow for creating gauges from scratch, starting with picking the gauge type and concluding with detailed elements customization. conclude with以..结束
This lesson will use the gauges illustrated in the figure below as an example of the final result for the steps listed under the figure.
Note:
Depending on the complexity of your desired gauge, there are two options available to you:
the use of pre-defined gauge presets or the creation of a completely new gauge from the ground up.
This topic will guide you through the first approach.
For the second option, see the Creating a Gauge from Scratch topic.
Selecting The Gauge Type
The first step is to clarify which gauge type you need. There are three gauge types.
- Analog Gauges - traditional scale-based gauges. This group consists of two separate gauge types - circular and linear gauges.
- Digital Gauges - gauges imitating LED info panels.
- State Indicator Gauges - simple gauges that display images of specific shapes that change depending on the gauge state.
To learn more about gauge types, refer to the Gauge Types topic.
For this example, you will need circular gauges.
Selecting the Gauge Preset
DevExpress WinForms Gauges possess持有 a powerful and easy-to use tool that instantly creates a gauge of the desired type - the Preset Manager.
Whenever you need to create a new gauge - check the available presets first, since the gauge you are looking for may already have been created by DevExpress.
By default, this manager is automatically shown each time you drop a new GaugeControl onto the form.
Most similar to our desired gauge presets are Ignis or Haze.
Pick the Ignis preset and click load.
The Preset Manager will warn you that this action will completely destroy your current gauges layout and create a new one.
Bear in mind记住 that if you have multiple gauges within a single GaugeControl, using the Preset Manager will replace all of them at once with the selected preset.
In this case, use the Gauge Styles and Style Manager instead - it affects only one gauge at a time rather than the entire GaugeControl, and changes the appearance of gauge elements without affecting your gauge layout.
Customizing Gauge Elements
The selected Ignis preset differs from what we need in this example: it has only one circle instead of two, no text labels, images, etc.
This can be easily fixed since gauges are not solid objects.
Instead, each gauge is a set of elements, each with its own appearances and settings.
To see the list of available elements, see the Visual Elements topic.
- The light-gray circle in the Ignis preset is its scale that ranges gauge values from minimal to maximal.
It is represented by an object of the ArcScaleComponent class.
The orange bar on the scale is the range bar that indicates the current value.
To modify any gauge element, select it at design time, and either use the Visual Studio's properties window, or invoke the element's smart-tag and call the Gauge Designer as shown below.
- The default Ignis scale is a rounded line, but for this example we need a complete circle.
You can fix it by setting its ArcScale.EndAngle property to 90.
Refer to the Coordinate System article for more details.
Also, set the ArcScaleRangeBar.RoundedCaps property to false to make range bar's edges flat.
https://documentation.devexpress.com/#WindowsForms/CustomDocument18220
关于角度的说明:
起始90度,结束306度:从90度开始按照递增来显示
起始90度,结束-54度:从90度开始按照递减来显示
Adding and Removing Gauge Elements
For the purpose of this example, you will need two scales with two range bars linked to them.
You already have the first, outer scale.
To add new gauge elements, do one of the following.
方法1:
Select the gauge and click the required menu item within its smart-tag (see the following figure).
For instance, in this example you could click the 'Add Scale' and 'Add RangeBar' items.
This method is fast but has a minor drawback缺点: all newly created elements appear with their default settings.
Here, in this example, you would probably want to add a scale and range bar that look exactly like the previously customized items.
To do so, use the second approach below.
方法2:
Invoke the Gauge Designer and clone the required elements.
This will duplicate your existing scale and range bar, so you will only need to modify their sizes and start angles.
After a slight modification (see the code below), you will get the layout illustrated on the following figure.
//Default Range Bar
arcScaleRangeBarComponent1.StartOffset = 87F;
arcScaleRangeBarComponent1.EndOffset = 0F;
//Cloned scale
//半径用来调整环的大小
arcScaleComponent2.RadiusX = 80F;
arcScaleComponent2.RadiusY = 80F;
//角度用来调整环的范围
arcScaleComponent2.StartAngle = 90F;
arcScaleComponent2.EndAngle = 306F;
//Cloned Range Bar
arcScaleRangeBarComponent2.ArcScale = arcScaleComponent2;
arcScaleRangeBarComponent2.StartOffset = 68F;
arcScaleRangeBarComponent2.EndOffset = 0F;
StartOffset: Gets or sets the offset of the range bar's nearest arc from the scale center (in case of an arc scale) or the offset of the range bar's left edge from the scale axis (in case of a linear scale).
EndOffset: Gets or sets the offset of the range bar's most distant arc from the scale arc (in case of an arc scale) or the offset of the range bar's right edge from the scale axis (in case of a linear scale).
假如圆的半径是100,那么StartOffset=80,EndOffset=10。最后形成的圆环,就是80-90之间的
StartOffset=90,EndOffset=9 ;那么圆环是在90到91之间
StartOffset=90,EndOffset=1;那么圆环在90-99之间
StartOffset=90,EndOffset=0;那么圆环在90-100之间
下图绿色区域的内环和外环对应
Values. Gauge Data
Images, Labels, State Indicators
Customizing Gauge Appearance
Applying Gauge Animation
BaseRangeBar.AnchorValue
Gets or sets the start value of the range.
Reamarks
The range bar's start value is specified by the AnchorValue property.
By default, the end value is specified by the scale's current value (ArcScale.Value or LinearScale.Value). To specify a custom end value, call the LockValue method.
分段控制刻度的颜色
颜色渐变
https://www.devexpress.com/Support/Center/Question/Details/T170750
https://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.lineargradientbrush(v=vs.110).aspx
http://www.cnblogs.com/chucklu/p/6382025.html
三等分,起点和终点,按照水平或垂直来定,并且相差2。调试的时候,先确保目标区域被多段覆盖,然后逐渐调整起点和终点的坐标,最终确保只有一段覆盖
ArcScaleMarkerComponent
ArcScaleMarker.ShapeOffset
ArcScaleMarker.ShapeType 控制marker的形状
ArcScaleMarker.ShapeScale 控制marker的大小
使用效果:
设置刻度的颜色
this.arcScaleMarkerComponent1.Shader = new StyleShader() { StyleColor1 = Color.Yellow, StyleColor2 = Color.Yellow };
关于shader的说明,可以参看https://documentation.devexpress.com/WindowsForms/CustomDocument18236.aspx
如何让circularGauge最大程度地占据gaugeControl
拖动gaugeControl到控件之后,删除其他自带的控件。在右侧的属性栏找到Gauges属性,点开collection,然后add一个circularGauge
如何让arcScaleComponent1最大程度地占据circularGauge1
用一个现成的控件样式就可以实现,待测试
在界面上选中gauge,然后stylemanager
GaugeControl 数字时钟,温度计,仪表盘的更多相关文章
- 模拟时钟(AnalogClock)和数字时钟(DigitalClock)
Demo2\clock_demo\src\main\res\layout\activity_main.xml <LinearLayout xmlns:android="http://s ...
- C#开发漂亮的数字时钟
今天用C#做了一个漂亮的数字时钟.界面如下. 实现技术:主要是通过Graphics类的DrawImage方法来绘制数字时钟中所有的数字,这些数字是从网上找的一些图片文件.时钟使用DateTime中No ...
- Qt仿Android带特效的数字时钟源码分析(滑动,翻页,旋转效果)
这个数字时钟的源码可以在Qt Demo中找到,风格是仿Android的,不过该Demo中含有三种动画效果(鉴于本人未曾用过Android的系统,因此不知道Android的数字时钟是否也含有这三种效果) ...
- 数字时钟DigClock
首先建立数字显示类: using System; using System.Drawing; namespace CsDev { class SevenSegmentDispay { Graphics ...
- android脚步---数字时钟和模拟时钟
时钟UI组件是两个非常简单的组件,分为Digitalclock 和Analogclock, main.xml文件,书中程序有问题,加了两个组件,一个Button和一个<Chronometer ...
- 基于Verilog HDL 的数字时钟设计
基于Verilog HDL的数字时钟设计 一.实验内容: 利用FPGA实现数字时钟设计,附带秒表功能及时间设置功能.时间设置由开关S1和S2控制,分别是增和减.开关S3是模式选择:0是正常时钟 ...
- HandlerThread实现数字时钟
1.描述 刚看完Android多线程编程,对HandlerThread比较感兴趣,趁热巩固练习,实现一个了数字时钟,希望对学习HandlerThread有所帮助.如下: 启动一个HandlerThre ...
- js动态数字时钟
js动态数字时钟 主要用到知识点: 主要是通过数组的一些方法,如:Array.from() Array.reduce() Array.find() 时间的处理和渲染 js用到面向对象的写法 实现的功能 ...
- 简单酷炫的Canvas数字时钟
声明:本文为原创文章,如需转载,请注明来源WAxes,谢谢! 我记得很早之前就看过这个DEMO,是岑安大大博客里看到的: 就是这个数字时钟,当时觉得这个创意不错,但是也没去折腾.直到昨天同事又在网上看 ...
随机推荐
- cms修改栏目单页样式错位调整
if (dt.Rows[0]["ClassTemplet"].ToString().Trim() == "") { rows_key.Style.Value = ...
- IOS第11天(3:UIPickerView省市联动)
********* #import "ViewController.h" #import "Province.h" @interface ViewControl ...
- Algorithm | Tree traversal
There are three types of depth-first traversal: pre-order,in-order, and post-order. For a binary tre ...
- [办公自动化]一次制作、多场合多次使用的PPT
面试或汇报总结时,你可能需要制作一份PPT来介绍自己.但是这些场合你不一定能讲完所有的内容. 你可以尝试分1分钟.3分钟.5分钟.10分钟的版本来准备. 使用同一份PPT. 没错. 在office20 ...
- 为什么Visual Studio的安装目录下有名为1033或2052的文件夹?
一直不清楚MS诸多产品的安装目录下为什么总有个名为1033或者2052的目录 搜索一下才知道,原来叫 LCID(Locale ID,区域性标识符) 常见的如:1033表示英语(美国),2052表示中文 ...
- NULL-safe equal
http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#operator_equal-to ,=NULL,NULL=NULL; ...
- Gradle--ubuntu
在Ubuntu安装Gradle也是很简单.切记请勿使用apt-get安装Gradle.因为Ubuntu源的Gradle实在太旧.我用的搜狐的源,竟然是2011年. 下面是安装步骤: 1.在官网下载最新 ...
- LeetCode Best Time to Buy and Sell Stock with Cooldown
原题链接在这里:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/ 题目: Say you hav ...
- 白话学习MVC(五)Controller的激活
一.概述 在此系列开篇的时候介绍了MVC的生命周期 , 对于请求的处理,都是将相应的类的方法注册到HttpApplication事件中,通过事件的依次执行从而完成对请求的处理.对于MVC来说,请求是先 ...
- eclipse中配置tomcat
配置eclipse中的tomcat非常简单,之前以为windows下和mac中可能会不一样,但是经过配置发现是一样的: 下面就是在eclipse中简单的配置tomcat如下(mac和windows中都 ...