delphi Sender 및 Tag 사용 방법
20866 단어 Delphi
var
Form1: TForm1;
SelectedColor:TColor;//clBlack; //Default
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
SelectedColor:=clBlack; //Default
end;
// OnClick
//OnClick
procedure TForm1.img11Click(Sender: TObject);
begin
if TImage(Sender)=img1 then SelectedColor:=clBlack;
if TImage(Sender)=img2 then SelectedColor:=$00002AA5;
if TImage(Sender)=img3 then SelectedColor:=$00404000;
if TImage(Sender)=img4 then SelectedColor:=$00005500;
if TImage(Sender)=img5 then SelectedColor:=$005E0000;
if TImage(Sender)=img6 then SelectedColor:=clNavy;
if TImage(Sender)=img7 then SelectedColor:=$00993333;
if TImage(Sender)=img8 then SelectedColor:=$00282828;
if TImage(Sender)=img9 then SelectedColor:=$0000008B;
if TImage(Sender)=img10 then SelectedColor:=$002068FF;
if TImage(Sender)=img11 then SelectedColor:=$00008B8B;
if TImage(Sender)=img12 then SelectedColor:=$00009300;
if TImage(Sender)=img13 then SelectedColor:=$008E8E38;
if TImage(Sender)=img14 then SelectedColor:=clBlue;
if TImage(Sender)=img15 then SelectedColor:=$00996666;
if TImage(Sender)=img16 then SelectedColor:=$00666666;
if TImage(Sender)=img17 then SelectedColor:=clRed;
if TImage(Sender)=img18 then SelectedColor:=$005BADFF;
if TImage(Sender)=img19 then SelectedColor:=$0032CD32;
if TImage(Sender)=img20 then SelectedColor:=$0071B33C;
if TImage(Sender)=img21 then SelectedColor:=$00D4FF7F;
if TImage(Sender)=img22 then SelectedColor:=$00FF6633;
if TImage(Sender)=img23 then SelectedColor:=clPurple;
if TImage(Sender)=img24 then SelectedColor:=$007F7F7F;
if TImage(Sender)=img25 then SelectedColor:=clFuchsia;
if TImage(Sender)=img26 then SelectedColor:=$0000D7FF;
if TImage(Sender)=img27 then SelectedColor:=clYellow;
if TImage(Sender)=img28 then SelectedColor:=clLime;
if TImage(Sender)=img29 then SelectedColor:=$00D0E040;
if TImage(Sender)=img30 then SelectedColor:=$00FFFFC0;
if TImage(Sender)=img31 then SelectedColor:=$00663399;
if TImage(Sender)=img32 then SelectedColor:=clSilver;
if TImage(Sender)=img33 then SelectedColor:=$00CC99FF;
if TImage(Sender)=img34 then SelectedColor:=$008CB4D2;
if TImage(Sender)=img35 then SelectedColor:=$0099FFFF;
if TImage(Sender)=img36 then SelectedColor:=$0098FB98;
if TImage(Sender)=img37 then SelectedColor:=$00EEEEAF;
if TImage(Sender)=img38 then SelectedColor:=$00FFCC00;
if TImage(Sender)=img39 then SelectedColor:=$00FF99CC;
if TImage(Sender)=img40 then SelectedColor:=clWhite;
//Test
Label1.Color:=SelectedColor;
end;
//OnMouseMove
//
procedure TForm1.img11MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
img_frame.Visible:=True;
img_frame.Visible:=True;
case TImage(Sender).Tag of
1:
begin
img_frame.Left:= img1.Left;
img_frame.Top := img1.Top;
end;
2:
begin
img_frame.Left:= img2.Left;
img_frame.Top := img2.Top;
end;
3:
begin
img_frame.Left:= img3.Left;
img_frame.Top := img3.Top;
end;
4:
begin
img_frame.Left:= img4.Left;
img_frame.Top := img4.Top;
end;
5:
begin
img_frame.Left:= img5.Left;
img_frame.Top := img5.Top;
end;
6:
begin
img_frame.Left:= img6.Left;
img_frame.Top := img6.Top;
end;
7:
begin
img_frame.Left:= img7.Left;
img_frame.Top := img7.Top;
end;
8:
begin
img_frame.Left:= img8.Left;
img_frame.Top := img8.Top;
end;
9:
begin
img_frame.Left:= img9.Left;
img_frame.Top := img9.Top;
end;
10:
begin
img_frame.Left:= img10.Left;
img_frame.Top := img10.Top;
end;
11:
begin
img_frame.Left:= img11.Left;
img_frame.Top := img11.Top;
end;
12:
begin
img_frame.Left:= img12.Left;
img_frame.Top := img12.Top;
end;
13:
begin
img_frame.Left:= img13.Left;
img_frame.Top := img13.Top;
end;
14:
begin
img_frame.Left:= img14.Left;
img_frame.Top := img14.Top;
end;
15:
begin
img_frame.Left:= img15.Left;
img_frame.Top := img15.Top;
end;
16:
begin
img_frame.Left:= img16.Left;
img_frame.Top := img16.Top;
end;
17:
begin
img_frame.Left:= img17.Left;
img_frame.Top := img17.Top;
end;
18:
begin
img_frame.Left:= img18.Left;
img_frame.Top := img18.Top;
end;
19:
begin
img_frame.Left:= img19.Left;
img_frame.Top := img19.Top;
end;
20:
begin
img_frame.Left:= img20.Left;
img_frame.Top := img20.Top;
end;
21:
begin
img_frame.Left:= img21.Left;
img_frame.Top := img21.Top;
end;
22:
begin
img_frame.Left:= img22.Left;
img_frame.Top := img22.Top;
end;
23:
begin
img_frame.Left:= img23.Left;
img_frame.Top := img23.Top;
end;
24:
begin
img_frame.Left:= img24.Left;
img_frame.Top := img24.Top;
end;
25:
begin
img_frame.Left:= img25.Left;
img_frame.Top := img25.Top;
end;
26:
begin
img_frame.Left:= img26.Left;
img_frame.Top := img26.Top;
end;
27:
begin
img_frame.Left:= img27.Left;
img_frame.Top := img27.Top;
end;
28:
begin
img_frame.Left:= img28.Left;
img_frame.Top := img28.Top;
end;
29:
begin
img_frame.Left:= img29.Left;
img_frame.Top := img29.Top;
end;
30:
begin
img_frame.Left:= img30.Left;
img_frame.Top := img30.Top;
end;
31:
begin
img_frame.Left:= img31.Left;
img_frame.Top := img31.Top;
end;
32:
begin
img_frame.Left:= img32.Left;
img_frame.Top := img32.Top;
end;
33:
begin
img_frame.Left:= img33.Left;
img_frame.Top := img33.Top;
end;
34:
begin
img_frame.Left:= img34.Left;
img_frame.Top := img34.Top;
end;
35:
begin
img_frame.Left:= img35.Left;
img_frame.Top := img35.Top;
end;
36:
begin
img_frame.Left:= img36.Left;
img_frame.Top := img36.Top;
end;
37:
begin
img_frame.Left:= img37.Left;
img_frame.Top := img37.Top;
end;
38:
begin
img_frame.Left:= img38.Left;
img_frame.Top := img38.Top;
end;
39:
begin
img_frame.Left:= img39.Left;
img_frame.Top := img39.Top;
end;
40:
begin
img_frame.Left:= img40.Left;
img_frame.Top := img40.Top;
end;
end;
end;
Wiz
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[Delphi] TStringBuilder그리고 꼭 사용해야만 할까? 그림처럼 Heap 영역에 "Hello" 공간을 생성하고 포인팅을 한다. "Hello World" 공간을 새로 생성한 후 포인팅을 하게 된다. 결국 "Hello" 라는 String 객체가 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.