Chevron button in delphi dialog form - delphi

I want to draw a Chevron button
in a custom dialog form and I'm wondering if exist a State and Part constant to be used with the DrawThemeBackground function or I must draw this kind of button manually?

The closest I can find for XP is
ThemeServices.DrawElement(Canvas.Handle, GetElementDetails(tebNormalGroupExpandNormal),
Rect(10, 100, 100, 200));
or
EBP_NORMALGROUPEXPAND using DrawThemeBackground directly. However this draws a double arrow (on XP at least)
However later windows versions also have TDLG_EXPANDOBUTTON, which is what you want judging by the image at Where do I find the icons / animations recommended in the Windows 7 UX guide?
Thanks to Andreas (as usual for theme and customer drawing related questions)
See also his utility at Windows Visual Themes: Gallery of Parts and States?
Ideally I would use the second version if available, but fall back to the first on XP.

You can't find it in the list of Parts and States? Then it doesn't exist. http://msdn.microsoft.com/en-us/library/bb773210(v=vs.85).aspx

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.

Can I enlarge the menu font size in Delphi 2?

Everything I've found says I can't do this with Delphi 2's TMainMenu but if somebody here has managed it somehow, I'd really like to know the trick. I found code that changes the System menu font size but none that confines the change to only the application. Anyone here know how to do this or do I have to just accept Delphi 2's tiny menu font size that appears on today's large screen monitors? (Moving the app to an upgraded Delphi is not the answer I need ;-)
The only way to achieve per application custom menu fonts is with an owner drawn menu. Delphi 2 does not support owner drawn menu items directly in the VCL properties of a TMainMenu component. This support was introduced only in Delphi 4.
You could still implement an owner drawn menu, but it would involve implementing them using standard Windows API techniques, and handling the required messages on the forms which own the menus involved. It is not especially difficult but not as straightforward as the event based implementation available in Delphi 4 and later.
You can still use a TMainMenu to define your menus but in your application you would then need to programmatically set the owner draw flag on the menu items and handle the resulting messages appropriately. Doing this, you will need to handle all aspects of drawing the menu - you cannot simply set/change the font and leave the system to draw the menu items. You may also need to provide additional handling for any keyboard shortcuts you have set up.
If this is a viable approach then information on implementing owner drawn menus at the API level can be found here.

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.

SysListView32 like mouse selection rectangle

Can I make a mouse selection rectangle in a List View like in a SysListView32?
Is there a way to work with a SysListView32 and use it in Delphi?
Thanks!
You need to set LVS_EX_DOUBLEBUFFER style of the list view (only applicable with comctl32.dll version 6.0 (XP) and later):
[...] This extended style also enables alpha-blended marquee selection on
systems where it is supported.
uses
commctrl;
..
ListView_SetExtendedListViewStyle(ListView1.Handle, LVS_EX_DOUBLEBUFFER);
It also works with the TShellListView component included as a demo. See this answer to find out how to find and install the shell controls.
(PS: Don't forget to set Multiselect to true)
The site appears to be down currently, but there's a Delphi ListView component available for free from Mustangpeak that has this feature and more that are found in the modern Windows list view.

Delphi TListBox contents overflow when selecting (Win7, 32bit, themed)

I've a TListBox on a Windows form with 966 elements in it. When I click a button on my form, a subset of these strings are selected (roughly 200 of them).
If I now unfocus my application by clicking somewhere on the task bar, the entries from my TListBox bleed upward, so as they are visible above the boundaries of the TListBox. They are thankfully bleeding out behind the TGroupBox component which is directly above them - however this still looks extrememly unpolished.
I'm able to reproduce this only on one Win 7 x64 machine using the Aero theme (I've another Win 7 x64 laptop which doesn't exhibit the same problem with the same theme setting).
I've tried issuing a PostMessage( Self.Handle, WM_PAINT, 0, 0) directly after changing the select status, preceded by a ListBox.Refresh. This doesn't help.
Any help would be much appreciated. Please advise if you need more details.
Cheers, Duncan
Are you using the XPManifest unit, or have you enabled themes for your app? If so, try not using it to see what happens. It can be very bad if you dont have a good video card.
My 2 cents? Avoid using themes at all. It simple does not work very well.

Resources