Transparent PNG image with TImageList - delphi

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?

Related

Custom Component Icons Not Showing in Delphi 10.3

I just moved from Delphi 7 to 10.3 and was trying to install some of my older (VCL) custom components. I was finally successful in getting the code to compile, but I'm having trouble with something that seems like it should be trivial. The icons for the custom component(s) in the palette show what looks like a default icon instead of the icon(s) I expected. There are lots of posts on here (most are over 5 yrs old) about component icon issues and I've tried self-compiling the .rc file, including the{ $R .rc} in the package source and using the Project/Resources and Images dialog to specify the icons. I've tried 8-bit, 16-bit, 24-bit icons that are 24x24. Then as a test, I followed the exact procedure shown here which included some of the more recent content on this issue that I could find. I tried with bitmap files at full resolution and 32bpp and 24x24 at 8bpp. In both cases, the default icon showed for this test component. I'm probably overlooking something simple, but I'm kind of at a loss on what to try next. Is there a different procedure for specifying icons for custom components in 10.3 compared to older versions?
Edit: An update - I reinstalled my custom component and then rebooted and then was able to see the correct icon reflected in the palette, but here's where it gets strange. The test component I linked above still shows a default icon even after reinstalling and rebooting, and even stranger, is that the second I use my custom component on a form, the icon in the palette reverts to a TEdit icon (the component is a descendant of TEdit). Closing Delphi and reopening restores the icon until it is used again.
I'm not sure whether I should answer my own question, but just wanted to update in case it helps someone later. I was finally able to get the sample test component icon to show by using the -nocache option as described here. I then cleared the registry cache for my own component (dclusr) as shown in the same post and then also changed the bitmaps from 8bpp to 32bpp and now everything seems to be working as expected. I then cleared the registry keys for the sample project, and I can run without the -nocache option and all icons show fine, so I am thinking it was mostly a cache issue which I never would have found without the referenced post.

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?

Transparency & runtime themes

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.

Delphi XE2 modern looking MainMenu

I am trying to modernize the look of our older Delphi 7 application now that we are using Delphi XE-2. I experimented with the TRibbon, and although I like it, it probably is not the correct solution since we currently use a TMainMenu and make many runtime changes to it - our users can modify the main menu. But the default Mainmenu looks old, especially compared to the image shown.
What I am trying to do is something very close to the attached image, especially with the background color, but I don't quite understand how this was done. Can anyone tell me if this example (the File/View/Insert section) uses a TMainMenu, or is it Buttons on a Toolbar ? If we require a customizable main menu, do you think the example shown is an option ?
This example image comes from DevExpress Print Sample library.
Edit : I am new here so I can't include the image. Here is the link :
http://www.devexpress.com/Products/VCL/ExPrintingSystem/gallery.xml
The second image, the green one that says "Print Preview".
You could use the TActionMainMenuBar but the simpler solution for you is to Use Vcl styles, pick a theme, modify the graphical properties of a MainMenu component and then use StyleHooks to force the style just for the MainMenu component without using it for the whole application.

Resources