Click here to Skip to main content
Click here to Skip to main content

AlphaGradientPanel, an extended panel

By , 24 Mar 2006
 

Introduction

This is a panel, first of all. Therefore, it has all the advantages of a panel, plus some nice little features.

Using the code

You'll just have to include the component in your toolbox and use it.

The only property that is a bit special is the Colors() property. It is a collection of items and has design-time visibility in the property grid. I'm still trying to achieve transforming the color name that appears in the property grid in a nice drawing... If anybody knows how that can be achieved, please, please, please, let me know ;)

Features

  • Rounded corners (any one of them or all at the same time).
  • Gradients (from 2 to n colors, with some special effects).
  • Transparency (any color can be made transparent with an "Alpha" value between 0 and 255).
  • Borders, even with rounded corners, have a nice little border.
  • Image inclusion (position, opacity, size, grayscale, and padding).
  • Padding of the content, of the back, and of the docking.

History

  • Version 1.0.

License

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

About the Author

Nicolas Wälti
Software Developer (Senior)
Switzerland Switzerland
Member
No Biography provided

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.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionAdding an AlphaGradientPanel at runtime?memberSMothes29 Sep '08 - 4:38 
Hello nick,
 
first of all: great job! The panel just looks awesome!
 
We just performed a few tests with your panel and all works fine if we add the panel in the designer.
However, we would like to add the panel for some testing in code during runtime.
 
Therefore we added a AlphaGradientPanel to a form and took a look at the designer class (VS.NET 2005) that is generated, not to miss a property.
If we add the control by code to a form (easiest sample) than the panel renders his nice borders correctly, but does not render the colors. The panel appears always gray, although the paint event of the AlphaGradientPanel is being triggered and the colors collection is NOT empty!
 
Is it possible to add a AlphaGradientPanel by code? And if so, how can we do this?
 
Please excuse my english.
 

Many thanks in advance.
 
Greetings from germany.
 
S.M.
AnswerRe: Adding an AlphaGradientPanel at runtime? PinmemberNick Waelti1 Oct '08 - 1:10 
Hello,
 
I did a quick test on my side (with VS 2008), and I can do that seamlessly:
(Code on Form Load)
 
Dim agp As New AlphaGradientPanel
agp.Size = New Size(100, 50)
agp.Location = New Point(50, 150)
Dim c1 As New ColorWithAlpha
c1.Color = Color.Red
Dim c2 As New ColorWithAlpha
c2.Color = Color.Yellow
agp.Colors.Add(c1)
agp.Colors.Add(c2)
Me.Controls.Add(agp)
 
Is that not working on your side ?
 
Cheers,
Nick
 
http://www.blueactivity.com

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 24 Mar 2006
Article Copyright 2006 by Nicolas Wälti
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid