5,550,131 members and growing! (19,339 online)
Email Password   helpLost your password?
Languages » C# » General     Intermediate License: The GNU General Public License (GPL)

Office 2007 Button

By Turan Kent

Button
C# 1.0, C#, Windows, .NET, .NET 1.1VS.NET2003, Visual Studio, Dev

Posted: 10 Apr 2007
Updated: 10 Apr 2007
Views: 15,635
Bookmarked: 33 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
17 votes for this Article.
Popularity: 3.74 Rating: 3.04 out of 5
5 votes, 29.4%
1
0 votes, 0.0%
2
2 votes, 11.8%
3
2 votes, 11.8%
4
8 votes, 47.1%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article
Screenshot - ofs2007.png

Introduction

The Office2007 style button is very easy to use. Only DragDrob ToolBox.

Using the code

internal void DrawControl(Graphics e)
{
    recBounds = this.ClientRectangle;
    Rectangle m_BrushSize=new Rectangle(0, 0, 
    this.Width , this.Height / 2);

    for(int i=0;i<=40;i++)
    {

        LinearGradientBrush myLinearGradientBrush1 = new System.Drawing.Drawing2D.LinearGradientBrush(m_BrushSize, Color.FromArgb(i,220,252,255), Color.FromArgb(i,125,195,236),
        90);//top item 



"style3"> LinearGradientBrush myLinearGradientBrush=new LinearGradientBrush(m_BrushSize, Color.FromArgb(i,93,174,221), Color.FromArgb(i,177,252,255), -90);//down item

"style3"> myLinearGradientBrush.WrapMode =System.Drawing.Drawing2D.WrapMode.TileFlipXY; myLinearGradientBrush1.WrapMode=System.Drawing.Drawing2D.WrapMode.TileFlipXY; e.FillRectangle(myLinearGradientBrush,1, this.Height/2, this.Width-2 , this.Height / 2-1);//down

"style3"> e.FillRectangle(myLinearGradientBrush1,1, 1, this.Width-2 , this.Height / 2);//top

"style3"> //Draw Border Brush brsBorder=new SolidBrush(Color.FromArgb(121,157,182)); Pen pnsBorder=new Pen(brsBorder);

"style3"> Brush brsDot=new SolidBrush(Color.FromArgb(179,201,214)); Pen pnsDot=new Pen(brsDot);

"style3">

"style3">

"style3"> e.DrawRectangle(Pens.White,this.ClientRectangle.X+1,this.ClientRectangle.Y+1,this.ClientRectangle.Width-3,this.ClientRectangle.Height-3);

"style3"> e.DrawLine(pnsDot,this.ClientRectangle.X,this.ClientRectangle.Y+1,this.ClientRectangle.X+1,this.ClientRectangle.Y+1); e.DrawLine(pnsDot,this.ClientRectangle.X,this.ClientRectangle.Bottom-2,this.ClientRectangle.X+1,this.ClientRectangle.Bottom-2); e.DrawLine(pnsDot,this.ClientRectangle.Right-1,this.ClientRectangle.Bottom-2,this.ClientRectangle.Right-2,this.ClientRectangle.Bottom-2); e.DrawLine(pnsDot,this.ClientRectangle.Right-1,this.ClientRectangle.Y+1,this.ClientRectangle.Right-2,this.ClientRectangle.Y+1);

"style3"> e.DrawLine(pnsBorder,this.ClientRectangle.X+1,this.ClientRectangle.Y,this.ClientRectangle.Right-2,this.ClientRectangle.Y); e.DrawLine(pnsBorder,this.ClientRectangle.X,this.ClientRectangle.Y+1,this.ClientRectangle.X,this.ClientRectangle.Bottom-2); e.DrawLine(pnsBorder,this.ClientRectangle.X+1,this.ClientRectangle.Bottom-1,this.ClientRectangle.Right-2,this.ClientRectangle.Bottom-1); e.DrawLine(pnsBorder,this.ClientRectangle.Right-1,this.ClientRectangle.Y+1,this.ClientRectangle.Right-1,this.ClientRectangle.Bottom-2);

"style3"> //////////////////////////////////////////////////////////////////end Border OnDrawTextAndImage(e); myLinearGradientBrush.Dispose(); myLinearGradientBrush1.Dispose(); brsBorder.Dispose(); brsDot.Dispose(); pnsBorder.Dispose(); pnsDot.Dispose(); } }

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPL)

About the Author

Turan Kent



Occupation: Web Developer
Location: Turkey Turkey

Other popular C# articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 10 of 10 (Total in Forum: 10) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralmerhabamemberMember 45165144:06 10 Jul '08  
GeneralDoubt & HelpmemberAbhilashAshok22:13 22 Nov '07  
GeneralAnother WaymemberJonFrost2:53 6 Jun '07  
GeneralA bug...memberLu Yixiang16:11 14 Apr '07  
Generalnice control. 5 for it.memberLu Yixiang15:58 14 Apr '07  
GeneralFormattingmembernorm .net22:44 10 Apr '07  
GeneralGreat controlmemberMuhammed Sahin13:06 10 Apr '07  
GeneralRe: Great controlmembermenenedezpoo5:07 12 Apr '07  
GeneralThanks!membermenenedezpoo10:00 10 Apr '07  
GeneralRe: Thanks!membersotona0:44 12 Apr '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 10 Apr 2007
Editor:
Copyright 2007 by Turan Kent
Everything else Copyright © CodeProject, 1999-2008
Web19 | Advertise on the Code Project