Пример #1
0
        public Checkbox(int x, int y, int width, int height, bool isChecked)
            : base(x, y, width, height)
        {
            border = new Pen(Color.Gray, 1);
            backgroundUnchecked = new SolidColorBrush(Color.White);

            Checked = isChecked;
        }
Пример #2
0
        internal CalibrationWindow(int width, int height, GraphicsManager gm)
            : base(0, 0, width, height)
        {
            this.gm = gm;

            Background = new SolidColorBrush(Color.CornflowerBlue);
            CrosshairPen = new Pen(Color.Red, 1);
        }
Пример #3
0
        public RadioButton(int x, int y, int diameter, bool isChecked)
            : base(x, y, diameter, diameter)
        {
            border = new Pen(Color.Gray, 1);
            backgroundUnchecked = new SolidColorBrush(Color.White);

            IsChecked = isChecked;
        }
Пример #4
0
 public Slider(int x, int y, int width, int height, int thumbSize, Orientation orientation)
     : base(x, y, width, height)
 {
     Orientation = orientation;
     ThumbSize = thumbSize;
     ThumbBorder = new Pen(Color.Gray, 1);
     Value = 0;
 }
Пример #5
0
 public ProgressBar(int x, int y, int width, int height, Orientation orientation = Orientation.Horizontal)
     : base(x, y, width, height)
 {
     Orientation = orientation;
     Background = new SolidColorBrush(Color.DarkGray);
     Foreground = new SolidColorBrush(Color.White);
     Border = new Pen(Color.Gray, 1);
     Value = 0;
 }
Пример #6
0
        public Button(int x, int y, int width, int height, Font font, string text, Color foreColor)
            : base(x, y, width, height)
        {
            Font = font;
            Text = text;
            ForeColor = foreColor;

            backgroundPressed = new SolidColorBrush(ColorUtils.ColorFromRGB(128, 255, 0));
            backgroundPressed.Opacity = 170;// 70;

            backgroundUnpressed = new SolidColorBrush(ColorUtils.ColorFromRGB(0, 0, 0));
            backgroundUnpressed.Opacity = 10;

            border = new Pen(Color.DarkGray, 1);
        }
Пример #7
0
        public void Show()
        {
            if (Background == null)
                Background = new SolidColorBrush(Color.CornflowerBlue);
            if (CrosshairPen == null)
                CrosshairPen = new Pen(Color.Red, 1);

            idx = 0;
            CalibrationManager.PrepareCalibrationPoints();
            CalibrationManager.StartCalibration();

            gm.Desktop.Children.Add(this);

            block = new ManualResetEvent(false);
            block.WaitOne();
        }
Пример #8
0
 protected internal virtual void RenderRectangle(Bitmap bmp, Pen outline, int x, int y, int width, int height)
 {
     throw new NotSupportedException("RenderRectangle is not supported with this brush.");
 }
Пример #9
0
 protected internal virtual void RenderPolygon(Bitmap bmp, Pen outline, int[] pts)
 {
     throw new NotSupportedException("RenderPolygon is not supported with this brush.");
 }
Пример #10
0
 protected internal virtual void RenderEllipse(Bitmap bmp, Pen outline, int x, int y, int xRadius, int yRadius)
 {
     throw new NotSupportedException("RenderEllipse is not supported with this brush.");
 }
Пример #11
0
        protected override void OnRender(DrawingContext dc)
        {
            bool horizontal = orientation == Orientation.Horizontal;

            // background
            int trackRatio = 7;
            int a = horizontal ? Height / trackRatio : Width / trackRatio;
            if (horizontal)
                trackArea = new Rect(0, (Height - a) / 2, Width, a);
            else
                trackArea = new Rect((Width - a) / 2, 0, a, Height);

            Brush b = background ?? new SolidColorBrush(Color.DarkGray);
            Pen border = new Pen(Color.Gray, 0);
            dc.DrawRectangle(b, border, trackArea.X, trackArea.Y, trackArea.Width, trackArea.Height);

            // thumb
            int workarea = horizontal ? Width - thumbSize : Height - thumbSize;
            int x = horizontal ? workarea * value / 100 : 0;
            int y = horizontal ? 0 : Height - thumbSize - workarea * value / 100;
            if (horizontal)
                thumbArea = new Rect(x, y, thumbSize, Height);
            else
                thumbArea = new Rect(x, y, Width, thumbSize);

            Brush bb = foreground ?? new LinearGradientBrush(Color.LightGray, Color.Black);
            dc.DrawRectangle(bb, thumbBorder, thumbArea.X, thumbArea.Y, thumbArea.Width, thumbArea.Height);
        }