When creating a FNC Taskdialog at runtime in VCL, the buttons are not scaled and also the memo has no margin on the right side. Calling scale for ppi fixes the buttons but not the margin on the memo, .
At runtime TTMSFNCCustomTaskDialog.ChangeDPIScale(M, D: Integer); is not called.
Also the DialogCreated event occurs too late, so it has no effect.
unit TaskDialogDPI;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, VCL.TMSFNCTaskDialog;
type
TForm2 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
FAddNoteDialog : TTMSFNCTaskDialog;
procedure OnDialogCreated(Sender: TObject);
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
if not Assigned(FAddNoteDialog) then
FAddNoteDialog := TTMSFNCTaskDialog.Create(Self);
FAddNoteDialog.ApplicationIsParent := true;
//FAddNoteDialog.ScaleForPPI(144);
FAddNoteDialog.OnDialogCreated := OnDialogCreated;
FAddNoteDialog.InputType := TTMSFNCTaskDialogInputType.titMemo;
FAddNoteDialog.Instruction := 'Enter description here';
FAddNoteDialog.CommonButtons := [tcbOK, tcbCancel];
FAddNoteDialog.Title := 'Add Session Bookmark';
FAddNoteDialog.Execute;
end;
procedure TForm2.OnDialogCreated(Sender: TObject);
begin
//FAddNoteDialog.ScaleForPPI(144);
end;
end.