 |
|
 |
Yes, it's OK. You can use glass button in that way.
Regards,
Lukasz
|
|
|
|
 |
|
 |
This is a great control! You suggested in a previous thread to use the button's DrawToBitmap method to save the button as an image. Do you know how to keep a transparent background when doing the save? I'd like to end up with a semi-transparent png of the entire button, without the background. Using your CreateBackgroundFrame method gets me close, but doesn't include the foreground (text, image, etc).
I have tried overriding the OnPaintBackground, but it didn't seem to do the trick.
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.FillRectangle(Brushes.Transparent, this.Bounds);
}
Any suggestions?
Thanks!
|
|
|
|
 |
|
 |
I use this code and it works:GlassButton gb = new GlassButton();
gb.Size = new Size(75, 23);
gb.Text = "Text";
Image img = new Bitmap(bg.Width, bg.Height);
using (Graphics g = Graphics.FromImage(img))
{
g.Clear(Color.Transparent);
gb.DrawButtonBackgroundFromBuffer(g);
gb.DrawForegroundFromButton(new PaintEventArgs(g, gb.ClienrRectangle));
}
img.Save("file.png");
Lukasz
|
|
|
|
 |
|
 |
Thanks for your help! Now I have a version of this that works for the web!
|
|
|
|
 |
|
 |
You're welcome
|
|
|
|
 |
|
 |
Hello, great work! But only thing: I'll want to use this great buttons in an unmanaged MFC-Application. Is it possible to rewrite your Code in C++ or to make an ActiveX-Control from that? Or did you have eventually this as an AvtiveX-Ctrl?
Greetings Oliver
|
|
|
|
 |
|
 |
Hello,
If an MFC application uses the glass button, it has to be a managed application.
The button could be also wrapped in an MFC class, but it would still require the .NET Framework and would have to be compiled as a managed dll.
I do not have it as an ActiveX control.
Regards,
Lukasz
|
|
|
|
 |
|
 |
Is there a way to use this on a web page?
|
|
|
|
 |
|
 |
No. WindowsForms controls cannot be used on a web page.
Lukasz
|
|
|
|
 |
|
 |
Hi,
great thing, this little project.
but what happens if i clicked the button is:
if i leave the button his color becomes black (like backcolor).
i think the button should look normal as before.
is there a workaround to give the button such a functionality ?
Stulle
|
|
|
|
 |
|
 |
Hi,
Sorry, but I couldn't reproduce this behavior. Can you be more specific?
Lukasz
|
|
|
|
 |
|
 |
Hi,
ok, in the procedure ongotfocus of the button i've set a new backcolor, but saving the old value.
in the procedure onlostfocus i've set the backcolor back to it's old value.
if i now lose the focus for this button, it's backcolor will always become black.
I hope this describes the problem in a easily comprehensible way.
Stulle
|
|
|
|
 |
|
 |
Hi,
it is possible that you have convert the C#-Code to VB-Code with a C# to VB converter? I have tried this way and after that, I see exactly this problem...
Best reagards
Damir
|
|
|
|
 |
|
 |
Hi,
I wouldn't recommend using any VB to C# converter. Many of them produces bugged code. Better choice is to decompile GlassButton.dll to VB using for example .NET Reflector.
Regards,
Lukasz
|
|
|
|
 |
|
 |
Hi,
I cannot say what is wrong I you have modified the code. Could you send me a sample application in which this bug occurs?
Lukasz
|
|
|
|
 |
|
 |
Hi,
First, thank you very much for your hard work and the really great control. I have two questions:
1.) It is possible, that I can use your Control in my Freeware application?
2.) In future, can I use your Control in commercial programs???
Best regards and have a nice day....
|
|
|
|
 |
|
 |
Hi,
Thank you.
For both questions the answer is “yes, of course”.
Regards,
Lukasz
|
|
|
|
 |
|
 |
Thank you so much.....
Have a nice time Lukasz!!!!!!!
Damir
|
|
|
|
 |
|
 |
You're welcome
|
|
|
|
 |
|
 |
Nice work...
|
|
|
|
 |
|
 |
Thanks
|
|
|
|
 |
|
 |
is there any way you could add a transparency color option, meaning if i wanted to add an image with the background of black, i could make black transparent. great control by the way, and also, can i assume the same circumstances under the person who made the "liscensing comment" apply to me. (can i use this control as well). thank you for the great control.
|
|
|
|
 |
|
 |
Unfortunately this is not simple because I use standard Windows Forms button to draw the image and the text, and it doesn't provide such a feature. An easier way is to use transparent GIF/PNG image.
Yes, the "licensing comment" applies to you.
|
|
|
|
 |
|
 |
Lemme start off by saying.. awesome control, keep the good work coming. Anyways, i noticed that when the button is disabled, it has very little noticeable difference from an enabled one. Would it be possible to gray out an associated image?
|
|
|
|
 |
|
 |
Hi,
Thanks
I've submitted the next version of the article which contains requested feature. In few days it should appear on this page, meanwhile the next version can be downloaded from my website.
Regards,
Łukasz
|
|
|
|
 |