~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Analysis/Profiler/Frontend/Controls/PercentBar.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections.Generic;
 
6
using System.Collections.ObjectModel;
 
7
using System.Diagnostics;
 
8
using System.Windows;
 
9
using System.Windows.Controls;
 
10
using System.Windows.Documents;
 
11
using System.Windows.Media;
 
12
 
 
13
namespace ICSharpCode.Profiler.Controls
 
14
{
 
15
        public class PercentBar : FrameworkElement
 
16
        {
 
17
                protected override void OnRender(DrawingContext drawingContext)
 
18
                {
 
19
                        base.OnRender(drawingContext);
 
20
                        
 
21
                        if (this.RenderSize.Height > 0 && this.RenderSize.Width > 0) {
 
22
                                drawingContext.DrawRectangle(new LinearGradientBrush(Colors.Red, Colors.Orange, 0), new Pen(Brushes.Black, 1), new Rect(new Point(0, 2), new Size(this.RenderSize.Width * this.Value, this.RenderSize.Height - 4)));
 
23
                        }
 
24
                }
 
25
                
 
26
                public static readonly DependencyProperty ValueProperty =
 
27
                        DependencyProperty.Register("Value", typeof(double), typeof(PercentBar),
 
28
                                                    new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure));
 
29
 
 
30
                
 
31
                public double Value
 
32
                {
 
33
                        get { return (double)GetValue(ValueProperty); }
 
34
                        set { SetValue(ValueProperty, value); }
 
35
                }
 
36
        }
 
37
}