DBGRID 的寬度造成顯示出錯 |
缺席
|
VICSYS
初階會員 ![]() ![]() 發表:21 回覆:64 積分:32 註冊:2002-10-10 發送簡訊給我 |
Delphi 版本 BDS 2006 Update2 HotFixRollup2
1.dbgrid options 含 dgRowSelect 2.dbgrid Width 剛好等於 Columns 的 Width 3.HightLight 應該是一整行, 但是這時卻亂跑, ![]() ---- 以下為取得 ColumnsWidth 的程式 <textarea class="delphi" rows="10" cols="60" name="code">type TAccessDBGrid=class(TCustomDBGrid); function GetColumnWidths(DBGrid: TCustomDBGrid):Integer; var ColumnCount, I: Integer; begin with TAccessDBGrid(DBGrid) do begin Result := 0; ColumnCount:=0; for I := 0 to Columns.Count-1 do if Columns[I].Visible then begin Inc(Result, Columns[I].Width); Inc(ColumnCount); end; if ColumnCount = 0 then Exit; if dgColLines in Options then Inc(Result, ColumnCount); Inc(Result,GetSystemMetrics(SM_CXVSCROLL)); if dgIndicator in Options then Inc(Result, IndicatorWidth); if BorderStyle = bsSingle then if Ctl3D then Inc(Result, 4) else Inc(Result, 2); end; end; </textarea> |
VICSYS
初階會員 ![]() ![]() 發表:21 回覆:64 積分:32 註冊:2002-10-10 發送簡訊給我 |
|
eaglewolf
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:4 回覆:268 積分:429 註冊:2006-07-06 發送簡訊給我 |
|
VICSYS
初階會員 ![]() ![]() 發表:21 回覆:64 積分:32 註冊:2002-10-10 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |