📄 ugridintro.pas
字号:
unit UGridIntro;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
URGrids, StdCtrls, ExtCtrls, Db, DBTables;
type
TFrmGridIntro = class(TForm)
memoMain: TMemo;
Splitter1: TSplitter;
grdMain: TRealGrid;
tblMain: TTable;
tblMainName: TStringField;
tblMainCapital: TStringField;
tblMainContinent: TStringField;
tblMainArea: TFloatField;
tblMainPopulation: TFloatField;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure grdMainDrawRow(Sender: TObject; ARow: Integer; var BCol,
FCol: TColor; var FStyle: TFontStyles);
private
procedure SelectData;
public
end;
implementation
{$R *.DFM}
const
GD_NAME = 0;
GD_CAPITAL = 1;
GD_CONTINENT = 2;
GD_AREA = 3;
GD_POPULATION = 4;
Description = 'TRealGrid绰 磊丰甫 弊府靛狼 皋葛府 滚欺俊 历厘 包府窍绰 皋葛府 弊府靛涝聪促.' + #13#10 +
'酒贰绰 DBDDEMOS 狼 country.db 磊丰甫 弊府靛肺 颗败稠 巴涝聪促. ' +
'弊府靛绰 Options狼 wgoColSizing阑 True肺 窍绊, 圈 娄凯阑 备盒窍咯 伎狼 硅版祸阑 促福霸 ' +
'钎矫窍档废 捞亥飘甫 累己茄 巴 寇俊绰 Default汲沥 弊措肺 涝聪促.' + #13#10 +
'TRealGrid狼 阿 拿烦篮 DataType阑 爱嚼聪促. ' +
'抗牧措 酒贰狼 Name 拿烦篮 Table狼 Name 鞘靛客 老摹登档废 wdtString俊 24 狼 DataWidth肺 ' +
'汲沥登菌嚼聪促. Area 拿烦篮 Area鞘靛 贸烦 wdtFloat肺 汲沥登菌嚼聪促.';
(*** Private Methods ***)
procedure TFrmGridIntro.SelectData;
begin
with tblMain, grdMain do
begin
Open;
while not EOF do
begin
AddRow;
Cells[GD_NAME , RowCount - 1].AsString := FieldByName('Name' ).AsString;
Cells[GD_CAPITAL , RowCount - 1].AsString := FieldByName('Capital' ).AsString;
Cells[GD_CONTINENT , RowCount - 1].AsString := FieldByName('Continent' ).AsString;
Cells[GD_AREA , RowCount - 1].AsFloat := FieldByName('Area' ).AsFloat;
Cells[GD_POPULATION, RowCount - 1].AsFloat := FieldByName('Population').AsFloat;
Next;
end;
//Close;
end;
end;
(*** Event Handlers ***)
procedure TFrmGridIntro.FormCreate(Sender: TObject);
begin
SelectData;
memoMain.Lines.Text := Description;
end;
procedure TFrmGridIntro.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TFrmGridIntro.grdMainDrawRow(Sender: TObject; ARow: Integer;
var BCol, FCol: TColor; var FStyle: TFontStyles);
begin
if ARow mod 2 = 1 then BCol := clYellow;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -