herculanojs Posted April 20, 2016 Posted April 20, 2016 Adjusting the Draggable property of components, you can move them on the screen. Would any other property or sample code that allow modify the component size? Similar to example http://delphi.about.com/library/weekly/aa110805a.htm What I want to do, you can move and size the components. procedure TMainForm.NodeMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); const minWidth = 20; minHeight = 20; var newPos: TPoint; frmPoint : TPoint; OldRect: TRect; AdjL,AdjR,AdjT,AdjB: Boolean; begin if FNodePositioning then begin begin with TUniControl(Sender) do begin GetCursorPos(newPos); with FCurrentNodeControl do begin //resize //....................******************************************** Here is where is the problem and can not solve******************************** frmPoint := FCurrentNodeControl.Parent.ScreenToClient(Mouse.CursorPos); OldRect := FCurrentNodeControl.BoundsRect; AdjL := False; AdjR := False; AdjT := False; AdjB := False; case FNodes.IndexOf(TUniControl(Sender)) of 0: begin AdjL := True; AdjT := True; end; 1: begin AdjT := True; end; 2: begin AdjR := True; AdjT := True; end; 3: begin AdjR := True; end; 4: begin AdjR := True; AdjB := True; end; 5: begin AdjB := True; end; 6: begin AdjL := True; AdjB := True; end; 7: begin AdjL := True; end; end; if AdjL then OldRect.Left := frmPoint.X; if AdjR then OldRect.Right := frmPoint.X; if AdjT then OldRect.Top := frmPoint.Y; if AdjB then OldRect.Bottom := frmPoint.Y; SetBounds(OldRect.Left,OldRect.Top,OldRect.Right - OldRect.Left,OldRect.Bottom - OldRect.Top); end; Left := Left - oldPos.X + newPos.X; Top := Top - oldPos.Y + newPos.Y; oldPos := newPos; end; end; PositionNodes(FCurrentNodeControl); end; end; project1.zip src110105.zip Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.