Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Ratio of diagram.bounds VS diagramView.width/ diagramView.height (imagemap) (Read 9129 times)
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Ratio of diagram.bounds VS diagramView.width/ diagramView.height (imagemap)
Dec 21st, 2012 at 2:57pm
Print Post  
Hi,

In imagemap mode I'm wondering what exactly is the ratio between diagram.bounds vs diagramView.width and diagramView.height.

Currently my diagram bounds are:
Code
Select All
diagram.Bounds = new System.Drawing.RectangleF(0, 0, diagramWidth, diagramHeight);

 /// <summary>
    /// height of the diagram
    /// </summary>
    int _diagramHeight = 400;
    int diagramHeight
    {
        get
        {
            return _diagramHeight;
        }
        set
        {
            _diagramHeight = value;
        }
    }

    /// <summary>
    /// width of the diagram
    /// </summary>
    int _diagramWidth = 230;
    int diagramWidth
    {
        get
        {
            return _diagramWidth;
        }
        set
        {
            _diagramWidth = value;
        }
    }

 



My diagramView.Width and diagramView.Height are:

Code
Select All
// set diagramView height / width // COMMENT IF NECESSARY MOVE TO createShapesAndLanes() later
        diagramView.Height = 759;
        diagramView.Width = 869; 



This achieves the perfect ratio so that there are no gaps and the diagramview is compact with the diagram.

What I'm later on trying to achieve is the perfect ratio so that in case the screen is resized to a different resolution (say 800x600), I can accordingly resize the diagramView and diagram.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Ratio of diagram.bounds VS diagramView.width/ diagramView.height (imagemap)
Reply #1 - Dec 21st, 2012 at 9:05pm
Print Post  
You can call DiagramView.ClientToDoc to convert from pixels to diagram's MeasureUnit, and assign the result to diagram.Bounds if you need to set it to the view's size.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Ratio of diagram.bounds VS diagramView.width/ diagramView.height (imagemap)
Reply #2 - Dec 30th, 2012 at 9:23pm
Print Post  
what do i put in the arguments
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Ratio of diagram.bounds VS diagramView.width/ diagramView.height (imagemap)
Reply #3 - Dec 30th, 2012 at 9:27pm
Print Post  
cant figure out about ClientRectangle
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Ratio of diagram.bounds VS diagramView.width/ diagramView.height (imagemap)
Reply #4 - Dec 31st, 2012 at 9:49am
Print Post  
clientRectangle should contain the coordinates in pixels you need converted to diagram's measure unit. E.g. if you need to make the diagram's logical area exactly as big as the view, using the values from your example:

Code
Select All
diagram.Bounds = diagramView.ClientToDoc(new Rectangle(0, 0, 869, 759)); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint