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

📄 mainfrm.pas

📁 关于利用DELPHI来进行企业级方案解决的著作的附书源码
💻 PAS
字号:
unit MainFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
 StringGrid1.Canvas.Font.Name:=StringGrid1.Cells[ACol,0];
 if gdFixed in state then
  StringGrid1.Canvas.Brush.Color:=clInfoBk
 else if gdSelected in State then
  StringGrid1.Canvas.Brush.Color:=clRed
 else
  StringGrid1.Canvas.Brush.Color:=clGray;
  StringGrid1.Canvas.TextRect(Rect,Rect.Left,Rect.Top,' '+StringGrid1.Cells[ACol,ARow]);
  if gdFocused in State then
   StringGrid1.Canvas.DrawFocusRect(Rect);
end;

procedure TForm1.FormCreate(Sender: TObject);
var i,j:Integer;
begin
 StringGrid1.ColCount:=Screen.Fonts.Count+1;
 StringGrid1.RowCount:=27;
 for i:=1 to StringGrid1.ColCount-1 do
  begin
   StringGrid1.Cells[i,0]:=Screen.Fonts.Strings[i-1];
   StringGrid1.Canvas.Font.Name:=StringGrid1.Cells[i,0];
   StringGrid1.Canvas.Font.Size:=32;
   StringGrid1.ColWidths[i]:=Length(StringGrid1.Cells[i,0])*10;
  end;
 for j:=1 to 26 do
  for i:=0 to StringGrid1.ColCount-1 do
   StringGrid1.Cells[i,j]:=chr(j+64);
end;

end.

⌨️ 快捷键说明

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