Transparent Button in FormEx

superbabicka

Member
Licensed User
Hello again.

I try to make transparent ImageButton in FormEX1 with (FormEx.dll) library.

In normal Form1.Show, Form1 give me transparent PNG image like button, but when I try to use FormEx, on App_Start give me an error like:

Unable to cast object of type 'System.Windows.Forms.Form' to type 'Dbasic.EnhancedControls.CEnhancedForm'.

I try to make desktop application.

How to do this?

Thanks!
 

agraham

Expert
Licensed User
Longtime User
I don't fully understand why an ImageButton cannot be added to a FormEx. It is something to do with the Type of the control but it is probably to do with the fact that it is a sort of custom control i.e one that is synthesised rather than being provided by .NET.

There are two possible solutions, both using the Door library, as shown in the attached example.

1) Synthesise your own ImageButton control with an Image control

2) Use the fact that dekstop buttons have an image property.
 

Attachments

  • FormExImgBtnDemo.zip
    58.9 KB · Views: 170

superbabicka

Member
Licensed User
No understand me!

OK, this in example is buttons with images.

First is image, second is Button with image.
BUT, I have put in FormEx ImageButton - WITH TRANSPARENT BACKGROUND.

That button is not quadrate format, and I must use PNG image file format about transparency. So behind that Button i want to see my Form1 picture.

This is like Picture (Form1) behind picture (Butt1).
For try I use circle image in PNG where the rest of circle is ALPHA color (transparent).

Thanks!
 
Top