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
|
private void disegnaDistanze(Rectangle viewPort, Dictionary<int, int> intervals, int offset, String text)
{
int i = 0;
SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(128, 0, 0, 0));
foreach (var v in intervals)
{
int x, y;
int width, height;
// in this case on the fly trasformation is way faster
x = (int)(this.viewPort.Left + 20 * i);
y = (int)(viewPort.Top + viewPort.Height + offset);
width = v.Value;
height = viewPort.Height / intervals.Count;
Rectangle rectangle = new Rectangle(x, y, width, height);
g2.DrawRectangle(Pens.Black, rectangle);
g2.FillRectangle(semiTransBrush, rectangle);
g2.FillRectangle(Brushes.Violet, rectangle);
g2.DrawString(v.Key.ToString(), new Font("Calibri", 10.0f,
FontStyle.Regular, GraphicsUnit.Pixel), semiTransBrush, new Point(x, y));
i++;
}
g2.DrawString(text, new Font("Calibri", 13.0f,
FontStyle.Italic, GraphicsUnit.Pixel), semiTransBrush, new Point(this.viewPort.Left - 140, (viewPort.Top + viewPort.Height + offset)));
}
|