Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 当显示PPI缩放处于活动状态时,如何正确使用TGridPanel?_Delphi_Screen Resolution_Delphi 10.1 Berlin_Ppi - Fatal编程技术网

Delphi 当显示PPI缩放处于活动状态时,如何正确使用TGridPanel?

Delphi 当显示PPI缩放处于活动状态时,如何正确使用TGridPanel?,delphi,screen-resolution,delphi-10.1-berlin,ppi,Delphi,Screen Resolution,Delphi 10.1 Berlin,Ppi,我编写了一个小型测试VCL应用程序,监视器PPI为96 应用程序上有一个带有绝对像素大小列的TGridPanel 在那一列上,我放置了一个TComboBox并将其对齐alClient 以下是DFM代码: object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 182 ClientWidth = 514 Color = clBtnFace Font.Charset = DEFAULT_

我编写了一个小型测试VCL应用程序,监视器PPI为96

应用程序上有一个带有绝对像素大小列的TGridPanel

在那一列上,我放置了一个TComboBox并将其对齐
alClient

以下是DFM代码:

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 182
  ClientWidth = 514
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object GridPanel1: TGridPanel
    Left = 0
    Top = 0
    Width = 514
    Height = 182
    Align = alClient
    Caption = 'GridPanel1'
    ColumnCollection = <
      item
        Value = 100.000000000000000000
      end
      item
        SizeStyle = ssAbsolute
        Value = 150.000000000000000000
      end>
    ControlCollection = <
      item
        Column = 0
        Control = Button1
        Row = 0
      end
      item
        Column = 1
        Control = ComboBox1
        Row = 0
      end
      item
        Column = 0
        Control = Edit1
        Row = 1
      end>
    RowCollection = <
      item
        Value = 50.000000000000000000
      end
      item
        Value = 50.000000000000000000
      end>
    TabOrder = 0
    object Button1: TButton
      Left = 1
      Top = 1
      Width = 362
      Height = 21
      Align = alTop
      Caption = 'Button1'
      TabOrder = 0
      OnClick = Button1Click
    end
    object ComboBox1: TComboBox
      Left = 363
      Top = 1
      Width = 150
      Height = 21
      Align = alClient
      TabOrder = 1
      Text = 'ComboBox1'
    end
    object Edit1: TEdit
      Left = 1
      Top = 91
      Width = 362
      Height = 21
      Align = alTop
      TabOrder = 2
      Text = 'Edit1'
    end
  end
end
然后,我在Windows 10的高级缩放设置中将自定义缩放因子更改为125

当我再次运行应用程序时,在注销并再次登录之后,组合框的下拉按钮不再可见

你如何处理这个问题

我试图调用
GridPanel1.ScaleForPPI(96)
,它将恢复组合框上的下拉按钮。但是,这种做法违背了PPI扩展的目的,不是吗


该问题在Delphi 10.3.1中消失了


因此,这至少在Delphi10.1(以及可能的其他较旧版本)中是一个bug。

问题在Delphi10.3.1中消失了


因此,这至少是Delphi10.1(以及可能的其他较旧版本)中的一个bug。

这可能是Delphi版本的一个限制。通过正确的清单设置,它可以在Delphi10.3.1 Rio上正常工作,没有问题。谢谢Uwe。我刚刚安装了Delphi10.3.1,它实际上解决了这个问题。这至少是Delphi10.1中的一个bug。这可能是Delphi版本的一个限制。通过正确的清单设置,它可以在Delphi10.3.1 Rio上正常工作,没有问题。谢谢Uwe。我刚刚安装了Delphi10.3.1,它实际上解决了这个问题。这至少是Delphi10.1中的一个bug。
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    GridPanel1: TGridPanel;
    Button1: TButton;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  PPI: Integer;
begin
  PPI := Integer.Parse(Edit1.Text);
  GridPanel1.ScaleForPPI(PPI);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  Edit1.Text := Screen.PixelsPerInch.ToString;
end;

end.