Print Page | Close Window

Flow Graph

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
Printed Date: 16 December 2019 at 12:55am

Topic: Flow Graph
Posted By: lrenoux
Subject: Flow Graph
Date Posted: 14 January 2019 at 5:32am

Codejock version : no matter, the problem is here since the beginning.

It seems there is a lot of problems on size for nodes in FlowGraph control. 

First : 

When saving a node, some weird modifications will be done only on height. 

void CXTPFlowGraphNode::DoCommonPropExchange(CXTPPropExchange* pPX)
// when saving it's required to check, because XTPMeasureMarkupElement
// returns 2px more for the whole markup

CSize szStoredSize = m_szUserSize; -= 2;

Why height and not width ? And i think, because UserSize is saved and not ActualSize, you don't have to do this (see below).

Second :

Take the flowgraph sample, select a node, resize it only on height, you will see that the width will be enlarge by 2 pixels.

Finally :

It seems that the function SetSize on a node enlarge all dimensions given by 2. In memory, we have UserSize + 2 = ActualSize. All calls on this method must be done with UserSize. When a node is serialized, the call to SetSize is made with UserSize but in the resize function (CXTPFlowGraphControl::StartResizeNode) is made with ActualSize.


Posted By: lrenoux
Date Posted: 14 January 2019 at 9:31am
The matter came from the function SetSize which set the size of the element "nodeContent" which is include in an xaml element border with a "BorderThickness" equal to 1. 

ActualSize memorise the size of the markup ("nodeFrame") with border element, UserSize memorise the size of "nodeContent" without element border.

Fichier "FlowGraph\res\Node.xaml"

<Border xmlns='' xmlns:x=''
x:Name='nodeFrame' VerticalAlignment='Center' HorizontalAlignment='Center' Padding='0' BorderThickness='1' BorderBrush='#717171' >
   <StackPanel x:Name='nodeContent' VerticalAlignment='Center' HorizontalAlignment='Center' Background='#DCDCDC'>
      <Border x:Name='nodeCaptionBorder' BorderThickness='1' BorderBrush='#717171' Background='#ACACAC' Padding='20, 0, 20, 0' CanSetColor='True'>
            <Image x:Name='nodeImage' Margin='-20,0,0,0'/><TextBlock x:Name='nodeCaption' FontWeight='Bold' VerticalAlignment='Center' HorizontalAlignment='Center'/>
      <StackPanel x:Name='nodeCustomControl'/>
<StackPanel x:Name='nodeItemsCollection'/>
</StackPanel> <!-- nodeContent -->
</Border> <!-- nodeFrame -->


Print Page | Close Window