Avant:
1. Simulate PLC will be a pretty big project. Not mention the Graphy
task, the tough one will be the simulate Ladder Logic. Maybe you can
simulate a simple logic, but you can not put your code in any situation. Forget it if you want to simulate a complete system.
2. "行程开关" in your case, can only be a TShape. When receive your
touch message, the chart's height will be change to the 'pressed'
status. when release message, it will change back to 'normal' status.
when user "动态放到面板", you can run time create the TShape.
When your “运动块” move, you know, it is user's DUTY to keep the
your “运动块” and the "行程开关" on same line, in order they can
touch each other. Therefore, youdo
something like this:
procedure TForm1.WhenMoverMove(Sender: TObject, x, y: integer);
var i: integer
begin
for i := 0 to ComponentCount -1do
begin
if Component is TShape then
begin
if x, y in Component.Rect then
//touch message, and change the shape
end;
end;
end;
Hope it helpful. Good luck