📄 fsavedlg.pas
字号:
unit fSaveDlg;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, CorelButton, ExtCtrls, CheckLst, uOptVars;
type
TfrmSaveDlg = class(TForm)
lblPrompt: TLabel;
imgIcon: TImage;
lstFiles: TListBox;
btnYes: TCorelButton;
btnCancel: TCorelButton;
btnAll: TCorelButton;
btnNo: TCorelButton;
procedure FormCreate(Sender: TObject);
procedure lstFilesDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmSaveDlg: TfrmSaveDlg;
implementation
uses dMain;
{$R *.dfm}
procedure TfrmSaveDlg.FormCreate(Sender: TObject);
begin
imgIcon.Picture.Icon.Handle := LoadIcon(0, IDI_QUESTION);
lblPrompt.Caption := 'The text in one or more files has changed. '#10#10'Do you want to save the changes?'
end;
procedure TfrmSaveDlg.lstFilesDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
Offset, TopOffset, ImgIx: integer;
rc: TRect;
begin
// Paint Icons to the list
with lstFiles do begin
Canvas.FillRect(Rect); { clear the rectangle }
Offset := 20; { provide default offset }
TopOffset := ((Rect.Bottom - Rect.Top) - 16) div 2; // Center the Icon
ImgIx := GetIconIndexFromFile(lstFiles.Items[Index], True);
if (ImgIx > dmMain.imlShellIcon.Count -1) or (ImgIx < 5) then
dmMain.imgDoc.Draw(Canvas, Rect.Left + 1, Rect.Top + TopOffset, 0)
else
dmMain.imlShellIcon.Draw(Canvas, Rect.Left + 1, Rect.Top + TopOffset, ImgIx);
rc.Left := Rect.Left + Offset;
rc.Top := Rect.Top + 2;
if ItemHeight * Items.Count > Height then
rc.Right := Rect.Right - 3 - ScrollBarSize(false)
else
rc.Right := Rect.Right - 3;
rc.Bottom := Rect.Bottom;
DrawText(Canvas.Handle, PChar(Items[Index]), Length(Items[Index]), rc,
DT_PATH_ELLIPSIS or DT_NOPREFIX or DT_NOCLIP);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -