全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1265
推到 Plurk!
推到 Facebook!

請問Delphi6的TDBCtrlGrid的ScrollBar如何隱藏?

答題得分者是:william
ying0515
中階會員


發表:90
回覆:168
積分:81
註冊:2003-01-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-02-12 09:09:40 IP:61.218.xxx.xxx 未訂閱
TDBCtrlGrid不管資料多寡,總是會顯示ScrollBar~~ 請問要如何隱藏(去除)? TDBCtrlGrid無法實作 procedure Paint; override; Compile出現 [Error] DBgridNoSc.pas(14): Method 'Paint' not found in base class ------------------------------------------------------------------- unit DBgridNoSc; interface uses Windows, Messages, SysUtils, Classes, Controls, dbcgrids; type TDBgridNoSc = class(TDBCtrlGrid) private { Private declarations } protected { Protected declarations } procedure Paint; override; public { Public declarations } published { Published declarations } end; procedure Register; implementation procedure TDBgridNoSc.Paint; begin SetScrollRange(Self.Handle, SB_VERT, 0, 0, False); inherited Paint; end; procedure Register; begin RegisterComponents('Samples', [TDBgridNoSc]); end; end. Delphi
------
Delphi
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-02-12 09:23:03 IP:147.8.xxx.xxx 未訂閱
Not much experience with the TDBCtrlGrid, but I think you get the wrong way in overriding the "Paint" method:    
unit DBgridNoSc;
interface
uses
  Windows, Messages, SysUtils, Classes, Controls, dbcgrids;
type
  TDBgridNoSc = class(TDBCtrlGrid)
  private
    { Private declarations }
  protected
    { Protected declarations }
    procedure Paint(var Message: TWMPaint); message WM_PAINT;
  public
    { Public declarations }
  published
    { Published declarations }
  end;
procedure Register;
implementation
procedure TDBgridNoSc.Paint(var Message: TWMPaint);
begin
   SetScrollRange(Self.Handle, SB_VERT, 0, 0, False);
   inherited;
end;
procedure Register;
begin
  RegisterComponents('Samples', [TDBgridNoSc]);
end;
end.
ying0515
中階會員


發表:90
回覆:168
積分:81
註冊:2003-01-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-02-12 10:12:23 IP:61.218.xxx.xxx 未訂閱
非常感謝! 五星級william Delphi
------
Delphi
系統時間:2024-04-30 9:50:32
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!