日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

一段个性化stringgrid的代码

發布時間:2023/12/1 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一段个性化stringgrid的代码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

需要注意的是 該段程序使用了 canvas。

procedure TW_CkbTaiZhang.KhLstDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
?? if ARow=khlst.Row then
?? with khlst.Canvas do //畫 cell 的邊框
??? begin
????? Pen.Color := $00ff0000; //定義畫筆顏色(藍色)
????? MoveTo(Rect.Left, Rect.Bottom); //畫筆定位
????? LineTo(Rect.Right, Rect.Bottom); //畫藍色的橫線
????? Brush.Color :=TColor(RGB(10,100,100));
????? fillrect(rect);
????? textout(rect.left+4,rect.top+4,khlst.cells[ACol,ARow]);?? //一定要使用textout輸出文字才能將效果輸出。
??? end;

?? //實現 將 其他控件 浮動在表格框里的效果。
??? if (gdFocused in state) then
??? begin
????? if KhLst.ItemCheck[4, ARow] then
????? begin
??????? if ACol in [5] then
??????? begin
????????? cmbYearMonth.Left := Rect.Left + KhLst.Left;
????????? cmbYearMonth.Top := rect.Top +KhLst.Top;
????????? cmbYearMonth.Width :=rect.Right-rect.Left;
????????? cmbYearMonth.Height :=rect.Bottom - rect.Top;
????????? cmbYearMonth.Text :=khlst.Cells[ACol,ARow];
????????? cmbYearMonth.Visible := true;
????????? cmbYearMonth.SetFocus;
??????? end else cmbyearmonth.Visible := false;
??????? if ACol in [6] then
??????? begin
????????? cmbbxh.Left := Rect.Left + KhLst.Left;
????????? cmbbxh.Top := rect.Top +KhLst.Top;
????????? cmbbxh.Width :=rect.Right-rect.Left;
????????? cmbbxh.Height :=rect.Bottom - rect.Top;
????????? cmbbxh.Text :=khlst.Cells[ACol,ARow];
????????? cmbbxh.Visible := true;
????????? cmbbxh.SetFocus;
??????? end else cmbbxh.Visible :=false;
??????? if ACol in [7] then
??????? begin
????????? cmbbrl.Left := Rect.Left + KhLst.Left;
????????? cmbbrl.Top := rect.Top +KhLst.Top;
????????? cmbbrl.Width :=rect.Right-rect.Left;
????????? cmbbrl.Height :=rect.Bottom - rect.Top;
????????? cmbbrl.Text :=khlst.Cells[ACol,ARow];
????????? cmbbrl.Visible := true;
????????? cmbbrl.SetFocus;
??????? end else cmbbrl.Visible :=false;
??????? if aCol in [8] then
??????? begin
????????? cmbmc.Left := Rect.Left + KhLst.Left;
????????? cmbmc.Top := rect.Top +KhLst.Top;
????????? cmbmc.Width :=rect.Right-rect.Left;
????????? cmbmc.Height :=rect.Bottom - rect.Top;
????????? cmbmc.Text :=khlst.Cells[aCol,aRow];
????????? cmbmc.Visible := true;
????????? cmbmc.SetFocus;
??????? end else cmbmc.Visible :=false;
??????? if acol in [9] then
??????? begin
????????? cmbbl.Left := Rect.Left + KhLst.Left;
????????? cmbbl.Top := rect.Top +KhLst.Top;
????????? cmbbl.Width :=rect.Right-rect.Left;
????????? cmbbl.Height :=rect.Bottom - rect.Top;
????????? cmbbl.Text :=khlst.Cells[aCol,aRow];
????????? cmbbl.Visible := true;
????????? cmbbl.SetFocus;
??????? end else cmbbl.Visible :=false;
????? end else
????? begin
??????? cmbYearMonth.Visible :=false;
??????? cmbbxh.visible :=false;
??????? cmbmc.Visible :=false;
??????? cmbbrl.Visible :=false;
??????? cmbbl.Visible :=false;
????? end;
??? end;
end;

轉載于:https://www.cnblogs.com/wmymtx/archive/2011/12/10/2283527.html

總結

以上是生活随笔為你收集整理的一段个性化stringgrid的代码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。