コード例 #1
0
ファイル: TextBox.cs プロジェクト: sengiv/WasmWinforms
            internal override void OnPaintInternal(PaintEventArgs args)
            {
                Graphics g     = args.Graphics;
                Brush    brush = ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor);

                int highlighted_idx = HighlightedIndex;

                int y    = 0;
                int last = GetLastVisibleItem();

                for (int i = top_item; i <= last; i++)
                {
                    Rectangle_ item_bounds = GetItemBounds(i);
                    if (!item_bounds.IntersectsWith(args.ClipRectangle))
                    {
                        continue;
                    }

                    if (i == highlighted_idx)
                    {
                        g.FillRectangle(SystemBrushes.Highlight, item_bounds);
                        g.DrawString(owner.auto_complete_matches [i], Font, SystemBrushes.HighlightText, item_bounds);
                    }
                    else
                    {
                        g.DrawString(owner.auto_complete_matches [i], Font, brush, item_bounds);
                    }

                    y += item_height;
                }

                ThemeEngine.Current.CPDrawSizeGrip(g, SystemColors.Control, resizer_bounds);
            }
コード例 #2
0
        protected override void DrawBackground(Graphics dc, Rectangle_ area, TabControl tab)
        {
            if (!ShouldPaint(tab))
            {
                base.DrawBackground(dc, area, tab);
                return;
            }

            VisualStyleElement element = VisualStyleElement.Tab.Pane.Normal;

            if (!VisualStyleRenderer.IsElementDefined(element))
            {
                base.DrawBackground(dc, area, tab);
                return;
            }
            Rectangle_ panel_rectangle = GetTabPanelRect(tab);

            if (panel_rectangle.IntersectsWith(area))
            {
                new VisualStyleRenderer(element).DrawBackground(dc, panel_rectangle, area);
            }
        }
コード例 #3
0
        public virtual void Draw(Graphics dc, Rectangle_ area, TabControl tab)
        {
            DrawBackground(dc, area, tab);

            int start = 0;
            int end   = tab.TabPages.Count;
            int delta = 1;

            if (tab.Alignment == TabAlignment.Top)
            {
                start = end;
                end   = 0;
                delta = -1;
            }

            if (tab.SizeMode == TabSizeMode.Fixed)
            {
                defaultFormatting.Alignment = StringAlignment.Center;
            }
            else
            {
                defaultFormatting.Alignment = StringAlignment.Near;
            }

            int counter = start;

            for (; counter != end; counter += delta)
            {
                for (int i = tab.SliderPos; i < tab.TabPages.Count; i++)
                {
                    if (i == tab.SelectedIndex)
                    {
                        continue;
                    }
                    if (counter != tab.TabPages[i].Row)
                    {
                        continue;
                    }
                    Rectangle_ rect = tab.GetTabRect(i);
                    if (!rect.IntersectsWith(area))
                    {
                        continue;
                    }
                    DrawTab(dc, tab.TabPages[i], tab, rect, false);
                }
            }

            if (tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos)
            {
                Rectangle_ rect = tab.GetTabRect(tab.SelectedIndex);
                if (rect.IntersectsWith(area))
                {
                    DrawTab(dc, tab.TabPages[tab.SelectedIndex], tab, rect, true);
                }
            }

            if (tab.ShowSlider)
            {
                Rectangle_ right = GetRightScrollRect(tab);
                Rectangle_ left  = GetLeftScrollRect(tab);
                DrawScrollButton(dc, right, area, ScrollButton.Right, tab.RightSliderState);
                DrawScrollButton(dc, left, area, ScrollButton.Left, tab.LeftSliderState);
            }
        }