Click here to Skip to main content
11,428,497 members (63,344 online)
Click here to Skip to main content

Creating some cool buttons and groupboxes

, 2 Sep 2004
Rate this:
Please Sign up or sign in to vote.
Using GDI+ functions to add cool stuff.

Sample Image - testSampleScreen.jpg

Introduction

This is an article on how to create buttons and groupboxes of different shapes using different GDI+ functions.

This example uses GraphicsPath object and others. To create elongated buttons and round cornered groupboxes, we are using a GrahicsPath object and adding a semicircle using AddArc to the left and right, and a rectangle in between for the elongated shape. To create a trapezium shape for the Labels, I have used the client rectangle and created a polygon with points to the three corners of the client rectangle and the top right corner. I have reduced the width by 20 pixels. For the drop shadow labels, I have got shadow colors by using alpha index of black colors, and written the text as many times as the shadow length is specified, increasing the left and top position by one pixel for each iteration. Also, I used the control's Region property to specify non regular shapes, i.e., non rectangular shape of the control.

Here, we use LinearGradientBrush to draw gradients and use GraphicsPath to get non rectangular shape. The color scheme property of the controls help to change different colors of the controls through the interfaces. The OnPaint method calls different methods to draw the control in that way.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Shouvik
Web Developer
India India
My mail ID is shouvik@lycos.com

Comments and Discussions

 
GeneralThanks much Pin
projectileboy28-May-05 20:23
memberprojectileboy28-May-05 20:23 
GeneralColor Scheme Pin
TLWallace.NET18-Apr-05 16:08
memberTLWallace.NET18-Apr-05 16:08 
GeneralRe: Color Scheme Pin
Shouvik18-Apr-05 19:29
memberShouvik18-Apr-05 19:29 
GeneralOpen UserControl Problem .... Pin
Inquire2you6-Oct-04 6:31
memberInquire2you6-Oct-04 6:31 
GeneralRe: Open UserControl Problem .... Pin
Shouvik18-Apr-05 19:31
memberShouvik18-Apr-05 19:31 
GeneralArticle Content Pin
Richard Parsons27-Aug-04 4:20
memberRichard Parsons27-Aug-04 4:20 
GeneralRe: Article Content Pin
Richard Parsons30-Aug-04 3:58
memberRichard Parsons30-Aug-04 3:58 
GeneralNothing much in the article Pin
J Hurrell27-Aug-04 3:23
memberJ Hurrell27-Aug-04 3:23 
GeneralRe: Nothing much in the article Pin
T1TAN26-Oct-07 1:14
memberT1TAN26-Oct-07 1:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150428.2 | Last Updated 3 Sep 2004
Article Copyright 2004 by Shouvik
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid