Labels keep having black background in codenameone - codenameone

I have an app that uses a form which has a white background.The issue is that the labels on the form all have a black background which is not what i want at all.
The code is:
Welcome.getUnselectedStyle().setFgColor(0x0000ff);
Welcome.getUnselectedStyle().setBgColor(0xffffff);
Welcome.getUnselectedStyle().setBgTransparency(0);
Welcome.getSelectedStyle().setBgTransparency(0);
Welcome.getSelectedStyle().setFgColor(0x0000ff);
form.setLayout(layout);
form.getStyle().setBgColor(0xffffff);
hi.addComponent(Welcome);
The "Welcome" label shows a black background...how can i prevent this?

This:
Welcome.getUnselectedStyle().setBgTransparency(0);
Welcome.getSelectedStyle().setBgTransparency(0);
Made the background transparent. I guess you meant 255 for the rest of the code to make sense.

Related

Need overlapping button in round cornered Winform

Need a quick suggestion for styling a WinForm. I made it with rounded corners even when re-sized. Now trying to add a close button with a image (ControlBox=false), overlapping or clipped to top right corner. This is what I could end with.
But I wish to make it more like in this example image.
How could I achieve this in WinForm.
Here's the trick : your window doesn't just end with the white part. It extends a little bit further. The close button comes under the 'extra' part. The other sides where the window appears to not be there is actually transparent...or in the case of the image, semi-transparent.
The glow effect is provided by the window. Set the TransparencyKey property of the window to Color.Magenta (its a convention as Magenta is the color least likely to be used in a window). Then set the background image to a white background with a little bit of Magenta in the edges. The Magenta will appear transparent when set as the background image.
Fiddle around with TransparencyKey and you'll understand what I mean
Winforms itself cannot provide this for you without outside manipulation of the windows,
because it still uses win32 windows classes in the background.
If you want transparancy in windows: see articles like:
Cool, Semi-transparent and Shaped Dialogs with Standard Controls
And the method in Win32 to do it:
SetLayeredWindowAttributes

Ellipse as mask for a label

I'm making a toggle button with a new design "material design" like. I have a problem with animation. I'm using an ellipse that expands and changes the color of the button where the mouse clicked. With color it works well but I want to make visible label as ellipse is over it and invisible the second one. I have an image to make it simplier to understand:
so the second image shows that where the green is it stills writes "Toggled" where it should already write "Untoggled" but still where blue color is, there should be writed "Toggled" then radialy changes. I have tried to use Opacity Mask but I couldn't get it to work. Anyone could help me?
Ok I did it animating EllipseGeometry, settings the label I want to display on top of the old one and clipping the top one to the EllipseGeometry.

winforms messagebox background colour

I am new to winforms and I want to keep things simple
When I create a message box: I notice the top half is white background while the lower half is grey (!!!)
(what I really want is all background white).
But even the VisualStudio dialog doesn't behave this way
Can someone please help me?
Do I need to write some custom code ?
I would post the image but not allowed;(
Thanks
MessageBoxes are displayed by the operating system. If the options that are available aren't good enough, then you have to make your own form.

how to Paint non-client area in winForms transparent? .Net 4

im developing a custom form and i want that the non-client area be transparent. im handling the non client area painting via message number "0x85" and this is what i have tried so far:
Paint using the color "Color.Transparent" -> the non-client area was painted black. If I had used an image of red or black or green, it works perfectly, but transparent = black
Created a transparent image of the size of the form and used the method "myGraphics.DrawImage("img.png")". the background remained black. If I had used an image of red or black or green, it works perfectly also...
Not paint anything (hoping that i just would stay transparent)... not worked
Getting parts of a window transparent requires hardware support, a video adapter feature called layering. Use the form's TransparencyKey property. Set it to an unusual color, like Color.Fuchsia. And draw with that color to get the video adapter to omit the pixels.

Create a GUI for Application

I have to create a program that starts with a splash screen and a transparent image, but in windows form not working there always the white background, how can I do?
You need to set a transparency key. If you set it to white, it will make everything that's white on the form transparent (doesn't work well with the picturebox control though).
So for instance, you create a panel, and give it the background image you want to be displayed, then set the transparency key to whatever color should be made transparent ;p

Resources