zoukankan      html  css  js  c++  java
  • 显示屏分辨率自动调整例子

    unit ypcx;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, DB, DBTables, Grids, DBGrids;
      const
        DefaultWidth   =  1440;//编程时的分辨率
        DefaultHeight   =  900;
    type
      TForm1 = class(TForm)

        DataSource1: TDataSource;
        DBGrid1: TDBGrid;
        ypksql: TQuery;
        Edit1: TEdit;
        Button1: TButton;
        Button2: TButton;
        Label1: TLabel;
        Edit2: TEdit;
        DataSource2: TDataSource;
        DBGrid2: TDBGrid;
        xmcxsql: TQuery;
        Label2: TLabel;
       
        procedure Button1Click(Sender: TObject);
        procedure Edit1KeyPress(Sender: TObject; var Key: Char);
        procedure Button2Click(Sender: TObject);
        procedure Edit2KeyPress(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.Button1Click(Sender: TObject);

    begin
      with ypksql do
      begin
      sql.Clear ;
      sql.Add(format('select tym,sjjx,zfbl,bz from ypknew1.dbf where tym like ''%%%s%%''; ',[edit1.text]));
      open;


      end;


    end;

    procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
    if key=#13 then
     button1.Click ;
     
     end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin

      with xmcxsql do
      begin
      sql.Clear ;
      sql.Add(format('select mc,nh,cwnr,dj,slyysz,sm from  swybxmn.dbf where mc like ''%%%s%%''; ',[edit2.text]));
      open;


      end;
     end;

    procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
    begin
        if key=#13 then
     button2.Click ;
    end;

    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;

    end.

  • 相关阅读:
    日志_测试代码_Qt532
    SetParent
    【转】QT获取系统时间,以及设置日期格式
    JNI打通java和c
    Python 对图片进行人脸识别
    Python写黑客小工具,360免杀
    简单选择排序
    插入排序
    双向链表的实现
    记录安卓开发中的问题
  • 原文地址:https://www.cnblogs.com/hssbsw/p/2300871.html
Copyright © 2011-2022 走看看