ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

3D Borders With GDI+

private void DrawBorder3D(Graphics g, ref Rectangle rc,
Border3DStyle borderStyle)
{
    ControlPaint.DrawBorder3D(g, rc, borderStyle);
    g.DrawString(borderStyle.ToString(), Font, Brushes.Black,
    rc.Width + 5, rc.Y + (rc.Height - Font.Height) / 2);
    rc.Offset(0, rc.Height + 5);
}

private void Form1_Paint(object sender, PaintEventArgs e)
{
    Rectangle rc = new Rectangle(0, 0, 50, 25);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Adjust);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Bump);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Etched);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Flat);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Raised);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.RaisedInner);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.RaisedOuter);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Sunken);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.SunkenInner);
    DrawBorder3D(e.Graphics, ref rc, Border3DStyle.SunkenOuter);
}

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد