Click here to Skip to main content
Licence CPOL
First Posted 1 Jan 2008
Views 37,103
Downloads 549
Bookmarked 33 times

A shiny orb button in GDI+

By | 1 Jan 2008 | Article
A button with a shiny orb effect on mouse hover.

Introduction

I was actually experimenting with different brush options to create a glassy orb, but it did not work .. But, I still liked the effect even though it wasn't really what I wanted .. So, I turned this into a button. Hopefully, someone may find this useful. When the world is going to WPF ...

Using the code

There aren't many options to play around with except that you can add image, text, and colors.. Do whatever you want with the code, and if you manage to create a shiny glass effect .. let me know. The code is short, and most of the implementation is in the OnPaint method.

The following is used to create the animation effect for the glowing light:

pgb1.FocusScales = new PointF(_focus, _focus);

where pgb1 is the PathGradientBrush.

Then, as a mouse hovers over, it kick starts a timer and increases the focus:

if (_focus < 0.9f)
    _focus = _focus + 0.1f;
}
else { 
    timer.Stop(); 
}

As focus reaches 1, the timer stops.

The reverse occurs when the mouse leaves the control.

History

  • Version 0.1

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Steve-Low-NextwaveSoft

Software Developer (Senior)
www.nextwavesoft.com
United States United States

Member

Senior Software Developer at nextwavesoft

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmembernettai21:29 16 Dec '08  
Questionhow can i Pinmembershahidashraf6:56 28 Aug '08  
GeneralNot very shiny PinmemberKing_kLAx10:15 2 Jan '08  
GeneralRe: Not very shiny Pinmembersllow13:58 2 Jan '08  
AnswerRe: Not very shiny PinmemberVartan Simonian17:14 2 Sep '08  

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.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 2 Jan 2008
Article Copyright 2008 by Steve-Low-NextwaveSoft
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid