|
Shape 컨트롤이 100개 정도 있습니다. MouseDown 이벤트를 통해서 각각 색을 변경하려고 하는대요.
(Shape은 OnClick 이벤트가 없네요..ㅡㅡ)
각각 코딩을 하지 않고 참조해서 쓰는 방법이 어찌 되는지 알려주세요.
참고로 델파이 로직은 아래와 같습니다.
procedure TForm1.Shape_01MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
if TShape(Sender).Brush.Color = clRed then
begin
TShape(Sender).Brush.Color := clLime;
end
else
begin
TShape(Sender).Brush.Color := clRed;
end;
이걸 참조해서 Shape_02에 사용하믄 색이 바끼네요.
이 방식대로 C++로 코딩하믄 에러 발생하네요.ㅎ
|