roomstatus.~pas
来自「《Delphi数据库开发经典案例解析》随书代码」· ~PAS 代码 · 共 73 行
~PAS
73 行
unit RoomStatus;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, ImgList, ExtCtrls;
type
TRoomSta = class(TForm)
ImageList1: TImageList;
GroupBox1: TGroupBox;
StringGrid1: TStringGrid;
GroupBox2: TGroupBox;
Button1: TButton;
GroupBox3: TGroupBox;
RadioButton1: TRadioButton;
Image1: TImage;
Image2: TImage;
RadioButton2: TRadioButton;
Image3: TImage;
RadioButton3: TRadioButton;
Image4: TImage;
RadioButton4: TRadioButton;
Image5: TImage;
RadioButton5: TRadioButton;
Image6: TImage;
RadioButton6: TRadioButton;
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
RoomSta: TRoomSta;
implementation
{$R *.dfm}
procedure TRoomSta.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
bitmap:TBitmap;
begin
if (Acol = 1) and (arow = 1) then //判断你的条件
begin
with Sender as TStringGrid do
begin
bitmap:=TBitmap.Create;
imagelist1.GetBitmap(0,bitmap);
stringgrid1.Canvas.StretchDraw(Rect,bitmap);
bitmap.Free;
end;
end;
end;
procedure TRoomSta.Button1Click(Sender: TObject);
var
bitmap:Tbitmap;
begin
stringgrid1.Cells[1,2]:='001';
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?