コード例 #1
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            T1 = new Rectangle(1, 1, Width - 3, 18);

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            //Drawing
            G.Clear(C1);
            LinearGradientBrush G1 = new LinearGradientBrush(new Point(T1.X, T1.Y), new Point(T1.X, T1.Y + T1.Height), C3, C4);

            G.FillRectangle(G1, T1);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), T1);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), new Rectangle(T1.X, T1.Y + T1.Height + 2, T1.Width, Height - T1.Y - T1.Height - 4));

            G1.Dispose();

            G.DrawString(Text, Font, ConversionFunctions.ToBrush(113, 170, 186), new Rectangle(new Point(T1.X + 4, T1.Y), new Size(T1.Width - 40, T1.Height)), new StringFormat {
                LineAlignment = StringAlignment.Center
            });


            //Finish Up
            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #2
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            switch (Align)
            {
            case Alignment.Horizontal:
                G.DrawLine(ConversionFunctions.ToPen(C1), new Point(0, Height / 2), new Point(Width, Height / 2));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(0, Height / 2 + 1), new Point(Width, Height / 2 + 1));
                break;

            case Alignment.Vertical:
                G.DrawLine(ConversionFunctions.ToPen(C1), new Point(Width / 2, 0), new Point(Width / 2, Height));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(Width / 2 + 1, 0), new Point(Width / 2 + 1, Height));
                break;
            }

            e.Graphics.DrawImage(B, 0, 0);
            G.Dispose();
            B.Dispose();
        }