Example #1
0
        private void UpdateUpDown()
        {
            if (bUpDown)
            {
                if (CustomWin32.IsWindowVisible(scUpDown.Handle))
                {
                    Rectangle rect = new Rectangle();

                    CustomWin32.GetClientRect(scUpDown.Handle, ref rect);
                    CustomWin32.InvalidateRect(scUpDown.Handle, ref rect, true);
                }
            }
        }
Example #2
0
        internal void DrawControl(Graphics g)
        {
            if (!Visible)
            {
                return;
            }

            Rectangle TabControlArea = this.ClientRectangle;
            Rectangle TabArea        = this.DisplayRectangle;

            // fill client area
            RenderControlBackground(g, TabControlArea);

            // draw panel border
            int nDelta = SystemInformation.Border3DSize.Width;

            TabArea.Inflate(nDelta, nDelta);
            //RenderTabPanelBorder(g, TabArea);


            // clip region for drawing tabs
            Region rsaved = g.Clip;

            int nWidth = TabArea.Width + nMargin;

            if (bUpDown)
            {
                // exclude updown control for painting
                if (CustomWin32.IsWindowVisible(scUpDown.Handle))
                {
                    Rectangle rupdown = new Rectangle();
                    CustomWin32.GetWindowRect(scUpDown.Handle, ref rupdown);
                    Rectangle rupdown2 = this.RectangleToClient(rupdown);

                    nWidth = rupdown2.X;
                }
            }

            // draw tabs
            for (int i = 0; i < this.TabCount; i++)
            {
                DrawTab(g, this.TabPages[i], i);
            }

            g.Clip = rsaved;
            //----------------------------


            //----------------------------
            // draw background to cover flat border areas
            //覆盖tabpage和控件边框的空隙
            //if (this.SelectedTab != null)
            //{
            //    TabPage tabPage = this.SelectedTab;
            //    Color color = tabPage.BackColor;
            //    Pen border = new Pen(color);

            //    TabArea.Offset(1, 1);
            //    TabArea.Width -= 2;
            //    TabArea.Height -= 2;

            //    g.DrawRectangle(border, TabArea);
            //    TabArea.Width -= 1;
            //    TabArea.Height -= 1;
            //    g.DrawRectangle(border, TabArea);

            //    border.Dispose();
            //}
            //----------------------------

            //如果边框是两条线,则这里就只需要覆盖底线和右边的竖线,根据实际观察得知
            //if (this.SelectedTab != null)
            //{
            //    TabPage tabPage = this.SelectedTab;
            //    Color color = tabPage.BackColor;
            //    Pen border = new Pen(color);

            //    g.DrawLine(border, new Point(TabArea.X + 2, TabArea.Bottom - 2)
            //        , new Point(TabArea.Right - 2, TabArea.Bottom - 2));

            //    g.DrawLine(border, new Point(TabArea.Right - 2, TabArea.Bottom - 2)
            //    , new Point(TabArea.Right - 2, TabArea.Y + 2));

            //    border.Dispose();
            //}
        }