Q&A

  • 상태바에 콤보박스 넣기 오류
이것좀 알려주세요.

SB_GETRECT이것에서 에러가 나오네요.

소스중 1번항목

왜 이러죠?

헬프화일봐도 영어라 통 알수가 없네요..

누가좀 알려주세요.



unit Unit1;



interface



uses Messages, Windows, SysUtils, CommCtrl, Classes, Controls, Forms,

Menus, Graphics, StdCtrls, RichEdit, ToolWin, ComCtrls;



type

TForm1 = class(TForm)

SBar: TStatusBar;

procedure SBarResize(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure FormShow(Sender: TObject);

private

{ Private declarations }

E : TComboBox;

P : TProgressBar;

public

{ Public declarations }

end;



var

Form1: TForm1;



implementation



{$R *.DFM}



procedure TForm1.SBarResize(Sender: TObject);

var

Rect : TRect;

begin

// 인덱스0번째의 Rect를 가져온다.

SBar.Perform(SB_GETRECT,0,LPARAM(@Rect)); <-1번항목

P.Top := Rect.Top;

P.Left := Rect.Left;

P.Width := Rect.Right - Rect.Left;

P.Height := Rect.Bottom - Rect.Top;

P.Visible := True;



// 인덱스1번째의 Rect를 가져온다.

SBar.Perform(SB_GETRECT,1,LPARAM(@Rect));

E.Top := Rect.Top;

E.Left := Rect.Left;

E.Width := Rect.Right - Rect.Left;

E.Height := Rect.Bottom - Rect.Top;

E.Visible := True;

end;



procedure TForm1.FormCreate(Sender: TObject);

begin

// 콤보박스 생성

E := TComboBox.Create(SBar);

E.Parent := SBar;

E.Visible := False;



// 프로그레스바 생성

P := TProgressBar.Create(SBar);

P.Parent := SBar;

P.Position := 100;

P.Visible := False;

end;



procedure TForm1.FormShow(Sender: TObject);

begin

SBar.Perform(WM_SIZE,0,0);

end;



procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

begin

if Assigned(E) then

E.Free;

if Assigned(P) then

P.Free;

end;



end.

0  COMMENTS