Пример #1
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (e.X > ClientSize.Width - Dpi.ScaleX(17))
            {
                OnCloseRequested(EventArgs.Empty);
                return;
            }
            else if (e.X <= Dpi.ScaleX(12) + currentWidth)
            {
                contextMenu.Items.Clear();

                for (var i = 0; i < Items.Count; i++)
                {
                    var it = Items[i];

                    if (it != SelectedItem)
                    {
                        var mi = new ToolStripMenuItem {
                            Text = it.Caption, Tag = it
                        };
                        mi.Click += (o, a) =>
                        {
                            var itm = (SwitchBarItem)((ToolStripMenuItem)o).Tag;
                            SelectedIndex = Items.IndexOf(itm);
                        };

                        contextMenu.Items.Add(mi);
                    }
                }

                contextMenu.Renderer = new DocumentMenuRenderer(ClientSize.Width - Dpi.ScaleX(20));
                contextMenu.Show(this, Dpi.ScaleX(3), Dpi.ScaleY(18));
            }
        }
Пример #2
0
        private void GenerateMenu()
        {
            contextMenu.Items.Clear();
            var c   = 0;
            var max = ClientSize.Height - Dpi.ScaleY(50);

            for (var i = 0; i < Items.Count; i++)
            {
                if (Items[i] != SelectedDocument)
                {
                    var it = Items[i];
                    var mi = new ToolStripMenuItem(it.Caption)
                    {
                        Tag = Items[i].Tag
                    };
                    mi.Click += (o, e) => {
                        OnUserDocumentSelect(((ToolStripMenuItem)o).Tag);
                        Refresh();
                    };
                    contextMenu.Items.Add(mi);
                    c += 16;
                }

                if (c >= max || i > MAX_ITEMS)
                {
                    var mi = new ToolStripMenuItem("...");
                    mi.Click += (o, e) => OnMoreDocumentsRequested();
                    contextMenu.Items.Add(mi);
                    break;
                }
            }
        }
Пример #3
0
 protected override void Initialize(ToolStrip toolStrip)
 {
     toolStrip.Padding  = new Padding(0, 0, 0, Dpi.ScaleY(5));
     toolStrip.Width    = Width;
     toolStrip.Height   = Dpi.ScaleY(toolStrip.Items.Count * HEIGHT + 5);
     toolStrip.AutoSize = false;
 }
Пример #4
0
        protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)
        {
            if (e.Index == -1 || DesignMode)
            {
                return;
            }

            var colorRect = new Rectangle(e.Bounds.X + Dpi.ScaleX(2), e.Bounds.Y + Dpi.ScaleY(3), Dpi.ScaleX(12), Dpi.ScaleY(10));
            var textBrush = Enabled ? UserBrushes.Text : UserBrushes.Disabled;

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                e.Graphics.FillRectangle(UserBrushes.Selection, e.Bounds);
                textBrush = UserBrushes.HighlightText;
            }
            else
            {
                e.Graphics.FillRectangle(UserBrushes.Window, e.Bounds);
            }

            var itemValue = this.Items[e.Index].ToString();

            using (var colorBrush = new SolidBrush(itemValue == "Default" ? Color.FromKnownColor(DefaultColor) : Color.FromName(itemValue)))
            {
                if (Enabled)
                {
                    e.Graphics.FillRectangle(colorBrush, colorRect);
                }

                e.Graphics.DrawRectangle(Enabled ? Pens.Black : Pens.Gray, colorRect);
                e.Graphics.DrawString(itemValue, Font, textBrush, new Point(e.Bounds.X + Dpi.ScaleX(18), e.Bounds.Y));
            }
        }
Пример #5
0
 public IntPicker()
 {
     defaultItem    = new DefaultItem();
     DropDownStyle  = ComboBoxStyle.DropDownList;
     DropDownHeight = Dpi.ScaleY(500);
     DrawMode       = DrawMode.OwnerDrawVariable;
     Font           = Fonts.ControlText;
 }
Пример #6
0
        public static void ApplySkin(ToolStripDropDown dropDown)
        {
            dropDown.Renderer = new MenuRenderer();
            var size = MeasureDropDown(dropDown);

            dropDown.Width  = size.Width;
            dropDown.Height = size.Height + Dpi.ScaleY(5);
        }
Пример #7
0
        private static Size InternalMeasureDropDown(ToolStripItemCollection items, bool root)
        {
            var conv     = new KeysConverter();
            var height   = 0;
            var maxWidth = 0;
            var cm       = items.Count > 0 && items[0].Owner is ContextMenuStrip;

            foreach (ToolStripItem it in items)
            {
                it.Font     = Fonts.Menu;
                it.AutoSize = false;
                var sep = it is ToolStripSeparator;
                it.Height = Dpi.ScaleY(sep ? SEPAHEIGHT : ITEMHEIGHT);

                var sc = String.Empty;
                var mi = it as ToolStripMenuItem;

                if (mi != null && mi.ShortcutKeys != Keys.None)
                {
                    sc = conv.ConvertToString(mi.ShortcutKeys) + "     ";
                }

                var width = sep ? Dpi.ScaleX(10) : TextRenderer.MeasureText(it.Text + sc, it.Font).Width +
                            Dpi.ScaleX(IsTopLevel(it) && !cm ? 10 : 20);

                if ((mi != null && !root && mi.DropDownItems.Count > 0) || cm)
                {
                    width += Dpi.ScaleX(30);
                }

                it.Width = width;

                if (width > maxWidth)
                {
                    maxWidth = width;
                }

                if (mi != null)
                {
                    mi.DropDown.AutoSize = false;
                    var size = InternalMeasureDropDown(mi.DropDownItems, false);
                    mi.DropDown.Height = size.Height + Dpi.ScaleY(5);
                    mi.DropDown.Width  = size.Width;
                }

                height += it.Height;
            }

            if (!root || cm)
            {
                foreach (ToolStripItem it in items)
                {
                    it.Width = maxWidth;
                }
            }

            return(new Size(maxWidth, height));
        }
Пример #8
0
 protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
 {
     if (e.Item.Selected)
     {
         var g    = e.Graphics;
         var rect = new Rectangle(Dpi.ScaleX(1), Dpi.ScaleY(1), e.Item.Bounds.Width - Dpi.ScaleX(2), e.Item.Bounds.Height);
         g.FillRectangle(UserBrushes.Selection, rect);
     }
 }
Пример #9
0
 protected override void OnMouseClick(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left && e.X < Dpi.ScaleX(16) + lastWidth)
     {
         GenerateMenu();
         contextMenu.Font     = Fonts.Menu;
         contextMenu.Renderer = new DocumentMenuRenderer(ClientSize.Width - Dpi.ScaleX(LABELS_WIDTH));
         contextMenu.Show(this, new Point(Dpi.ScaleX(3), Dpi.ScaleY(HEIGHT - 2)));
     }
 }
Пример #10
0
 public ColorPicker()
 {
     base.DropDownStyle  = ComboBoxStyle.DropDownList;
     base.DropDownHeight = 320;
     base.Height         = Dpi.ScaleY(21);
     base.MinimumSize    = new System.Drawing.Size(Dpi.ScaleX(10), Dpi.ScaleY(21));
     DrawMode            = DrawMode.OwnerDrawVariable;
     SetStyle(ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint |
              ControlStyles.OptimizedDoubleBuffer, true);
 }
Пример #11
0
 protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
 {
     if (e.Item.Selected)
     {
         var rect = new Rectangle(Dpi.ScaleX(1), Dpi.ScaleY(1), e.Item.Bounds.Width - Dpi.ScaleX(2), e.Item.Bounds.Height);
         e.Graphics.FillRectangle(UserBrushes.Selection, rect);
     }
     else if (e.Item is ToolStripMenuItem && ((ToolStripMenuItem)e.Item).DropDown.Visible)
     {
         var rect = new Rectangle(Dpi.ScaleX(1), Dpi.ScaleY(1), e.Item.Bounds.Width - Dpi.ScaleX(2), e.Item.Bounds.Height);
         e.Graphics.FillRectangle(UserBrushes.Selection, rect);
     }
 }
Пример #12
0
        protected override void OnMeasureItem(MeasureItemEventArgs e)
        {
            if (IsItemVisible(e.Index))
            {
                e.ItemWidth  = ClientSize.Width;
                e.ItemHeight = Dpi.ScaleY(18);
            }
            else
            {
                e.ItemHeight = 0;
            }

            base.OnMeasureItem(e);
        }
Пример #13
0
        public ToolWindow()
        {
            InitializeComponent();
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);

            panel.BackColor = Color.White;
            panel.Paint    += (o, e) =>
            {
                var g = e.Graphics;
                g.DrawLine(UserPens.Border, 0, 0, 0, panel.ClientSize.Height);
                g.DrawLine(UserPens.Border, 0, panel.ClientSize.Height - Dpi.ScaleY(1), panel.ClientSize.Width, panel.ClientSize.Height - Dpi.ScaleY(1));
                g.DrawLine(UserPens.Border, panel.ClientSize.Width - Dpi.ScaleX(1), 0, panel.ClientSize.Width - Dpi.ScaleX(1), panel.ClientSize.Height);
            };
            switchBar.SelectedIndexChanged += SwitchBarSelectedIndexChanged;
            switchBar.CloseRequested       += SwitchBarCloseRequested;
            panel.SetPadding(new Padding(Dpi.ScaleX(1), Dpi.ScaleY(5), Dpi.ScaleX(1), Dpi.ScaleX(2)));
        }
Пример #14
0
        private int DrawItem(Graphics g, ToolbarItem item, int pos, bool sel)
        {
            var text = item.NewContent && !String.IsNullOrEmpty(item.ContentDescription) ?
                       String.Format("{0} ({1})", item.Text, item.ContentDescription) : item.Text;
            var color = sel ? UserColors.HighlightText : UserColors.Text;
            var font  = item.NewContent ? boldFont : Fonts.Menu;
            var tsize = TextRenderer.MeasureText(text, font);
            var width = tsize.Width;

            if (sel)
            {
                g.FillRectangle(UserBrushes.Selection, new Rectangle(pos - Dpi.ScaleX(5), Dpi.ScaleY(3), width + Dpi.ScaleX(10), tsize.Height + Dpi.ScaleY(2)));
            }

            TextRenderer.DrawText(g, text, font, new Rectangle(pos, Dpi.ScaleY(3), width, ClientSize.Height), color, TextFormatFlags.Left);
            return(width);
        }
Пример #15
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (Items.Count > 1 && e.X <= Dpi.ScaleX(16) + lastWidth && e.Y < Dpi.ScaleY(HEIGHT))
            {
                if (hoverItem != 0)
                {
                    hoverItem = 0;
                    using (var g = CreateGraphics())
                        PaintMain(g, fast: true);
                }
            }
            else if (hoverItem != -1)
            {
                hoverItem = -1;
                using (var g = CreateGraphics())
                    PaintMain(g, fast: true);
            }

            base.OnMouseMove(e);
        }
Пример #16
0
        protected override void OnPaint(PaintEventArgs e)
        {
            var g = e.Graphics;

            g.FillRectangle(UserBrushes.Window, ClientRectangle);
            var width     = 0;
            var textColor = UserColors.Text;
            var corner    = "Corner";
            var cross     = "Cross";

            if (SelectedItem != null)
            {
                currentWidth = width = (Int32)g.MeasureString(SelectedItem.Caption, Fonts.Caption).Width;
            }

            if (hoverItem == 0 || contextMenu.Visible)
            {
                g.FillRectangle(UserBrushes.Selection, new Rectangle(Dpi.ScaleX(3), Dpi.ScaleY(4), Dpi.ScaleX(12) + width, Dpi.ScaleY(14)));
                textColor = UserColors.HighlightText;
                corner    = "CornerWhite";
            }
            else if (hoverItem == 1)
            {
                g.FillRectangle(UserBrushes.Selection, new Rectangle(ClientSize.Width - Dpi.ScaleX(17), Dpi.ScaleY(4), Dpi.ScaleX(14), Dpi.ScaleY(14)));
                cross = "CrossWhite";
            }

            using (var bmp = Bitmaps.Load(corner))
                g.DrawImage(bmp, new Rectangle(Dpi.ScaleX(5), Dpi.ScaleY(9), Dpi.ScaleX(bmp.Width), Dpi.ScaleY(bmp.Height)));

            using (var bmp = Bitmaps.Load(cross))
                g.DrawImage(bmp, new Rectangle(ClientSize.Width - Dpi.ScaleX(15), Dpi.ScaleY(7), Dpi.ScaleX(bmp.Width), Dpi.ScaleY(bmp.Height)));

            g.DrawRectangle(UserPens.Border, new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - Dpi.ScaleX(1), ClientRectangle.Height));

            if (SelectedItem != null)
            {
                TextRenderer.DrawText(g, SelectedItem.Caption, Fonts.Caption, new Rectangle(Dpi.ScaleX(14), 0, width + Dpi.ScaleY(20), ClientSize.Height), textColor,
                                      TextFormatFlags.VerticalCenter | TextFormatFlags.Left | TextFormatFlags.EndEllipsis);
            }
        }
Пример #17
0
        protected override void OnPaint(PaintEventArgs e)
        {
            var g = e.Graphics;

            g.FillRectangle(UserBrushes.Menu, ClientRectangle);
            var shift = Dpi.ScaleX(11);

            foreach (var i in items)
            {
                var w = DrawItem(g, i, shift, i == selItem || i == hoverItem);
                i.Left  = shift;
                i.Right = shift + w;
                shift  += w + Dpi.ScaleX(10);
            }

            g.DrawLine(UserPens.Border, new Point(0, 0), new Point(ClientSize.Width, 0));
            g.DrawLine(UserPens.Border, new Point(shift, 0), new Point(shift, ClientSize.Height));

            var extraShift = Dpi.ScaleX(10);

            if (HighlightStatusString)
            {
                g.FillRectangle(UserBrushes.Window, new Rectangle(shift + Dpi.ScaleX(1), Dpi.ScaleY(1), ClientSize.Width - shift, ClientSize.Height));

                if (StatusImage != null)
                {
                    g.DrawImage(StatusImage, new Rectangle(shift + Dpi.ScaleX(10), Dpi.ScaleY(4), Dpi.ScaleX(StatusImage.Width), Dpi.ScaleY(StatusImage.Height)));
                }

                extraShift += Dpi.ScaleX(15);
            }

            var c = HighlightStatusString ? UserColors.Text : UserColors.Disabled;

            TextRenderer.DrawText(g, StatusString, Fonts.Text, new Rectangle(shift + extraShift, Dpi.ScaleY(3), ClientSize.Width - shift - Dpi.ScaleX(20), ClientSize.Height - Dpi.ScaleY(2)),
                                  c, TextFormatFlags.EndEllipsis);
        }
Пример #18
0
        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
            var g  = e.Graphics;
            var cm = e.ToolStrip is ContextMenuStrip;

            var x = IsTopLevel(e.Item) && !cm?Dpi.ScaleX(2) : Dpi.ScaleX(15);

            var y = IsTopLevel(e.Item) && !cm?Dpi.ScaleX(1) : e.TextRectangle.Y;

            var tsize = TextRenderer.MeasureText(e.Text, e.TextFont);

            if (e.Item.Text != e.Text)
            {
                x = e.ToolStrip.Width - tsize.Width - Dpi.ScaleX(2);
            }

            e.TextRectangle = new Rectangle(x, y, e.Item.Width - x, Dpi.ScaleY(16));
            var flag  = IsTopLevel(e.Item) && !cm ? TextFormatFlags.Top | TextFormatFlags.HorizontalCenter : TextFormatFlags.Default;
            var color = !e.Item.Enabled ? UserColors.Disabled :
                        (e.Item.Selected || e.Item.Pressed ? UserColors.HighlightText : UserColors.Text);

            TextRenderer.DrawText(e.Graphics, e.Text, e.TextFont, e.TextRectangle, color,
                                  TextFormatFlags.Left | TextFormatFlags.EndEllipsis | flag);
        }
Пример #19
0
 protected override void OnMeasureItem(System.Windows.Forms.MeasureItemEventArgs e)
 {
     e.ItemHeight = Dpi.ScaleY(16);
 }
Пример #20
0
 protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
 {
     e.Graphics.DrawLine(UserPens.Border, 0, Dpi.ScaleY(1), e.Item.Bounds.Width, Dpi.ScaleY(1));
 }
Пример #21
0
        private void PaintMain(Graphics g, bool fast = false)
        {
            var textColor = UserColors.Text;
            var corner    = "Corner";

            var rect = new Rectangle(0, 0, ClientSize.Width - Dpi.ScaleX(1), Dpi.ScaleY(HEIGHT));

            if (!fast)
            {
                var fullRect = new Rectangle(0, 0, ClientSize.Width - Dpi.ScaleX(1), ClientSize.Height - Dpi.ScaleY(1));
                g.FillRectangle(UserBrushes.Window, rect);
                g.DrawRectangle(UserPens.Border, rect);
                g.DrawRectangle(UserPens.Border, fullRect);
            }

            var text        = SelectedDocument != null ? SelectedDocument.Caption : String.Empty;
            var captionRect = new Rectangle(Dpi.ScaleX(15), 0, ClientSize.Width - Dpi.ScaleY(LABELS_WIDTH), Dpi.ScaleY(HEIGHT));
            var flags       = TextFormatFlags.Left | TextFormatFlags.PathEllipsis | TextFormatFlags.VerticalCenter;

            lastWidth = (Int32)g.MeasureString(text, Fonts.Header).Width;

            if (lastWidth > captionRect.Width)
            {
                lastWidth = captionRect.Width;
            }

            if (hoverItem == 0 || contextMenu.Visible)
            {
                textColor = UserColors.HighlightText;
                corner    = "CornerWhite";
                g.FillRectangle(UserBrushes.Selection, new Rectangle(Dpi.ScaleX(3), Dpi.ScaleY(4), Dpi.ScaleX(16) + lastWidth, Dpi.ScaleY(14)));
            }
            else if (hoverItem == -1 && fast)
            {
                g.FillRectangle(UserBrushes.Window, new Rectangle(Dpi.ScaleX(3), Dpi.ScaleY(4), Dpi.ScaleX(16) + lastWidth, Dpi.ScaleY(14)));
            }

            TextRenderer.DrawText(g, text, Fonts.Header, captionRect, textColor, flags);

            if (Items.Count > 1)
            {
                using (var bmp = Bitmaps.Load(corner))
                    g.DrawImage(bmp, new Rectangle(Dpi.ScaleX(5), Dpi.ScaleY(9), Dpi.ScaleX(bmp.Width), Dpi.ScaleY(bmp.Height)));
            }
            else if (Items.Count == 1)
            {
                using (var bmp = Bitmaps.Load("CornerDisabled"))
                    g.DrawImage(bmp, new Rectangle(Dpi.ScaleX(7), Dpi.ScaleY(7), Dpi.ScaleX(bmp.Width), Dpi.ScaleY(bmp.Height)));
            }

            if (InfoBarVisible && !fast)
            {
                TextRenderer.DrawText(g, Overtype ? "OVR" : "INS", Fonts.Header, new Rectangle(ClientSize.Width - Dpi.ScaleX(32), 0, Dpi.ScaleX(30), Dpi.ScaleY(HEIGHT)), UserColors.Text, flags);
                TextRenderer.DrawText(g, Column.ToString(), Fonts.Menu, new Rectangle(ClientSize.Width - Dpi.ScaleX(68), 0, Dpi.ScaleX(25), Dpi.ScaleY(HEIGHT)), UserColors.Text, flags);
                TextRenderer.DrawText(g, "Col", Fonts.Header, new Rectangle(ClientSize.Width - Dpi.ScaleX(90), 0, Dpi.ScaleX(25), Dpi.ScaleY(20)), UserColors.Text, flags);
                TextRenderer.DrawText(g, Line.ToString(), Fonts.Menu, new Rectangle(ClientSize.Width - Dpi.ScaleX(123), 0, Dpi.ScaleX(35), Dpi.ScaleY(HEIGHT)), UserColors.Text, flags);
                TextRenderer.DrawText(g, "Line", Fonts.Header, new Rectangle(ClientSize.Width - Dpi.ScaleX(150), 0, Dpi.ScaleX(30), Dpi.ScaleY(HEIGHT)), UserColors.Text, flags);

                using (var bmp = Bitmaps.Load("Bounds"))
                    g.DrawImage(bmp, new Rectangle(ClientSize.Width - Dpi.ScaleX(167), Dpi.ScaleY(5), Dpi.ScaleX(bmp.Width), Dpi.ScaleY(bmp.Height)));
            }
        }
Пример #22
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     using (var bmp = Bitmaps.Load("Arrow"))
         e.Graphics.DrawImage(bmp, new Rectangle(e.Item.Bounds.Width - Dpi.ScaleX(10),
                                                 e.ArrowRectangle.Y + Dpi.ScaleY(7), Dpi.ScaleX(bmp.Width), Dpi.ScaleY(bmp.Height)));
 }
Пример #23
0
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     using (var bmp = Bitmaps.Load("Check"))
         e.Graphics.DrawImage(bmp, new Rectangle(e.ImageRectangle.X + Dpi.ScaleX(1),
                                                 e.ImageRectangle.Y + Dpi.ScaleY(5), Dpi.ScaleX(bmp.Width), Dpi.ScaleY(bmp.Height)));
 }
Пример #24
0
 protected override void Initialize(ToolStrip toolStrip)
 {
     toolStrip.AutoSize = false;
     toolStrip.Height   = Dpi.ScaleY(MENUHEIGHT);
     InitializeSubMenus(toolStrip.Items, true);
 }
Пример #25
0
 protected override void OnResize(EventArgs e)
 {
     Height = Dpi.ScaleY(HEIGHT);
     base.OnResize(e);
 }
Пример #26
0
 public FlatPanel()
 {
     SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw, true);
     base.Padding = new Padding(Dpi.ScaleX(2), Dpi.ScaleY(2), Dpi.ScaleX(2), Dpi.ScaleY(2));
 }
Пример #27
0
        protected override void OnPaint(PaintEventArgs e)
        {
            var g = e.Graphics;

            g.DrawRectangle(Pens.DarkGray, 0, switchBar.Height, ClientRectangle.Width - Dpi.ScaleX(1), ClientRectangle.Height - switchBar.Height - Dpi.ScaleY(1));
        }
Пример #28
0
        private void DrawHeader(ListGroup group, DrawItemEventArgs e)
        {
            var caption = group.Title;

            e.Graphics.FillRectangle(UserBrushes.Window, e.Bounds);

            using (var font = new Font(e.Font, FontStyle.Bold))
            {
                if (group.Expanded)
                {
                    e.Graphics.DrawImage(Bitmaps.Load("ArrowDownGray"), e.Bounds.X + Dpi.ScaleX(5), e.Bounds.Y + Dpi.ScaleY(7));
                }
                else
                {
                    e.Graphics.DrawImage(Bitmaps.Load("ArrowGray"), e.Bounds.X + Dpi.ScaleX(7), e.Bounds.Y + Dpi.ScaleY(5));
                }

                var captionSize = e.Graphics.MeasureString(caption, font);
                e.Graphics.DrawString(caption, font, SystemBrushes.ControlText,
                                      e.Bounds.X + Dpi.ScaleX(14), e.Bounds.Y + (e.Bounds.Height - captionSize.Height) / 2);
            }
        }
Пример #29
0
 public SingleBorderPanel()
 {
     SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw, true);
     base.Padding = new Padding(0, Dpi.ScaleY(1), 0, 0);
 }
Пример #30
0
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.DrawLine(UserPens.Border, new Point(0, 0), new Point(ClientSize.Width, 0));

            if (BottomBorder)
            {
                e.Graphics.DrawLine(UserPens.Border, new Point(0, ClientSize.Height - Dpi.ScaleY(1)), new Point(ClientSize.Width, ClientSize.Height - Dpi.ScaleY(1)));
            }

            if (LeftBorder)
            {
                e.Graphics.DrawLine(UserPens.Border, new Point(0, 0), new Point(0, ClientSize.Height - Dpi.ScaleY(1)));
            }

            if (RightBorder)
            {
                e.Graphics.DrawLine(UserPens.Border, new Point(ClientSize.Width - Dpi.ScaleX(1), 0), new Point(ClientSize.Width - Dpi.ScaleX(1), ClientSize.Height - Dpi.ScaleY(1)));
            }

            base.OnPaint(e);
        }