zoukankan      html  css  js  c++  java
  • 自动适应屏幕分辨率

    unit ypkodac;

    interface

    uses

      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

      StdCtrls, Grids, DBGrids, Db, MemDS, DBAccess, Ora;

      const

        DefaultWidth   =  1024;//编程时的分辨率

        DefaultHeight   =  768;

     

    type

      TForm1 = class(TForm)

        OraSession1: TOraSession;

        Oramysql: TOraQuery;

        DataSource1: TDataSource;

        DBGrid1: TDBGrid;

        Edit1: TEdit;

        Button1: TButton;

        Button2: TButton;

        tymdz: TCheckBox;

        procedure Button1Click(Sender: TObject);

        procedure Button2Click(Sender: TObject);

        procedure Edit1KeyPress(Sender: TObject; var Key: Char);

        procedure FormCreate(Sender: TObject);

      private

        { Private declarations }

      public

        { Public declarations }

      end;

       TMyControl= class(TControl); //在此加入聲明

    var

      Form1: TForm1;

    implementation

    {$R *.DFM}

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    procedure TForm1.FormCreate(Sender: TObject);

    var

        i:   integer;

        a:   real;

    begin

        if   Screen.Width   <>   DefaultWidth   then

        begin

            height:=longint(height)*longint(screen.height)   div   DefaultHeight;

            =longint(width)*longint(screen.width)   div   DefaultWidth;

            scaleby(screen.width   ,   DefaultWidth);

            for   i   :=   0   to   self.ControlCount   -1   do

            begin

                a   :=   screen.Height   /   DefaultHeight   *   TMyControl(self.Controls[i]).Font.Size;

                TMyControl(self.Controls[i]).Font.Size   :=   trunc(a);

            end;

        end;

    end;

  • 相关阅读:
    gcc链接g++编译生成的静态库和动态库的makefile示例
    gcc将多个静态库链接成一个静态库
    linux c redirect 重定向
    iOS开发如何提高
    致PHP路上的“年轻人”
    显示系统时间--带有秒数
    在 Linux 中使用日志来排错
    程序员必备:技术面试准备手册
    你的Java代码对JIT编译友好么?
    悟空:用Go语言编写的全文搜索引擎
  • 原文地址:https://www.cnblogs.com/hssbsw/p/7672638.html
Copyright © 2011-2022 走看看