Example #1
0
        private TabImageSet GetTop()
        {
            TabImageSet retVal = new TabImageSet();

            //retVal.FirstCorner = corners.TopLeft;
            //retVal.LastCorner = corners.TopRight;

            int imageHeight = this.TabHeight + this.corners.VerticalMargin;


            //int midSectionHeight = imageHeight;//corners.TopLeft.Height;
            Bitmap middleSection = null;

            using (Graphics graphics = GraphicsManager.GetCanvas(1, imageHeight, corners.BackgroundBrush, out middleSection))
            {
                int y             = corners.VerticalMargin + (int)(corners.Line.Width / 2);
                int lineY         = this.corners.Line.Width > 1 ? y + 1 : y;
                int sectionHeight = imageHeight - this.corners.VerticalMargin - (int)(corners.Line.Width / 2);

                graphics.FillRectangle(corners.FillBrush, -5, y, 10, sectionHeight); // the tab fill
                graphics.DrawLine(corners.Line, -1, lineY, 1, lineY);                // top line of tab
            }

            Bitmap firstSide = null;

            int tabLeftEdgeWidth = corners.TopLeft.Width - ((int)(this.corners.Line.Width / 2));

            using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopLeft.Width, imageHeight, corners.BackgroundBrush, out firstSide))
            {
                int x = (int)(this.corners.Line.Width / 2);
                if (this.corners.Line.Width > 1)
                {
                    x = x + 1;
                }

                int horizLineY = imageHeight - (int)(corners.Line.Width / 2);
                graphics.DrawLine(corners.Line, -5, horizLineY, corners.TopLeft.Width + 5, horizLineY);
                graphics.FillRectangle(corners.FillBrush, x, 0, tabLeftEdgeWidth, imageHeight); // +- 5 to counteract image smoothing which causes discoloration of the selected colors
                graphics.DrawLine(corners.Line, x, -10, x, imageHeight);

                graphics.DrawImage(corners.TopLeft, 0, 0, corners.TopLeft.Width, corners.TopLeft.Height);
            }

            Bitmap lastSide = null;
            int    tabRightEdgeFillWidth = corners.TopRight.Width - ((int)(corners.Line.Width / 2)) - corners.HorizontalMargin;
            int    lineX = this.corners.Line.Width > 1 ? tabRightEdgeFillWidth - 1: tabRightEdgeFillWidth;

            using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopRight.Width, imageHeight, corners.BackgroundBrush, out lastSide))
            {
                int horizLineY = imageHeight - (int)(corners.Line.Width / 2);
                if (corners.Line.Width == 1)
                {
                    horizLineY = horizLineY - 1;
                }

                graphics.DrawLine(corners.Line, -5, horizLineY, corners.TopRight.Width + 5, horizLineY);
                graphics.FillRectangle(corners.FillBrush, -5, 0, tabRightEdgeFillWidth + 5, imageHeight);
                graphics.DrawLine(corners.Line, lineX, -10, lineX, imageHeight);

                graphics.DrawImage(corners.TopRight, 0, 0, corners.TopRight.Width, corners.TopRight.Height);
            }

            //Bitmap firstEdge = null;
            ////int tabLeftEdgeWidth = corners.TopLeft.Width - (corners.HorizontalMargin - (int)(this.corners.Line.Width / 2));

            //using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopLeft.Width, 1, corners.BackgroundBrush, out firstEdge))
            //{
            //    int x = (int)(this.corners.Line.Width / 2);
            //    graphics.FillRectangle(corners.FillBrush, x, -5, tabLeftEdgeWidth + 5, 10); // plus 5 to counteract image smoothing which causes discoloration of the selected colors
            //    graphics.DrawLine(corners.Line, x, -10, x, 10);
            //}

            //Bitmap lastEdge = null;
            //int tabRightEdgeFillWidth = corners.TopRight.Width - ((int)(corners.Line.Width / 2)) - corners.HorizontalMargin;
            //int lineX = tabRightEdgeFillWidth;
            //using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopRight.Width, 1, corners.BackgroundBrush, out lastEdge))
            //{
            //    graphics.FillRectangle(corners.FillBrush, 0, -5, tabRightEdgeFillWidth, 10);
            //    graphics.DrawLine(corners.Line, lineX, -10, lineX, 10);
            //}

            retVal.FirstSide     = firstSide;
            retVal.MiddleSection = middleSection;
            retVal.LastSide      = lastSide;
            retVal.RefreshState();
            return(retVal);
        }
Example #2
0
        private TabImageSet GetTop()
        {
            TabImageSet retVal = new TabImageSet();

            //retVal.FirstCorner = corners.TopLeft;
            //retVal.LastCorner = corners.TopRight;

            int imageHeight = this.TabHeight + this.corners.VerticalMargin;

            //int midSectionHeight = imageHeight;//corners.TopLeft.Height;
            Bitmap middleSection = null;
            using (Graphics graphics = GraphicsManager.GetCanvas(1, imageHeight, corners.BackgroundBrush, out middleSection))
            {
                int y = corners.VerticalMargin +(int)(corners.Line.Width / 2);
                int lineY = this.corners.Line.Width > 1 ? y + 1 : y;
                int sectionHeight = imageHeight - this.corners.VerticalMargin -(int)(corners.Line.Width / 2);

                graphics.FillRectangle(corners.FillBrush, -5, y, 10, sectionHeight); // the tab fill
                graphics.DrawLine(corners.Line, -1, lineY, 1, lineY);// top line of tab
            }

            Bitmap firstSide = null;

            int tabLeftEdgeWidth = corners.TopLeft.Width - ((int)(this.corners.Line.Width / 2));

            using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopLeft.Width, imageHeight, corners.BackgroundBrush, out firstSide))
            {
                int x = (int)(this.corners.Line.Width / 2);
                if (this.corners.Line.Width > 1)
                    x = x + 1;

                int horizLineY = imageHeight - (int)(corners.Line.Width / 2);
                graphics.DrawLine(corners.Line, -5, horizLineY, corners.TopLeft.Width + 5, horizLineY);
                graphics.FillRectangle(corners.FillBrush, x, 0, tabLeftEdgeWidth, imageHeight); // +- 5 to counteract image smoothing which causes discoloration of the selected colors
                graphics.DrawLine(corners.Line, x, -10, x, imageHeight);

                graphics.DrawImage(corners.TopLeft, 0, 0, corners.TopLeft.Width, corners.TopLeft.Height);
            }

            Bitmap lastSide = null;
            int tabRightEdgeFillWidth = corners.TopRight.Width - ((int)(corners.Line.Width / 2)) - corners.HorizontalMargin;
            int lineX = this.corners.Line.Width > 1 ? tabRightEdgeFillWidth - 1: tabRightEdgeFillWidth;
            using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopRight.Width, imageHeight, corners.BackgroundBrush, out lastSide))
            {
                int horizLineY = imageHeight - (int)(corners.Line.Width / 2);
                if (corners.Line.Width == 1)
                    horizLineY = horizLineY - 1;

                graphics.DrawLine(corners.Line, -5, horizLineY, corners.TopRight.Width + 5, horizLineY);
                graphics.FillRectangle(corners.FillBrush, -5, 0, tabRightEdgeFillWidth + 5, imageHeight);
                graphics.DrawLine(corners.Line, lineX, -10, lineX, imageHeight);

                graphics.DrawImage(corners.TopRight, 0, 0, corners.TopRight.Width, corners.TopRight.Height);
            }

            //Bitmap firstEdge = null;
            ////int tabLeftEdgeWidth = corners.TopLeft.Width - (corners.HorizontalMargin - (int)(this.corners.Line.Width / 2));

            //using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopLeft.Width, 1, corners.BackgroundBrush, out firstEdge))
            //{
            //    int x = (int)(this.corners.Line.Width / 2);
            //    graphics.FillRectangle(corners.FillBrush, x, -5, tabLeftEdgeWidth + 5, 10); // plus 5 to counteract image smoothing which causes discoloration of the selected colors
            //    graphics.DrawLine(corners.Line, x, -10, x, 10);
            //}

            //Bitmap lastEdge = null;
            //int tabRightEdgeFillWidth = corners.TopRight.Width - ((int)(corners.Line.Width / 2)) - corners.HorizontalMargin;
            //int lineX = tabRightEdgeFillWidth;
            //using (Graphics graphics = GraphicsManager.GetCanvas(corners.TopRight.Width, 1, corners.BackgroundBrush, out lastEdge))
            //{
            //    graphics.FillRectangle(corners.FillBrush, 0, -5, tabRightEdgeFillWidth, 10);
            //    graphics.DrawLine(corners.Line, lineX, -10, lineX, 10);
            //}

            retVal.FirstSide = firstSide;
            retVal.MiddleSection = middleSection;
            retVal.LastSide = lastSide;
            retVal.RefreshState();
            return retVal;
        }