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
URL: http://forum.codejock.com/forum_posts.asp?TID=23795
Printed Date: 12 December 2024 at 8:16am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


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

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;
szStoredSize.cy -= 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.


L.



Replies:
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='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
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'>
         <WrapPanel>
            <Image x:Name='nodeImage' Margin='-20,0,0,0'/><TextBlock x:Name='nodeCaption' FontWeight='Bold' VerticalAlignment='Center' HorizontalAlignment='Center'/>
         </WrapPanel>
      </Border>
      <StackPanel x:Name='nodeCustomControl'/>
<StackPanel x:Name='nodeItemsCollection'/>
</StackPanel> <!-- nodeContent -->
</Border> <!-- nodeFrame -->

L.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net