Esempio n. 1
0
        public FileBrowserItem(string label, Font font)
        {
            this.font = font;
            Width = SystemMetrics.ScreenWidth;
            Height = 30;

            iconOffset = (Height - iconSize) / 2;
            selectedBrush = new SolidColorBrush(Colors.Blue);

            fileName = label;
            fileType = String.Empty;
            filePath = String.Empty;

            Text text = new Text(font, label);
            text.ForeColor = Color.White;
            text.Height = font.Height;
            text.Width = Width;
            text.VerticalAlignment = VerticalAlignment.Top;
            int top = (Height - font.Height) / 2;
            text.SetMargin(Height + iconOffset, top, 0, 0);

            Child = text;

            UpdateIcon();
        }
        /// <summary>
        /// Creates new NextBlockView element for given GameUniverse
        /// </summary>
        /// <param name="gameUniverse">GameUniverse to visualize</param>
        public NextBlockView(GameUniverse gameUniverse)
        {
            this._universe = gameUniverse;

            _blockPen = new Pen(Color.Black);
            _linePen = new Pen(Colors.White, 4);
            _fillBrush = new SolidColorBrush(ColorUtility.ColorFromRGB(164, 164, 164));
        }
Esempio n. 3
0
        public Led(int width, int height)
        {
            Width = width;
            Height = height;
            activeBrush = new SolidColorBrush(ColorUtility.ColorFromRGB(0, 240, 0));
            //activeBrush = new SolidColorBrush(ColorUtility.ColorFromRGB(90, 90, 255));
            inactiveBrush = new SolidColorBrush(Colors.DarkGray);
            border = new Pen(Colors.DarkGray, 1);

            Invalidate();
        }
Esempio n. 4
0
        public Slider(int width, int height)
        {
            Width = width;
            Height = height;
            trackBrush = new SolidColorBrush(Colors.DarkGray);
            thumbBrush = new SolidColorBrush(Colors.Orange);

            //this.TouchMove

            Invalidate();
        }
        public override void OnRender(Microsoft.SPOT.Presentation.Media.DrawingContext dc)
        {
            // Saving performance create fill brush only once
            if (gradientBrush == null)
                gradientBrush = new LinearGradientBrush(startColor, endColor, 0, this.Height / 2, 0, this.Height);

            // Gradient fill
            dc.DrawRectangle(gradientBrush, null , 0, 0, this.Width, this.Height);

            // Left line separator
            dc.DrawRectangle(solidBrush, null, 0, 0, 2, this.Height);
        }
        public void DrawPolygon(Brush brush, Pen pen, int[] pts)
        {
            VerifyAccess();

            brush.RenderPolygon(_bitmap, pen, pts);

            int nPts = pts.Length / 2;

            for (int i = 0; i < nPts - 1; i++)
            {
                DrawLine(pen, pts[i * 2], pts[i * 2 + 1], pts[i * 2 + 2], pts[i * 2 + 3]);
            }

            if (nPts > 2)
            {
                DrawLine(pen, pts[nPts * 2 - 2], pts[nPts * 2 - 1], pts[0], pts[1]);
            }
        }
Esempio n. 7
0
            /// <summary>
            /// Constructs a MyColorPalette with the specified settings.
            /// </summary>
            /// <param name="row"></param>
            /// <param name="column"></param>
            /// <param name="width"></param>
            /// <param name="height"></param>
            public MyColorPalette(int row, int column, int width, int height)
                : base(row, column, width, height)
            {
                color = new Color[16];

                // Create the colors we will display.
                color[0] = ColorUtility.ColorFromRGB(255, 0, 0);
                color[1] = ColorUtility.ColorFromRGB(128, 0, 0);
                color[2] = ColorUtility.ColorFromRGB(64, 0, 0);
                color[3] = ColorUtility.ColorFromRGB(0, 255, 0);
                color[4] = ColorUtility.ColorFromRGB(0, 128, 0);
                color[5] = ColorUtility.ColorFromRGB(0, 64, 0);
                color[6] = ColorUtility.ColorFromRGB(0, 0, 255);
                color[7] = ColorUtility.ColorFromRGB(0, 0, 128);
                color[8] = ColorUtility.ColorFromRGB(0, 0, 64);
                color[9] = ColorUtility.ColorFromRGB(255, 255, 0);
                color[10] = ColorUtility.ColorFromRGB(128, 128, 0);
                color[11] = ColorUtility.ColorFromRGB(0, 255, 255);
                color[12] = ColorUtility.ColorFromRGB(0, 128, 128);
                color[13] = ColorUtility.ColorFromRGB(255, 0, 255);
                color[14] = ColorUtility.ColorFromRGB(128, 0, 128);
                color[15] = ColorUtility.ColorFromRGB(0, 0, 0);

                int i = 0;
                brushes = new Brush[16];

                for (i = 0; i < 16; i++)
                {
                    brushes[i] = new SolidColorBrush(color[i]);
                }
            }
Esempio n. 8
0
            /// <summary>
            /// Renders the items in the list view.
            /// </summary>
            /// <param name="dc"></param>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <param name="headerHeight"></param>
            /// <param name="itemHeight"></param>
            protected virtual void RenderItems(DrawingContext dc, int x, int y,
                int headerHeight, int itemHeight)
            {

                // Create the brushes and pens for drawing the items.
                Brush[] brushes = new Brush[] { _emptyBrush, _lightCyanBrush, 
                    _grayBrush };
                Pen[] pens = new Pen[] { _emptyPen, _cyanPen };

                // Set the starting location for the first item.  Offset the 
                // location by _sx and _sy, which are the scroll positions.
                int cx = x + 6 - _sx;
                int cy = y + headerHeight + 2 - _sy;
                int j = 0;

                // Iterate through all the items.
                for (int ii = 0; ii < Items.Count; ii++)
                {
                    // Only draw the items that are visible.
                    if (cy >= _columnHeaderHeight)
                    {

                        // If the item is selected...
                        if (((ListViewItem)Items[ii]) == _selectedItem)
                        {
                            // Draw a rectangle alternately shaded and 
                            // transparent.
                            dc.DrawRectangle(brushes[2], pens[j & 1], x + 2, cy,
                            _width - 4, _itemHeight);
                        }
                        else
                        {
                            // Draw a rectangle alternately shaded and 
                            // transparent.
                            dc.DrawRectangle(brushes[j & 1], pens[j & 1], x + 2,
                                cy, _width - 4, _itemHeight);
                        }

                        // Set the starting location for the first column.
                        // Offset the location by _sx, which is the scroll 
                        // position.
                        cx = 4 - _sx;
                        int i = 0;
                        int newcx = 0;

                        // Iterate through the sub-items, which are columns.
                        for (int e = 0; e < ((ListViewItem)Items[ii]).SubItems.Count; e++)
                        {
                            // Calculate the x position of the next column.
                            newcx = cx + ((ListViewColumn)Columns[i]).Width;

                            // Draw only the items that will appear on the 
                            // screen.
                            if (newcx > 0)
                            {
                                dc.DrawText(((ListViewSubItem)((ListViewItem)Items[ii]).SubItems[e]).Text, _font, Color.Black,
                                    cx, cy + 2);
                            }

                            // Move to the next column.
                            cx = newcx;
                            i++;

                            // If the location is past the right side of the 
                            // screen, don't show any more columns.
                            if (cx > _width)
                                break;
                        }
                    }

                    // Increment to the next item.
                    cy += itemHeight;
                    j++;

                    // If the location is past the bottom of the screen, don't 
                    // show any more items.
                    if (cy > _height)
                        break;
                }
            }
Esempio n. 9
0
 public BackgroundPanel(Brush background, Pen border)
 {
     Background = background;
     Border = border;
 }
Esempio n. 10
0
        public void DrawEllipse(Brush brush, Pen pen, int x, int y, int xRadius, int yRadius)
        {
            VerifyAccess();

            // Fill
            //
            if (brush != null)
            {
                brush.RenderEllipse(_bitmap, pen, _x + x, _y + y, xRadius, yRadius);
            }

            // Pen
            else if (pen != null && pen.Thickness > 0)
            {
                _bitmap.DrawEllipse(pen.Color, pen.Thickness, _x + x, _y + y, xRadius, yRadius,
                    (Color)0x0, 0, 0, (Color)0x0, 0, 0, 0);
            }

        }
Esempio n. 11
0
        public void DrawRectangle(Brush brush, Pen pen, int x, int y, int width, int height)
        {
            VerifyAccess();

            // Fill
            //
            if (brush != null)
            {
                brush.RenderRectangle(_bitmap, pen, _x + x, _y + y, width, height);
            }

            // Pen
            else if (pen != null && pen.Thickness > 0)
            {
                _bitmap.DrawRectangle(pen.Color, pen.Thickness, _x + x, _y + y, width, height, 0, 0,
                                      (Color)0, 0, 0, (Color)0, 0, 0, 0);
            }
        }
Esempio n. 12
0
        public Border AddTitleBar(string title, Font font, GT.Color foreColor, Brush backgroundBrush)
        {
            Border titleBar = new Border();
            titleBar.Width = displayWidth;
            titleBar.Height = titlebarHeight;
            titleBar.Background = backgroundBrush;

            Text text = new Text(font, title);
            text.Width = displayWidth;
            text.ForeColor = foreColor;
            text.SetMargin(marginSize);
            text.TextAlignment = TextAlignment.Left;

            titleBar.Child = text;
            AddChild(titleBar);

            return titleBar;
        }
Esempio n. 13
0
 public VolumeBar()
 {
     _blockPen = new Pen(Colors.Black);
     _fillBrush = new SolidColorBrush(ColorUtility.ColorFromRGB(0, 127, 70));
 }
 public BackgroundStackPanel(Orientation orientation, Brush background, Pen border)
     : base(orientation)
 {
     Background = background;
     Border = border;
 }