Click here to Skip to main content
16,011,608 members
Home / Discussions / C#
   

C#

 
AnswerRe: Location Translation Logic Pin
V.5-Aug-11 1:34
professionalV.5-Aug-11 1:34 
GeneralRe: Location Translation Logic Pin
cjb1105-Aug-11 1:40
cjb1105-Aug-11 1:40 
GeneralRe: Location Translation Logic Pin
V.5-Aug-11 1:46
professionalV.5-Aug-11 1:46 
GeneralRe: Location Translation Logic Pin
cjb1105-Aug-11 2:02
cjb1105-Aug-11 2:02 
GeneralRe: Location Translation Logic Pin
V.5-Aug-11 2:11
professionalV.5-Aug-11 2:11 
GeneralRe: Location Translation Logic Pin
cjb1105-Aug-11 2:19
cjb1105-Aug-11 2:19 
GeneralRe: Location Translation Logic Pin
V.5-Aug-11 2:25
professionalV.5-Aug-11 2:25 
GeneralRe: Location Translation Logic Pin
cjb1106-Aug-11 0:29
cjb1106-Aug-11 0:29 
I think its working with this (I forgot to grab the exact same data I was having problems with)

C#
//fit arranged nodes onto panel
List<NodeUI> newNodeUIs = new List<NodeUI>(NodeUIs.Capacity);
int minX = (nodeLayouts.Min(l => l.Location.X) * -1) + 50;
int minY = (nodeLayouts.Min(l => l.Location.Y) * -1) + 50;
for (int i = 0; i < this.NodeUIs.Count; i++)
{
    NodeUI nodeUI = FindNodeUI(nodeLayouts[i].Node);
    Point loc = nodeLayouts[i].Location;
    loc.X += minX;
    loc.Y += minY;
    nodeUI.Location = loc;
    newNodeUIs.Add(nodeUI);
}
panelGraph.Controls.Clear();
panelGraph.Controls.AddRange(newNodeUIs.ToArray());
panelGraph.ClientSize = GetNodeLayoutBounds(nodeLayouts).Size;


NodeLayouts is not the array of controls, but a struct with their original positions in, the layout algorithm works on that instead. But I think it was using the min of the locations rather than the bounds to do the offset that worked.

Thanks again for your help!
GeneralRe: Location Translation Logic Pin
V.6-Aug-11 0:50
professionalV.6-Aug-11 0:50 
AnswerRe: Location Translation Logic Pin
BillWoodruff6-Aug-11 9:12
professionalBillWoodruff6-Aug-11 9:12 
QuestionSomething for beginners Pin
Qlex4-Aug-11 22:39
Qlex4-Aug-11 22:39 
AnswerRe: Something for beginners Pin
Blue_Boy4-Aug-11 22:59
Blue_Boy4-Aug-11 22:59 
AnswerRe: Something for beginners Pin
Richard MacCutchan4-Aug-11 23:09
mveRichard MacCutchan4-Aug-11 23:09 
GeneralRe: Something for beginners Pin
Qlex4-Aug-11 23:53
Qlex4-Aug-11 23:53 
GeneralRe: Something for beginners Pin
Richard MacCutchan4-Aug-11 23:57
mveRichard MacCutchan4-Aug-11 23:57 
GeneralRe: Something for beginners Pin
Qlex5-Aug-11 0:22
Qlex5-Aug-11 0:22 
GeneralRe: Something for beginners Pin
Richard MacCutchan5-Aug-11 3:31
mveRichard MacCutchan5-Aug-11 3:31 
AnswerRe: Something for beginners Pin
V.5-Aug-11 3:01
professionalV.5-Aug-11 3:01 
GeneralRe: Something for beginners Pin
Qlex5-Aug-11 3:08
Qlex5-Aug-11 3:08 
GeneralRe: Something for beginners Pin
V.5-Aug-11 3:18
professionalV.5-Aug-11 3:18 
AnswerRe: Something for beginners Pin
Eddy Vluggen5-Aug-11 6:19
professionalEddy Vluggen5-Aug-11 6:19 
GeneralRe: Something for beginners Pin
Qlex7-Aug-11 20:32
Qlex7-Aug-11 20:32 
AnswerRe: Something for beginners Pin
jschell5-Aug-11 11:47
jschell5-Aug-11 11:47 
GeneralRe: Something for beginners Pin
Qlex7-Aug-11 20:37
Qlex7-Aug-11 20:37 
AnswerRe: Something for beginners Pin
BillWoodruff6-Aug-11 8:39
professionalBillWoodruff6-Aug-11 8:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.