Einzelnen Beitrag anzeigen

Benutzerbild von geskill
geskill

Registriert seit: 17. Feb 2007
Ort: NRW
420 Beiträge
 
Delphi 2010 Professional
 
#3

Re: JvDesignPanel Component Editor

  Alt 3. Aug 2008, 18:21
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...
Sebastian
  Mit Zitat antworten Zitat