Again FormExDesktop

Cableguy

Expert
Licensed User
Longtime User
Hi Andrew....
I finally solved my initial problems in working with FormExDesktop...And guess what!?!?!
I found new problems.....:sign0060::sign0161:

Here's a couple of screenshots...

I was just trying to add an image button with a very simple bmp image.....Or a png with transparency, if possible...

The imagebutton (CloseButton) was added to a native b4ppc form, and the form is being handled by a FormExDesktop object called FX...

B4X:
Sub SetControls
   FX.New1("MainForm")
   FX.DrawImage=AppPath & "\BackGround.PNG"
   FX.BorderStyle=2
   FX.TransparencyKey=FX.BackColor
   CloseButton.BringToFront
   
   FX.Run '-This MUST be the last statement on the sub
End Sub

I also tryied to create a Non-native form using new2 method, but the behaviour is the same...
 

Cableguy

Expert
Licensed User
Longtime User
Thanks for the fast reply and I am glad to say I found a workaround the transparency issue...
IF one uses as the imagebutton a png with a transparent background ( I achieved this with PaintShop pro BackGround eraser), then un-setting the transparency propertie has NO effect in the image transparent regions...Thus rendering the Button...tranparent...

EDIT:
NO it has NOT been solved, sorry for misleading you..
My image button is just small enough to blend in to the background..
Again, Thank You Andrew!!:sign0188:
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
Thinking with my buttons, I started wondering if controlsExDesktop would have a compatible ImageButton....
Unfortunatly NO...
Perhaps a "small" update would provide a workaround?
 

agraham

Expert
Licensed User
Longtime User
ImageButton is not a button or a Windows Forms control at all but is a custom control so would have to have the coding replicated in ControlEx...

Look at this earlier thread for a couple of ideas. This was before the cs files for merging were available and so before I could look at the code and understand why an ImageButton didn't work on a FormEx.
 

Cableguy

Expert
Licensed User
Longtime User
I've been playing around with a picturebox dll, and setting the props names as close as possible to the ones used in b4ppc...
I'm having some trouble with ImageLayout as it expects an integer and I would like to pass a string equal to the one used in b4ppc image modes.
I understand this is possible with the switch keyword but I cant get it to work...
Anyway...
After exposing all the methods and props needed, I will need to expose at least the 3 events supported by the b4ppc image button...
So I guess about 60% of the FormExDestop compatible IMAGEBUTTON.DLL is done...
(Yes, transparency has been acomplished)
 

agraham

Expert
Licensed User
Longtime User
I understand this is possible with the switch keyword but I cant get it to work...

B4X:
switch (modestring.ToLower())
{
  case "cstretchimage":
    Pbox.SizeMode = PictureBoxSizeMode.StretchImage;
    break;
  case "ccenterimage":
    Pbox.SizeMode = PictureBoxSizeMode.CenterImage;
    break;
  default:
    Pbox.SizeMode = PictureBoxSizeMode.Normal;
    break;
}
 

Cableguy

Expert
Licensed User
Longtime User
Thanks Andrew...
I was not the exct codeI needed, not because of the controls name, but because, in order to achieve transparency, I'm setting the BackgroundImage instead of the Image..
So I used the BackgroundImageLayout prop and it now works a treat...

Now for the hardest part...the events...
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
OK, So I now have a fully working ImageButton/PictureBox, with all the normal props, methods and events used in b4ppc...
I will post it later on, If I can resolve one last thing....
How do I achieve the image shifting that ocours when the control is clicked?
Since I'm working with a Picturebox as a base for my ImageButton, this is not a control standart behaviour...
But perhaps I can do this offset in the click event?
 
Top