Q&A

  • 알려주세요 ?
TUpDown 컨트롤처럼 버튼을 누르고 있는동안

계속해서 작동을 할 수 있게 하는 방법이나 혹은 버튼 콤포넌트가

있는지 꼭 알려주세요 ..

부탁드립니다.

2  COMMENTS
  • Profile
    나두초보 2001.11.01 02:45
    Rx 콤포넌트의 ExSpeedButton을 사용하세요.

    AllowTimer := True

    RepeatInterval := 1000

    셋팅하시면 됩니다.



    초보 wrote:

    > TUpDown 컨트롤처럼 버튼을 누르고 있는동안

    > 계속해서 작동을 할 수 있게 하는 방법이나 혹은 버튼 콤포넌트가

    > 있는지 꼭 알려주세요 ..

    > 부탁드립니다.

  • Profile
    최용일 2001.11.01 00:27
    안녕하세요. 최용일입니다.



    타이머 하나 놔두고 마우스캡쳐하세요...



    마우스캡쳐하지 않은 모든 컨트롤에서 될겁니다... (TButton, TBitButton같이



    자체적으로 마우스캡쳐하는거 빼놓구..., TSpeedButton, ...등은 됨)



    아래는 라벨을 아용한 예입니다.



    type

    TForm1 = class(TForm)

    Label1: TLabel;

    Timer1: TTimer;

    procedure FormCreate(Sender: TObject);

    procedure Label1MouseDown(Sender: TObject; Button: TMouseButton;

    Shift: TShiftState; X, Y: Integer);

    procedure Label1MouseUp(Sender: TObject; Button: TMouseButton;

    Shift: TShiftState; X, Y: Integer);

    procedure Timer1Timer(Sender: TObject);

    private

    MousePoint: TPoint;

    end;



    var

    Form1: TForm1;



    implementation



    {$R *.DFM}



    procedure TForm1.FormCreate(Sender: TObject);

    begin

    Label1.Tag := 0;

    Timer1.Enabled := False;

    end;



    procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;

    Shift: TShiftState; X, Y: Integer);

    begin

    MousePoint := Point(X, Y);

    SetCapture(Handle);

    Timer1.Enabled := True;

    end;



    procedure TForm1.Label1MouseUp(Sender: TObject; Button: TMouseButton;

    Shift: TShiftState; X, Y: Integer);

    begin

    Timer1.Enabled := False;

    ReleaseCapture;

    end;



    procedure TForm1.Timer1Timer(Sender: TObject);

    var

    R: TRect;

    begin

    R := Label1.ClientRect;

    if PtInRect(R, MousePoint) then

    begin

    Label1.Tag := Label1.Tag + 1;

    Label1.Caption := IntToStr(Label1.Tag);

    end;

    end;



    ^^ 항상 즐코하세요...



    초보 wrote:

    > TUpDown 컨트롤처럼 버튼을 누르고 있는동안

    > 계속해서 작동을 할 수 있게 하는 방법이나 혹은 버튼 콤포넌트가

    > 있는지 꼭 알려주세요 ..

    > 부탁드립니다.