Exemple #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);
                }
            }
        }
Exemple #2
0
        //public override Rectangle DisplayRectangle
        //{
        //    get
        //    {
        //        Rectangle rect = base.DisplayRectangle;
        //        return new Rectangle(rect.Left - 4, rect.Top - 1, rect.Width + 8, rect.Height + 5);
        //    }
        //}

        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;

            Pen border = new Pen(SystemColors.Control);

            TabArea.Inflate(nDelta, nDelta);
            g.DrawRectangle(border, TabArea);
            border.Dispose();

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

            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;
                }
            }

            rreg = new Rectangle(TabArea.Left, TabControlArea.Top, nWidth - nMargin, TabControlArea.Height);

            g.SetClip(rreg);

            // 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
            if (this.SelectedTab != null)
            {
                TabPage tabPage = this.SelectedTab;
                Color   color   = Color.White;
                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();
            }
        }