blob: c3de8d115c20b4521cd3332c70b8ee6c21cd9beb (
plain)
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cairo;
using System.Xml.Serialization;
namespace go
{
public class GraduatedSlider : Slider
{
#region CTOR
public GraduatedSlider() : base()
{}
public GraduatedSlider(double minimum, double maximum, double step)
: base()
{
Minimum = minimum;
Maximum = maximum;
SmallIncrement = step;
LargeIncrement = step * 5;
}
#endregion
protected override void DrawGraduations(Context gr, PointD pStart, PointD pEnd)
{
Rectangle r = ClientRectangle;
gr.Color = Foreground;
gr.LineWidth = 2;
gr.MoveTo(pStart);
gr.LineTo(pEnd);
gr.Stroke();
gr.LineWidth = 1;
double sst = unity * SmallIncrement;
double bst = unity * LargeIncrement;
PointD vBar = new PointD(0, sst);
for (double x = Minimum; x <= Maximum - Minimum; x += SmallIncrement)
{
double lineLength = r.Height / 3;
if (x % LargeIncrement != 0)
lineLength /= 3;
PointD p = new PointD(pStart.X + x * unity, pStart.Y);
gr.MoveTo(p);
gr.LineTo(new PointD(p.X, p.Y + lineLength));
}
gr.Stroke();
}
}
}
|