Click here to Skip to main content
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


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.


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


About the Author

Web Developer
India India
My mail ID is

Comments and Discussions

GeneralThanks much Pinmemberprojectileboy28-May-05 20:23 
GeneralColor Scheme PinmemberTLWallace.NET18-Apr-05 16:08 
GeneralRe: Color Scheme PinmemberShouvik18-Apr-05 19:29 
GeneralOpen UserControl Problem .... PinmemberInquire2you6-Oct-04 6:31 
GeneralRe: Open UserControl Problem .... PinmemberShouvik18-Apr-05 19:31 
GeneralArticle Content PinmemberRichard Parsons27-Aug-04 4:20 
GeneralRe: Article Content PinmemberRichard Parsons30-Aug-04 3:58 
GeneralNothing much in the article PinmemberJ Hurrell27-Aug-04 3:23 
GeneralRe: Nothing much in the article PinmemberT1TAN26-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
Web02 | 2.8.141220.1 | Last Updated 3 Sep 2004
Article Copyright 2004 by Shouvik
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid