Q&A

  • 캡션바에 글자를 움직이게하고싶습니다.
첨부한 파일을 열면 캡션바에 글자가 막 바뀌는데요..
그렇게 하려면 어떻게 해야되죠?
2  COMMENTS
  • Profile
    소울해커 2008.04.15 07:37
    별 다른거 있겠습니까?

    타이머 돌리면서 일정 문자열을 잘라서 보여주는거죠.


    <!--CodeS-->

    unit Unit1;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls;

    type
      TStrDisplayMode = (tdmStraight,tdmBlink,tdmForward);

    type
      TForm1 = class(TForm)
        Timer1: TTimer;
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        sCaption: String;
        iDisplayType: TStrDisplayMode;
        iBlinkCnt: Integer;
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      sCaption := 'Hellow World!! 2008-04-14';
      Caption := '';
      iBlinkCnt := 6;
      iDisplayType := tdmStraight;
    end;

    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      case iDisplayType of
        tdmStraight:  begin
                       Caption := Copy(sCaption, 0, Length(Caption) + 1);
                       if Length(Caption) = Length(sCaption) then begin
                        iDisplayType := tdmBlink;
                        Timer1.Interval := 500;
                        Sleep(1500);
                       end;
                      end;
        tdmBlink:     begin
                        if Caption <> '' then Caption := ''
                          else Caption := sCaption;
                        Dec(iBlinkCnt);
                        if iBlinkCnt = 0 then begin
                          iBlinkCnt := 6;
                          iDisplayType := tdmForward;
                          Timer1.Interval := 200;
                          Sleep(1500);
                        end;

                      end;
        tdmForward:   begin
                        Caption := Copy(sCaption, 0, Length(Caption) - 1);
                        if Length(Caption) = 0 then begin
                          iDisplayType := tdmStraight;
                          Sleep(1500);
                        end;
                      end;
      end;
    end;

    end.


    <!--CodeE-->

  • Profile
    쉐어 2008.04.16 01:39
    이렇게 소스를 작성했는데... 가만히 그대로있어요.
    캡션에 네임 적어놔서 그런가;;;

    잘 모르겠네요 ㅠㅠ 주석으로 좀 가르쳐주실수있을까요;;