|
Hey guys,
Pretty sweet panel. However, I have a problem. I need an image to fill the panel and the form is resizable. However, when I resize the form, the image does not resize. I was hoping for a "SizeMode = stretch" type property, but no such luck.
Has anyone found a way to make the image resize as the form is resized?
|
|
|
|
|
In Class AlphaGradientPanel. Change Sub New() to
Sub New()
Me.SetStyle(ControlStyles.Opaque, True)
Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, False)
Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.Transparent
End Sub
Also add the following override to the same class
Protected Overrides ReadOnly Property CreateParams As System.Windows.Forms.CreateParams
Get
Dim cp As System.Windows.Forms.CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H20
Return cp
End Get
End Property
Hope this helps someone
modified 7-Jun-12 5:10am.
|
|
|
|
|
Nice looking control but the article is almost non-existent.
|
|
|
|
|
Nice job on the control, but as an article, this leaves out a lot. There's no discussion on how the control was designed, the concepts behind it, nor how the code works.
|
|
|
|
|
I double checked this and if you remove the panel from a form, it does NOT remove any of the colorwithalpha objects from the form (check the designer). Also, I have been trying to make it so that you can reuse colors already added to previous panels or just convert the colors collection to remain in the class and not on the form, is that possible?
Thank you very much for the time and effort you have put into this already!!
dminder
|
|
|
|
|
Anyone figured out how to get this to show the controls below through it? I have a panel with a bunch of controls on it, and I want to do just like "lightbox" type of idea over top of the controls? Any Ideas?? Thank you!
|
|
|
|
|
vista ultimate, vstudio 2005
cant make a simple 100% transparent panel. what the heck am i doing wrong?
its always just a gray panel
|
|
|
|
|
ok so i guess this control isnt what i needed.
what i am aiming for is to have a panel floating over a listview and be able to see the listview items THRU the panel. possible? played around with your test app and doenst look like it is.
|
|
|
|
|
Question is why do you want a see through panel to cover a list box?? You may be able to do what you need to without the panel.
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
Hi, i needed this to cover a whole form and have it semi transparent and show something on it, in a way that the whole form including the controls remains slightly visible. the problem im getting is that although i set the alpha levels and all, the controls are not visible through the panel... is there a way to do this? thanks
|
|
|
|
|
I compiled your demo application, and everything is working fine except transparency. I can't see components under AGPanels, because their background is the same color as the main form (standard way of interpreting Transparent color in .NET). How can I obtain effect shown on image in your article (see image under AGPanel)? I am using VS2008 under Windows XP.
|
|
|
|
|
I've the same problem! I'm using Windows XP with VS2005.
I don't know if its because i use Windows XP that i can't see anything transparent.
It would be nice if the person who published this code could give us a hint...
-----
Chris
|
|
|
|
|
Hi,
your control is the best I have seen and used for a long time.
But I get an exception when I resize my main form on which are MANY nested AGPanels.
I can reproduce the failure if I resize the main window to a minum and the then back.
Or sometimes it happens just after minmizing and maximizing the window.
Here is a snippet of the exception(the part within double quotes I translated from german to english"):
<br />
System.NullReferenceException: "Object reference was not specified on an object instance."<br />
at BlueActivity.Controls.AlphaGradientPanel.AlphaGradientPanel_Paint(Object sender, PaintEventArgs e)<br />
at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)<br />
at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)<br />
at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle)<br />
...<br />
Could you please help me to fix that bug, because I'm using your control on a project at work?
Best regards
BBWicked
|
|
|
|
|
i am a newbie so sorry to ask questions like this but i tried to reference the alphagradientpanel.dll it says ok and i can see it in the references then i built the application but anyway i coludn't see it on my toolbar (i am using vb.net 2005).
|
|
|
|
|
I'm using the code in a other project to modify it and get a nice button but i'm having a problem.
How can i delete a color?
I'm trying to delete it in design mode but it won't disapear from the color list and I'm getting an error.
When I delete it in de disigner generated code it's gone but I don't think thats the way it should be done?
When I re add the color in the designer I get the same error (something about component not being serializable).
Did I forget to copy something?
Also when I re add it in the designer code, I can set the color but the colorproperty above it gets the same color.
When I do this in your default project it all works fine.
|
|
|
|
|
Very nice!
Maby you could explain a bit more of what you did to get this great result.
Just like many more did with their projects on the code project.
Or perhaps you could add soms comment to the code or even only to the properties.
It will help al lot of coders who do not "yet" have great coding knowlage.
Thanks for sharing this with the world 5/5!
Raymond
|
|
|
|
|
Thanks Raymond,
I promise I will try to comment my code more. But currently, I'm on vacation and I don't have access to my system and I won't be able to do anything from here. Perhaps you could try to explain what you don't understand and I could give you a hint ?
Cheers,
Nick
|
|
|
|
|
It's not one thing, i'm interested in all of the code.
Especialy the alpha blending.
I'n starting to learn that basics of GDI now, but understanding this is hard withoud some comment.
So thats why I postet this suggestion, not only for my selfe but also for all other "beginners" who come by this nice peace of code.
If I'm going to understand exactely what you've don, then maby I could make a control with the same feature(s) my selfe.
If I'm having specific questions I'll ask.
Thanks for the re!
Raymond
|
|
|
|
|
Nick,
This is excellent work. What is the licensing policy for this code? Can it be incorporated into shareware applications?
Thanks -- Bryan Kinkel
|
|
|
|
|
Hi Bryan,
You can include it in your shareware, no problem. Maybe you can provide me then with a version of your shareware so I can see it in action
Cheers,
Nick
|
|
|
|
|
Nick - I sent you a private email about the application.
Thank you for the permission. More details are in the email.
Is there a way to increase the border width on the panel control?
-- Bryan
|
|
|
|
|
This seem to be an excellent control and we would like to use it our application. You mention above you don't mind it being used in shareware, but would you allow use in a commercial application?
If so please let me know what kind of credit you would like. Mention in the about box, etc.?
If not thanks for the great control. Maybe I'll find a personal project to use it in.
Thanks!
Matt
|
|
|
|
|
Hi Matt,
What kind of application would it be ?
Basically, I'm not against the use in a commercial app. Credit would be nice to "www.blueactivity.com". And if you want to provide me with one copy of your application, then it would be great.
Cheers,
Nick
http://www.blueactivity.com
|
|
|
|