DBGRID坎入VCL如何再不點選該FIELD時也顯示 |
尚未結案
|
cschen99
一般會員 ![]() ![]() 發表:3 回覆:6 積分:6 註冊:2005-08-30 發送簡訊給我 |
|
cschen99
一般會員 ![]() ![]() 發表:3 回覆:6 積分:6 註冊:2005-08-30 發送簡訊給我 |
我參考的別人的程式碼,在使用CHECKBOX坎入DBGRID時在(gdFocused in State)的判斷,有ELSE的部分,但是,我看不太懂,不知道有沒有人可以解釋一下
以下是完整的程式碼
procedure TOF_E002.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); const IsChecked : array[Boolean] of Integer = (DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED); var DrawState: Integer; DrawRect: TRect; begin if (gdFocused in State) then begin if (Column.Field.FieldName = DBCheckBox1.DataField) then begin DBCheckBox1.Left := Rect.Left DBGrid1.Left 2; DBCheckBox1.Top := Rect.Top DBGrid1.top 2; DBCheckBox1.Width := Rect.Right - Rect.Left; DBCheckBox1.Height := Rect.Bottom - Rect.Top; DBCheckBox1.Visible := True; end; end else begin if (Column.Field.FieldName = DBCheckBox1.DataField) then begin DrawRect:=Rect; InflateRect(DrawRect,-1,-1); DrawState := ISChecked[Column.Field.AsBoolean]; DBGrid1.Canvas.FillRect(Rect); DrawFrameControl(DBGrid1.Canvas.Handle, DrawRect, DFC_BUTTON, DrawState); end; end; end;請問一下 const IsChecked : array[Boolean] of Integer = (DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED); 這一行是什麼意思 DrawRect:=Rect; InflateRect(DrawRect,-1,-1); DrawState := ISChecked[Column.Field.AsBoolean]; DBGrid1.Canvas.FillRect(Rect); DrawFrameControl(DBGrid1.Canvas.Handle, DrawRect, DFC_BUTTON, DrawState); 這一段,又是什麼意思呢? 以上程式碼,就可以在不點選DBGRID的欄位時,就顯示DBCHECK的外觀, 但是,請問一下,如何應用在DBCOMBOBOX,或是其他VCL的控建呢? |
cschen99
一般會員 ![]() ![]() 發表:3 回覆:6 積分:6 註冊:2005-08-30 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |