Delphi fmx 切换窗体最大化


本文整理自网络,侵删。

 
unit uFormMain;

interface

uses
  System.SysUtils,
  System.Types,
  System.UITypes,
  System.Classes,
  System.Variants,
  FMX.Types,
  FMX.Controls,
  FMX.Forms,
  FMX.Graphics,
  FMX.Dialogs,
  FMX.StdCtrls,
  FMX.Objects,
  FMX.Layouts,
  FMX.Controls.Presentation,
  FMX.ScrollBox,
  FMX.Memo;

type
  TfrmFormMain = class(TForm)
    imgTImage: TImage;
    lytLayoutFormMain: TLayout;
    lytLayoutTImage: TLayout;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    spdbtnCloseForm: TSpeedButton;
    Label9: TLabel;
    lblClickMe: TLabel;
    procedure imgTImageClick(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure spdbtnCloseFormClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmFormMain: TfrmFormMain;

implementation

uses
  System.TypInfo;

{$R *.fmx}

var
  i: Integer;

procedure TfrmFormMain.FormResize(Sender: TObject);
begin
  Label1.Text := Format('frmFormMain.BorderStyle = %s', [System.TypInfo.GetEnumName(System.TypeInfo(TFmxFormBorderStyle), Ord(frmFormMain.BorderStyle))]);
  Label2.Text := Format('frmFormMain.WindowState = %s', [System.TypInfo.GetEnumName(System.TypeInfo(TWindowState), Ord(frmFormMain.WindowState))]);
  Label3.Text := Format('Form.Height=%d X Form.Width=%d', [Self.Height, Self.Width]);
  Label4.Text := 'lytLayoutTImage.Position relative to lytLayoutFormMain';
  Label5.Text := Format('lytLayoutFormMain.Height=%f X lytLayoutFormMain.Width=%f', [lytLayoutFormMain.Height, lytLayoutFormMain.Width]);
  Label6.Text := Format('lytLayoutTImage.Position.Y=%f X lytLayoutTImage.Position.X=%f', [lytLayoutTImage.Position.Y, lytLayoutTImage.Position.X]);
  Label7.Text := Format('lytLayoutTImage.Height=%f X lytLayoutTImage.Width=%f', [lytLayoutTImage.Height, lytLayoutTImage.Width]);
  Label8.Text := Format('lytLayoutFormMain.Width - (lytLayoutTImage.Position.X + lytLayoutTImage.Width = %f', [lytLayoutFormMain.Width - (lytLayoutTImage.Position.X + lytLayoutTImage.Width)]);
  Label9.Text := Format('lytLayoutTImage.Align = %s', [System.TypInfo.GetEnumName(System.TypeInfo(TAlignLayout), Ord(lytLayoutTImage.Align))]);
end;

procedure TfrmFormMain.imgTImageClick(Sender: TObject);
begin
  if frmFormMain.WindowState = TWindowState.wsMaximized then
  begin
    frmFormMain.WindowState := TWindowState.wsNormal;
    lblClickMe.Text := 'Click Me!';
  end
  else
  begin
    frmFormMain.WindowState := TWindowState.wsMaximized;
    lblClickMe.Text := 'Click Me!'#13'Again'#13'Uh! I like...';
  end;
end;

procedure TfrmFormMain.spdbtnCloseFormClick(Sender: TObject);
begin
  Close;
end;

end.

相关阅读 >>

webbrowser点击没有id和name的按钮或链接

Delphi 时间与相关类型(3): tfiletime、tsystemtime 及 dos 时间

Delphi里实现文件格式关联应用程序的功能

Delphi 谷歌api文本转换语音mp3文件

Delphi wmi 取显卡gpu信息

Delphi 提高unigui开发效率的两个方法

Delphi removewhitespaces 过滤字符串所有空格

Delphi tpath

Delphi控件adsl拨号和断开

Delphi循环遍历同类控件或所有控件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...