There is a TCustomStyleServices in Delphi 7? - delphi

In order to override TPanel's Paint procedure to make the background color clwhite in delphi 7, I am following #RRUZ Answer, but I can't find the TCustomStyleServices class.
There is an alternative to do what I want?
I'm using XPMan resource (IDK if changes anything).

Since Delphi7 does not support VCL-Styles, setting Parentbackground to false and Color to clWhite should fit your requirements.

You can see that the question, your link to, is tagged with VCL Styles tag.
How I can change the color of a TPanel with the VCL Styles enabled?
You can click on tthe tag below the question text and read it's description:
https://stackoverflow.com/tags/vcl-styles/info
The information says that VCL styles were introduced with Delphi XE2.
Since Delphi 7 was released somewhat before XE2 it can not contain that feature.

Related

Form.PixelsPerInch no longer used in Delphi Tokyo

In older Delphi's (for example Delphi XE4), it is clear what the Form.PixelsPerInch property is for. If I change this property and save the form, close and then reload it, all controls and fonts on the form will be resized accordingly.
However, in Delphi Tokyo (maybe since Seattle) making such a change has no effect on the controls on the form, and seems to serve no purpose.
Is this correct?
If Delphi Tokyo is not using the PixelsPerInch property I wonder how it can correctly scale the form at different DPI's..

TBitBtn displays only using legacy Windows theme

I created the manifest file for my Delphi 6 application so it can display controls according to the theme defined by Windows (controls 6.0). Everything looks fine, except TBitBtn component, which is displayed using the legacy theme:
The behavior is the same on Windows XP and Windows 7, regardless of the current theme, even when no image is assigned to the TBitBtn component.
Now, when I put a regular TButton component on a form, it displays OK. If I then programmatically set an image to this button in runtime (using SendMessage(Handle, BM_SETIMAGE, IMAGE_ICON, LPARAM(Icon))), it immediately reverts its style to the legacy one.
Is there a way to either make TBitBtn use a proper style, or to display glyph on a regular TButton without reverting to the legacy one in Delphi 6?
In Delphi 6 it is not enough just to add the comctl32 v6 manifest. You also need to modify the VCL to be theme aware. The TBitBtn control is a VCL implemented control that, in its Delphi 6 incarnation, does not know anything about XP themes.
The standard way to deal with this is to add some third party software that performs the magic. That's the XP theme manager from Mike Lischke.
Here's a screenshot from a Delphi 6 application that includes the theme manager:

Is there a way to prevent the IDE from resizing bsNone forms on open?

I have an FMX project with a lot of forms that have BorderStyle := bsNone set during design time, and every time I open one of these forms the IDE will increase its height by 23 pixels. I'm currently using XE5 but I had the same issue in XE2 which I have been using before.
The issue can be reproduced with a vanilla desktop project with one FMX form, but does not appear using VCL.
This is fixed in XE6.
As a workaround you could try setting the BorderStyle at runtime.
I'm more familiar with older versions of Delphi and don't have XE2 installed, but as a workaround can you set Constraints.MaxHeight := [designtime height] and see if that prevents the behavior you are seeing?

How I can apply a vcl style to a TPopupmenu?

I'm using the vcl styles in a Delphi XE2 application, but when i popup a TPopupmenu this is show using the native windows look and feel, exist any way to apply the vcl style colors to the TPopUpMenu?
Replace the TPopupmenu for a TPopupActionBar or use a interposer class to cast the TPopupMenu to TPopupActionBar.
TPopupMenu=class(Vcl.ActnPopup.TPopupActionBar);
Also you can read this Adding VCL Styles support to a TPopupMenu in 2 lines of code

Delphi Xe2 with Firemonkey : Can you have a non-client area that is painted in a style other than the default Windows nonclient paint style?

Here is a sample of a delphi application I am making using firemonkey + Delphi XE2.
As you can see, you can use the visual style "stylebook" in Firemonkey to customize the appearance of most things inside the window frame. However the outside of the window frame is drawn using whatever style Windows decides. Now if I was using VCL instead of Firemonkey, I could apply "VCL Styles" and "skin" the whole VCL application in a dark color scheme.
My guess is that this is NOT YET posssible with Delphi XE2 + Firemonkey. Can anyone show how to do this?
At designtime, the "preview" of your form shows a nice black border. But when I run my app, the Windows XP "Luna" theme border (the blue parts in the picture below) looks atrocious. Ironically, the VCL is prettier (in XE2 with styles) than Firemonkey...
You can create a VCL Forms application as usual, with styles if you like, at runtime load your Firemonkey form and set your VCL form as its parent:
uses
FMX.Platform.Win, FMX.Forms,
Unit2;
procedure TForm1.FormCreate(Sender: TObject);
var
Form2: TForm2;
begin
Form2 := TForm2.Create(nil);
Form2.BorderStyle := FMX.Forms.TFmxFormBorderStyle.bsNone;
Form2.SetBounds(0, 0, ClientWidth, ClientHeight);
Winapi.Windows.SetParent(FmxHandleToHWND(Form2.Handle), Handle);
Form2.Show;
end;
In the following screenshot, Form1 is the VCL application main form (with Carbon style) and the dark-grey area with the button is the embedded Firemonkey form:
Note that I'm not handling resizing of the parent window - it should resize the emebedded form, too, emulating alClient alignment.
It seems there are many potential problems with this approach - I think there's a reason why the IDE doesn't let you easily mix Firemonkey forms with VCL forms - it warns about possible "compilation errors or unexpected behavior."
Firemonkey is cross platform. By and large you cannot do anything that is platform dependent within the FMX framework itself. You can however make calls to the underlying platform (be it windows, OSX or iOS) to access platform specific functionality. This should be done within conditionally compiled code.
eg.
{$IF DCC}
something;
{$ENDIF}
{$IF FPC}
somethingelse;
{$ENDIF}
Looking at it from another viewpoint, it may be possible for you do do all of your FMX work on a TRectangle (for example), then use AddObject (or assign its parent), to a VCL form.
If you change the forms BorderStyle to bsNone, you can add whatever chrome you want. You will, of course, need to manually handle maximise, minimise, close, resize etc actions.

Resources