Guest User

Untitled

a guest
Apr 23rd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. // Sender 사용
  2. 1)
  3. if Sender is TButton then //확인
  4. begin
  5. (Sender as TButton).Caption := 'BUTTON'; //사용1 런타임에 동적으로 타입캐스팅 , 에러 검증 가능
  6. TButton(Sender).Caption := 'BUTTON'; //사용2 컴파일 타임에 타입캐스팅 , 검증 X , 이론상 더 빠름
  7. end;
  8.  
  9. 2)
  10. IF SENDER = BTN1 THEN BEGIN //컴퍼넌트 이름이 BTN1 일때만 실행
  11.  
  12. 3)
  13. //TForm 클래스를 이용하면 폼안에 있는 모든 컴포넌트들에 사용가능
  14. TForm1(Sender).Tag;
  15. TForm1(Sender).name;
  16. TForm1(Sender).hint;
  17.  
  18. 4)
  19. procedure .... ;
  20. var
  21. Grid: TcxgGrid absolute Sender; // absolute는 원래 변수를 선언할 때 변수가 다른 변수와 같은 메모리를 사용하도록 할 때 사용
  22. begin
  23. Grid.Canvas.Brush.Color := clRed;
  24. end;
Add Comment
Please, Sign In to add comment