如何在StringGrid的cell中載入圖型,又可在另一個Cell中輸入文字? |
答題得分者是:cmf
|
sbt
一般會員 發表:16 回覆:15 積分:6 註冊:2003-01-01 發送簡訊給我 |
|
cmf
尊榮會員 發表:84 回覆:918 積分:1032 註冊:2002-06-26 發送簡訊給我 |
引言: 大家好: 我想讓stringgrid中的cell可載入圖形又可輸入文字 是要用stringgrid 或 drawgrid? 且該怎麼用?unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, OleServer, Access97, Grids; type TForm1 = class(TForm) DrawGrid1: TDrawGrid; procedure DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var index: integer; s:string; begin index := ARow * DrawGrid1.ColCount ACol; with Sender as TDrawGrid do begin Canvas.Brush.Color := clBackGround; Canvas.FillRect(Rect); ImageList1.Draw(Canvas,Rect.Left,Rect.Top,index); s:=GetEditText(ACol, ARow); Canvas.TextRect(Rect,0,0,s); if gdFocused in State then Canvas.DrawFocusRect(Rect); end; end; end.
------
︿︿ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |