⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inputbox.pas

📁 本图书管理系统一sql server为数据库开发平台
💻 PAS
字号:
unit inputbox;
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, ToolWin,ExtCtrls,buttons, ADODB, ImgList;

type
  TSetLendBookForm = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
   procedure CreateParams(var Params: TCreateParams); override;
   procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
 private
   procedure WMPAINT1(var msg:TMESSAGE);message WM_PAINT;
   procedure WMNCPAINT1(var msg:TWMNCPAINT);message WM_NCPAINT;
   procedure Active(var msg:Tmessage);message WM_ACTIVATE;
   procedure WMNCLBUTTONDBLCLK1(var msg:Tmessage);message WM_NCLBUTTONDBLCLK;
       { Private declarations }
  public
    titleBmp:Tbitmap;
    { Public declarations }
  end;

var
  inputboxmy:TSetLendBookForm;

function inputboxshow(const Acaption,Atext:string;var value:string):boolean;
implementation

uses MainForm;
{$R *.dfm}

procedure TSetLendBookForm.WMNCLBUTTONDBLCLK1(var msg:Tmessage);
begin
  //
end;
procedure TSetLendBookForm.Active(var msg:Tmessage);
begin
  self.WMPAINT1(msg);
end;

procedure TSetLendBookForm.CreateParams(var Params: TCreateParams);
begin
  inherited;
  params.Style:=params.Style-WS_SYSMENU;
end;

procedure TSetLendBookForm.WMPAINT1(var msg:TMESSAGE);
begin
  sendmessage(self.Handle,WM_NCPAINT,0,0);
  inherited;
end;

procedure TSetLendBookForm.WMNCPAINT1(var msg:TWMNCPAINT);
var
  dc1:HDC;
  y,frame:integer;
  oldbrush:HBrush;
  oldpen,pen:HPEN;
  canvas:Tcanvas;
begin
  canvas:=Tcanvas.Create;
  dc1:=getwindowdc(Handle);
  y:=GetSystemMetrics(SM_CYSIZE);
  frame:=GetSystemMetrics(SM_CYSIZEFRAME);
  oldbrush:=selectobject(dc1,getstockobject(null_brush));
  pen:=createpen(PS_SOLID,frame*2,rgb(255,255,255));
  oldpen:=selectobject(dc1,pen);
  rectangle(dc1,0,0,Width,Height);
  StretchBlt(dc1,frame,frame,Width-2*frame,y+frame div 2,titlebmp.Canvas.Handle,0,0,titlebmp.Width,titlebmp.Height,srccopy);
  canvas.Handle:=dc1;
  canvas.Brush.Style:=bsclear;
  canvas.TextOut(frame*3,(y-frame)div 2,self.Caption);
  selectobject(dc1,oldbrush);
  selectobject(dc1,oldpen);
  deleteObject(pen);
  canvas.Handle:=0;
  canvas.Free;
  releasedc(Handle,dc1);
end;

procedure TSetLendBookForm.FormCreate(Sender: TObject);
begin
  titlebmp:=Tbitmap.Create;
  titlebmp.LoadFromResourceName(main.resource,'TItle');
end;

procedure TSetLendBookForm.Button2Click(Sender: TObject);
begin
  close;
end;

function inputboxshow(const Acaption,Atext:string;var value:string):boolean;
begin
  result:=false;
  try
    Inputboxmy:=TSetLendBookForm.Create(application);
    inputboxmy.Caption:=acaption;
    inputboxmy.Label1.Caption:=atext;
    inputboxmy.ShowModal;
    if inputboxmy.ModalResult=MRyes then
    begin
      if trim(inputboxmy.Edit1.Text)<>'' then
      begin
        result:=true;
        value:=inputboxmy.edit1.TEXT;
      end
    end;
  finally
    inputboxmy.Free;
  end;
end;


procedure TSetLendBookForm.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9',char(vk_BAcK)]) then
    key:=#0;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -