コード例 #1
0
        public Meter()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // This is additional buffering to stop flickering when
            // the control is redrawn

            this.SetStyle(System.Windows.Forms.ControlStyles.ResizeRedraw, true);
            this.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
            this.SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true);

            // initialization after the InitComponent call

            // colors
            numberColor    = Color.Chartreuse;
            borderColors   = new MeterBorder();
            faceColors     = new MeterFace();
            meterlineColor = Color.Chartreuse;
            //Brushes and Pens


            boldFont       = new Font("ArialBold", 12F, Font.Style | FontStyle.Bold);
            numeralBrush   = new SolidBrush(numberColor);
            outlineBrush   = new LinearGradientBrush(ClientRectangle, borderColors.BorderColor1, borderColors.BorderColor2, 45, true);
            zoneBrush      = new LinearGradientBrush(ClientRectangle, faceColors.FaceColor1, faceColors.FaceColor2, faceColors.ZoneAngle, true);
            outlinePen     = new Pen(outlineBrush, 32);
            meterlinePen   = new Pen(meterlineColor, 3);
            meterlineBrush = new SolidBrush(Color.Black);
            x          = 0;
            y          = 0;
            offset     = 0;
            this.angle = 0;


            // make sure control is redrawn when it's resized
            SetStyle(System.Windows.Forms.ControlStyles.ResizeRedraw, true);
            this.borderColors.PropertyChanged += new MeterBorder.PropertyChangedEventHandler(this.MeterBorderColors_PropertyChanged);
            this.faceColors.PropertyChanged   += new MeterFace.PropertyChangedEventHandler(this.MeterFaceColors_PropertyChanged);
        }
コード例 #2
0
ファイル: MeterControl.cs プロジェクト: imdmmp/kpgweigher
        public Meter()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // This is additional buffering to stop flickering when
            // the control is redrawn

            this.SetStyle(System.Windows.Forms.ControlStyles.ResizeRedraw, true);
            this.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
            this.SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true);

            // initialization after the InitComponent call

            // colors
            numberColor = Color.Chartreuse;
            borderColors = new MeterBorder();
            faceColors = new MeterFace();
            meterlineColor = Color.Chartreuse;
            //Brushes and Pens

            boldFont = new Font("ArialBold", 12F, Font.Style | FontStyle.Bold);
            numeralBrush = new SolidBrush(numberColor);
            outlineBrush = new LinearGradientBrush(ClientRectangle, borderColors.BorderColor1, borderColors.BorderColor2, 45, true);
            zoneBrush = new LinearGradientBrush(ClientRectangle, faceColors.FaceColor1, faceColors.FaceColor2, faceColors.ZoneAngle, true);
            outlinePen = new Pen(outlineBrush, 32);
            meterlinePen = new Pen(meterlineColor, 3);
            meterlineBrush = new SolidBrush(Color.Black);
            x=0;
            y=0;
            offset = 0;
            this.angle = 0;

            // make sure control is redrawn when it's resized
            SetStyle(System.Windows.Forms.ControlStyles.ResizeRedraw, true);
            this.borderColors.PropertyChanged +=new MeterBorder.PropertyChangedEventHandler(this.MeterBorderColors_PropertyChanged);
            this.faceColors.PropertyChanged +=new MeterFace.PropertyChangedEventHandler(this.MeterFaceColors_PropertyChanged);
        }