Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Flow Graph
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Flow Graph

 Post Reply Post Reply
Author
Message
lrenoux View Drop Down
Groupie
Groupie


Joined: 20 April 2009
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote lrenoux Quote  Post ReplyReply Direct Link To This Post Topic: Flow Graph
    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.
Back to Top
lrenoux View Drop Down
Groupie
Groupie


Joined: 20 April 2009
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote lrenoux Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.