Block style change to a form - delphi

Using Delphi 10.2.3: I have a splash screen form that's created and displayed in the app's main-form unit's initialization section. The form contains a bitmap background with some labels on it for title, copyright, version, build date and initialization status, ParentFont is off for the form and the labels, and the label's font name, size and color are all set at design time to a good contrast for the bitmap background.
In the main form's constructor, the user's choice of style is read from the config and set using TrySetStyle(). But this can change the font color on that splash screen form, which I don't want. I've turned off all the StyleElements for both the form and the labels, but that has no effect.
How can I prevent the change of style from affecting the splash form?

Related

Change the StatusBar text color based on underlying content

In our application we have a page where the StatusBar overlays user generated images. Sometimes these images have a darker top, and sometimes a lighter. This means sometimes the Statusbar on that page isn't visible, or is extremely hard to see. Considering this is the main page of our application, I'm wondering if there's a way to change the color of the StatusBar text based on the underlying content.
(Best font color for the background).
Yes, I'm aware we could show a static background color for the StatusBar, but that would be extremely tacky.
I have perfect way for this: in top of your view with image create minimal shadow. It will be invisible to the user

How can I apply a vcl style to a TPanel?

I can change the appearance of VCL buttons by using the bit map stile designer with specifying a bitmap to [Objects]-[Button]-[Face]-[Bitmap].
So I tried to change the VCL panel's appearance in the same way with [Objects]-[Panel]-[Frame]-[Bitmap] and [Objects]-[Panel]-[FrameNoCaption]-[Bitmap].
The test dialog shows that buttons are rendered in an expected way, but panels are not.
How can I apply a VCL style to a TPanel?

Delphi Statictext font colour change without styles

I'm wanting to change my StaticText font colour from black to clBlue. How can I go about this?
Currently I'm doing
StaticText.Font.Color := clBlue;
but that is making no difference to the colour.
What can I do? Thanks!
The TStaticText control is a wrapper around the Win32 STATIC control. When themes are enabled, the system ignores the font color that is specified, and uses the color specified by the theme. Other standard system controls behave in this manner too.
If you want to be able to specify the color of the text, you will need to use a different control. For instance, TLabel.
Set the static text Transparent property to False

How to ownerdraw the scroll buttons in a scrollable Tmenu (or Tpopupmenu)?

By setting a MIM_MAXHEIGHT with SetMenuInfo, I can control the max height of a [popup]menu. When the menu appears, if it needs more height than MIM_MAXHEIGHT, it will have 2 scrollbuttons (one at the top, the second at the bottom)
I do draw myself the menuitems to theme them with various flavours.
But my OnDrawItem or OnMeasureItem are never called for drawing the scrollbuttons.
So my question is : How to ownerdraw the scroll buttons in a scrollable Tmenu (or Tpopupmenu)? Is it even possible?
Looking at the MSDN documentaiton, I don't think you can not owerdraw those buttons, as they are not part of the menu items, but of the menu itself.
The menu itself only has very few flags you can define; the only modify the background.
This link describes (an English translation of) how to to this.
Or this link on the Embarcadero forum.
What is possible is to set a background color to the menu (MIM_BACKGROUND) and giving to the hbrBack member a Tbrush.handle with a predefined color.
that is not perfect but often, themes use a single color to backgroud the menuitems. By this way, the scroll buttons will be colored with the background color

How to add background images to Delphi forms

How can I add a background image to my delphi form? I added a TImage, but now the labels aren't visible any more, and the texts of my checkboxes are in a blue "box" (blue is the background color i chose). This blue doesn't look very good on the background image, and the hidden labels also don't look good. How do I fix these problems?
For the labels: make sure that they are transparent (Transparent property in the Object Inspector), and that they are on top of the TImage in the Z-order of controls. To correct this you can execute the "Send to back" command on the TImage component in design mode, it will make all other non-windowed controls appear on top of it.
For the checkboxes I don't know what the problem in your case is, in Delphi 2007 checkboxes appear properly transparent when put over a TImage. Maybe you use an earlier Delphi version? If so it would be good to mention this in the question. There may also be a different behaviour depending on whether themes are active. Again, hard to say without further information.
Move the TImage to the back of the form (right click, order -> send to back).
For labels, set the Transparent property to true. For checkboxes and radio buttons, at least in Delphi 6 which is all I have access to, there is no transparent property. The way round this is to reduce the controls label to zero size and the provide your own additional TLabel, which can be transparent.
Can I also say that I find windows with background images ultra naff, and I know I'm not alone in this.

Resources