unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls, comCtrls;
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
SpeedButton1: TSpeedButton;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Enter(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
procedure AddButtons(ToolBar:TToolBar;Const ButtonCations:array of String);
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.AddButtons(ToolBar : TToolBar ; Const ButtonCations : array of String);
var
I : Integer;
begin
for I := 0 to High(ButtonCaptions) do
begin
with TToolButton.Create(ToolBar) do
begin
parent := ToolBar;
Caption := ButtonCaptions[I];
if (ButtonCaptions[I] = '|') then
Style := tbsSeparator
else
Style := tbsButton;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn1.Kind := bkOK;
BitBtn2.Kind := bkCancel;
BitBtn3.Kind := bkHelp;
end;
procedure TForm1.Button1Enter(Sender: TObject);
begin
button1.Cursor := crHandpoint;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ToolBar : TToolBar;
begin
ToolBar := TToolBar.Creatr(Self);
ToolBar.parent := Self;
AddButtons(ToolBar, [ '새파일','저장','|','자르기','복사하기','붙여넣기']);
ToolBar.ShowCaptions := True;
ToolBar.Height := 40;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
SpeedButton1.Glyph.LoadFormFile('c:windows물방울.bmp');
SpeedButton1.NumGlyphs := 4;
end;
end.
이건데여...
에러가 나여..
봐주세용...
또 보게 되는군요. 아!! 이름을 잊어버렸네요. 헐헐~~~
아래 유닛의 에러는 모두 철자를 잘 못써서 난 에러네요..
Undeclared identifier에러가 발생했을땐 제일먼저 철자가 틀렸나 잘 살펴보세요.
^^ 항상 즐코하세요.
이정민 wrote:
> unit Unit1;
>
> interface
>
> uses
> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
> Buttons, StdCtrls, comCtrls;
>
> type
> TForm1 = class(TForm)
> BitBtn1: TBitBtn;
> BitBtn2: TBitBtn;
> BitBtn3: TBitBtn;
> SpeedButton1: TSpeedButton;
> Button1: TButton;
> Button2: TButton;
> procedure FormCreate(Sender: TObject);
> procedure Button1Enter(Sender: TObject);
> procedure Button1Click(Sender: TObject);
> procedure Button2Click(Sender: TObject);
> private
> { Private declarations }
**********************************************************************************
> public // <<<<<<<<<< ButtonCaptions 이것인것 같은데...
> procedure AddButtons(ToolBar:TToolBar;Const ButtonCations:array of String); // <<<<<
> { Public declarations }
> end;
>
> var
> Form1: TForm1;
>
> implementation
>
> {$R *.DFM}
>
**********************************************************************************
// <<<<<<<<<<<<<< 여기도 ButtonCaptions
> procedure TForm1.AddButtons(ToolBar : TToolBar ; Const ButtonCations : array of String); // <<<<<<<<<<<
>
> var
> I : Integer;
> begin
> for I : 0 to High(ButtonCaptions) do // <<<
> begin
> with TToolButton.Create(ToolBar) do
> begin
> parent := ToolBar;
> Caption := ButtonCaptions[I];
> if (ButtonCaptions[I] = '|') then
> Style := tbsSeparator
> else
> Style := tbsButton;
> end;
> end;
> end;
>
>
> procedure TForm1.FormCreate(Sender: TObject);
> begin
> BitBtn1.Kind := bkOK;
> BitBtn2.Kind := bkCancel;
> BitBtn3.Kind := bkHelp;
> end;
>
> procedure TForm1.Button1Enter(Sender: TObject);
> begin
> button1.Cursor := crHandpoint;
> end;
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
> ToolBar : TToolBar;
> begin
**********************************************************************************
// <<<<<< 여긴 TTollBar.Create
> ToolBar := TToolBar.Creatr(Self); //<<<<
> ToolBar.parent := Self;
> AddButtons(ToolBar, [ '새파일','저장','|','자르기','복사하기','붙여넣기']);
> ToolBar.ShowCaptions := True;
> ToolBar.Height := 40;
> end;
>
> procedure TForm1.Button2Click(Sender: TObject);
> begin
**********************************************************************************
// <<<<<<<< 여긴 Glyph.LoadFromFile
> SpeedButton1.Glyph.LoadFormFile('c:windows물방울.bmp'); //<<<<<
> SpeedButton1.NumGlyphs := 4;
> end;
>
> end.
>
> 이건데여...
>
> 에러가 나여..
>
> 봐주세용...