Zu B habe ich teils eine Lösung gefunden:
Delphi-Quellcode:
procedure TMain.TimerTimer(Sender: TObject);
PROCEDURE SelectedRepaint;
BEGIN
Sleep(15);
IF DesignPanel.Surface.Count > 1
THEN DesignPanel.Surface.SelectionChange
ELSE DesignPanel.Surface.Select(DesignPanel.Surface.Selection[0]);
LoadObjectSettings;
END;
begin
IF (GetKeyState(VK_CONTROL) < 0)
THEN BEGIN
IF GetasyncKeyState(VK_LEFT)<>0
THEN DesignPanel.Surface.NudgeComponents(-1,0); // verschieben
IF GetasyncKeyState(VK_UP)<>0
THEN DesignPanel.Surface.NudgeComponents(0,-1);
IF GetasyncKeyState(VK_RIGHT)<>0
THEN DesignPanel.Surface.NudgeComponents(+1,0);
IF GetasyncKeyState(VK_DOWN)<>0
THEN DesignPanel.Surface.NudgeComponents(0,+1);
IF (GetasyncKeyState(VK_LEFT)<>0) OR (GetasyncKeyState(VK_UP)<>0)
OR (GetasyncKeyState(VK_RIGHT)<>0) OR (GetasyncKeyState(VK_DOWN)<>0)
THEN SelectedRepaint;
END;
IF (GetKeyState(VK_SHIFT) < 0)
THEN BEGIN
IF GetasyncKeyState(VK_LEFT)<>0
THEN DesignPanel.Surface.GrowComponents(-1,0); // vergrößern/verkleinern
IF GetasyncKeyState(VK_UP)<>0
THEN DesignPanel.Surface.GrowComponents(0,-1);
IF GetasyncKeyState(VK_RIGHT)<>0
THEN DesignPanel.Surface.GrowComponents(+1,0);
IF GetasyncKeyState(VK_DOWN)<>0
THEN DesignPanel.Surface.GrowComponents(0,+1);
IF (GetasyncKeyState(VK_LEFT)<>0) OR (GetasyncKeyState(VK_UP)<>0)
OR (GetasyncKeyState(VK_RIGHT)<>0) OR (GetasyncKeyState(VK_DOWN)<>0)
THEN SelectedRepaint;
END;
IF ((GetKeyState(VK_CONTROL) < 0) OR (GetKeyState(VK_SHIFT) < 0)) AND (DesignPanel.Surface.Count = 1)
THEN BEGIN
DesignPanel.Repaint;
IF DesignPanel.Surface.Selection[0].Left = 8 // linke Kante
THEN BEGIN
DesignPanel.Canvas.MoveTo(0,DesignPanel.Surface.Selection[0].Top+(DesignPanel.Surface.Selection[0].Height DIV 2));
DesignPanel.Canvas.LineTo(5,DesignPanel.Surface.Selection[0].Top+(DesignPanel.Surface.Selection[0].Height DIV 2));
END;
IF DesignPanel.Surface.Selection[0].Top = 8 // obere Kante
THEN BEGIN
DesignPanel.Canvas.MoveTo(DesignPanel.Surface.Selection[0].Left+(DesignPanel.Surface.Selection[0].Width DIV 2),0);
DesignPanel.Canvas.LineTo(DesignPanel.Surface.Selection[0].Left+(DesignPanel.Surface.Selection[0].Width DIV 2),5);
END;
END;
end;
Leider musste ich dabei einen Timer benutzen (Inteval:50)
Es fehlen nun noch die weißen Abstandslinien zwischen den Komponenten und die langen hellgrauen Orientierungslinien.
Da werde ich wohl mit einer Schleife arbeiten müssen...