Transparency & runtime themes - delphi

When runtime themes are disabled for whole project, transparent images are drawn with black background. Is it possible to draw transparent image on button when runtime themes are disabled? The button I am using is from TMS Component Pack, its class name is TAdvToolButton. I need to have themes disabled because I want to fully control how application looks like. This is important request.
Please try to explain the connection between transparency & themes because I don't see it. I think these are two different things.

Related

Browser style tabs on the windows navigation bar

I am designing a electron app that is geared to look like a browser (i.e., google chrome), with tabs on the navigation bar.
I want to keep the windows style buttons in the top right for closing, maximizing and minimizing and the border with Windows color.
Currently I am using a frameless electron window and attempting to replicate the Windows 10 GUI but I am coming into a few roadblocks.
How do I get the window color?
When un-focused Windows 10 gives a window a 1px transparent grey border. Any transparent border I create is overlayed against electron's window background and is not transparent.
Where can I find the windows resources to replicate the top right window buttons? I want this to look like windows, not a custom GUI.
Then come the difficulties of replicating this approach for something like the Aero Glass style of Windows 7. Is there a better way to do this? Say perhaps draw directly onto the window border in a way I am not aware of, or is this the only approach?
You have to get this information via a native module that accesses the winAPI. There are packages that will help you if your not familiar with writing the binding yourselfe.
https://www.npmjs.com/package/winapi
https://www.npmjs.com/package/win32api
You can make the window transperent and then add a margin to the html/body instead of using a border when unfocused. check the electron docs for how to make the window transperent.
You will need to consider the diffrences in DPI Windows7 / Windows 10 and also any further change on the windows 10 lifetime, they will definitly change the appearance over the years. Otherwise you could extract the SVG's and styling from here https://codepen.io/agrimsrud/pen/WGgRPP MS did not publish the files so there is no way to get the original ones.
If you want native windows you should not make the window frameless, i think adding the tab support for windows which actually exists should be added to electron. Maybe create a Issue on GitHub, i think the devs there can give you some better hints on how to archive what you want.

Delphi 6 TDateTimePicker Windows Visual Theme support via Manifest

As per my previous question (Delphi 6 support for toolbar and menu icons with alpha channel transparency), we are updating a legacy application developed in Delphi 6 to support Windows Visual Themes by including a Manifest. This has worked well and we have the majority of controls adopting the Windows visual theme correctly.
However, we do have a problem with TDateTimePicker behaving in a slightly odd manner. We have the form colour set to white (RGB 255/255/255) and the input box for TDateTimePicker is not visible on the form until it is clicked into and has an entry in it. Please see screenshots below:
Changing the form colour to grey, we can see that the box is there when not selected, it just has no border drawn around it:
We have been unable to find a property that will change this behaviour. Can anyone shed some light on why this might be occurring, what property needs to be changed, or another method we could possibly use to resolve it?

Delphi XE5 Android TButton colors

I need change color of 50 buttons in one form.
Every button another color and color want to set by code(no design editor).
It is firemonkey mobile application.
By my opinion, without making your own button that doesn't use FMX styles completely (which would break multiplatform compatibility if you are looking forward to support multiple platforms with their native styles), you may apply some filter on top of each of those buttons but on some styles this may cause the text not to be visible, implementing your own filter might get you the desired result:
Effect:=TFillRGBEffect.Create(Self);
Effect.Color:=$80FF0000;
Effect.Parent:=SomeButton;
Another way would be to take advantage of TColorButton with TText on top of it, but this way the entire button won't be filled with your color, but you can modify default/custom style for each platform in order to get what you need (this indeed needs to be done in the designer but you would have to create just one style for each platform you need to support and not 50 for each button):
Button:=TColorButton.Create(Self);
Button.Color:=$80FF0000;
Text:=TText.Create(Button);
Text.Parent:=Button;
Text.Align:=TAlignLayout.alClient;
Text.Text:='Hello';
Text.HitTest:=false;
Button.ClipChildren:=true;
Button.Parent:=Self;

Transparent PNG image with TImageList

I'm using Delphi XE.
I added a TAdvGlowButton on my form and added a TImageList with one transparent PNG image as its source for images. When I view the form in the design mode, the button looks exactly right and the image is transparent. However, when I run the program, the background of the image turns to solid black. If I undestood correctly, this is not a bug of the TAdvGlowButton but TImageList.
Is there a way to fix this without using any 3rd party components?
I solved this by opening the project settings from Project Manager and checked Application -> Enable runtime themes. What kind of silly option is this? When would anyone want to not enable runtime themes?

Change the color of the applications title bar

With Delphi 7 trying to change the color of the title bar of the software from the window theme. I have seen code which allows you to change ALL the title bars of all programs, but I am just wanting to change my program.
Anyone seen/done anything like this? Don't mind paying for a component if needed.
I believe Windows sends the WM_NCPAINT message to an application when it should paint the window frame including the title bar. The default behaviour is to fall back to the default Windows handler which draws the default frame. You could replace this, or re-paint the title-bar section right after.
This looks like a good example: http://delphi.about.com/od/adptips2006/qt/draw_captionbar.htm
The answer by Stijn is not fully complete, as the caption and border of the window will also be redrawn when it is (de-)activated. So in addition to WM_NCPAINT you will also need to handle WM_NCACTIVATE. Unfortunately this can not simply be replaced, as there is other code in the default message handler (apart from drawing code) that needs to be executed. But calling the default handler will in turn lead to the default caption and border being drawn first, which you would then need to draw over with your intended colour, resulting in flicker.
One way to work around this is to adjust the drawing region that the default message handler is called with. See "Drawing titlebar on XP with themes" for an example using Windows API calls that should easily translate to Delphi. Note that this deals only with the text in the caption bar, but the principle applies.
You might take a look at a skinning library. ExpressSkin by DevExpress is a good one.

Resources