Q&A

  • 디비그리드에서 수평,수직 이동바...
안녕하세요. DBGrid에서 수평,수직 이동바를 나타나지 않게 할 수는 없나요?



1  COMMENTS
  • Profile
    김영대 1999.05.21 21:00
    북해 wrote:

    > 안녕하세요. DBGrid에서 수평,수직 이동바를 나타나지 않게 할 수는 없나요?

    >



    볼랜드 TI 에 있는 자료입니다

    "2840 Removing the vertical scrollbar from a TDBGrid"

    정확히 구현되는지는 테스트를 안해봐서 모르겠습니다

    수평 스크롤바에 관한 내용는 없네요...



    KEYWORDS: dbgrid grid scrollbar vertical vscroll AREA: Database

    Programming



    In order to remove the vertical scrollbar from a TDBGrid component,

    you must override its Paint method. Inside the Paint method you

    must call the SetScrollRange API procedure to set the min and max

    scroll values to zero (this disables the scrollbar), and then call

    the inherited Paint. The code below is a unit containing a new

    component called TNoVertScrollDBGrid that does this. You can copy

    the code into a file called NEWGRID.PAS, and add it to the component

    library as a custom component.





    unit Newgrid;



    interface



    uses

    WinTypes, WinProcs, Classes, DBGrids;



    type

    TNoVertScrollDBGrid = class(TDBGrid)

    protected

    procedure Paint; override;

    end;



    procedure Register;



    implementation



    procedure TNoVertScrollDBGrid.Paint;

    begin

    SetScrollRange(Self.Handle, SB_VERT, 0, 0, False);

    inherited Paint;

    end;



    procedure Register;

    begin

    RegisterComponents('Data Controls', [TNoVertScrollDBGrid]);

    end;



    end.