This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
MainForm.vb
70 lines (60 loc) · 2.02 KB
/
MainForm.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.Utils.Drawing
Imports DevExpress.XtraGauges.Core.Model
Imports DevExpress.XtraGauges.Win
Imports DevExpress.XtraGauges.Base
Imports DevExpress.XtraGauges.Win.Base
Imports DevExpress.XtraEditors
Namespace DxSample
Partial Public Class MainForm
Inherits XtraForm
Public Sub New()
InitializeComponent()
End Sub
Private Sub OnFormLoad(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
timer1.Start()
SetUpAnimation()
End Sub
Private Sub SetUpAnimation()
arcScaleComponent1.EnableAnimation = True
arcScaleComponent1.EasingFunction = New BackEase()
arcScaleComponent1.EasingMode = DevExpress.XtraGauges.Core.Model.EasingMode.EaseInOut
arcScaleComponent2.EnableAnimation = True
arcScaleComponent2.EasingFunction = New CircleEase()
arcScaleComponent2.EasingMode = EasingMode.EaseIn
linearScaleComponent1.EnableAnimation = True
linearScaleComponent1.EasingFunction = New QuadraticEase()
linearScaleComponent1.EasingMode = EasingMode.EaseOut
End Sub
Private Sub OnTimerTick(ByVal sender As Object, ByVal e As EventArgs) Handles timer1.Tick
DoAnimation(gaugeControl1)
End Sub
Private Sub DoAnimation(ByVal gauge As GaugeControl)
For Each gb As IGauge In gauge.Gauges
Dim cGauge As ICircularGauge = TryCast(gb, ICircularGauge)
If cGauge IsNot Nothing Then
For Each scale As IScale In cGauge.Scales
scale.Value = AnimateScaleValue(scale)
Next scale
End If
Dim lGauge As ILinearGauge = TryCast(gb, ILinearGauge)
If lGauge IsNot Nothing Then
For Each scale As IScale In lGauge.Scales
scale.Value = AnimateScaleValue(scale)
Next scale
End If
Next gb
End Sub
Private Function AnimateScaleValue(ByVal scale As IScale) As Single
Dim r As New Random()
Return r.Next(0, 100)
End Function
End Class
End Namespace