- Welcome, Guest. Please Login or Register
MindFusion  
  Version 2 of our Xamarin Calendar component adds Resource view and support for Universal Windows Platform. Now beta testing spreadsheet component for Java Swing. We have released our Java Swing Pack.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Mulitple text on shapes in diagram exports
Read 358 times

Sven   Offline
YaBB Newbies
*
Posts: 4
I Love MindFusion!


   
     
 
Mulitple text on shapes in diagram exports
Jun 9th, 2017 at 9:21am
 
Dear support,

i would like to have some multiple text on shapes. In order of that, I've found the solution "Add icon and additional text to node" in the forum "Flow Diagramming Components Html Canvas & JavaScript".

To my regret, i had to find, that the additional text is only available in the front end but not in the diagram export like image or PDF.
Is there any way to add multiple text to a shape in a c# class without using table nodes? Undecided
 
 

front-end.png (7 KB | 22 )
front-end.png
pdf-export.png (2 KB | 23 )
pdf-export.png
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1141
Gender: male
tech.support


   
     
 
Re: Mulitple text on shapes in diagram exports
Reply #1 - Jun 9th, 2017 at 9:49am
 
Hi Sven,

You will need to custom-draw the texts on server side too where the exporter runs. Before exporting, set the CustomDraw property of ShapeNodes to Additional / Additional2 (first clips to node shape, second does not), add handler for the Diagram.DrawNode event and call IGraphics.DrawString for each additional text you need exported. The PdfGraphics.DrawString implementation will then insert appropriate PDF objects to render text.

Regards,
Slavcho
Mindfusion
 
 
 
IP Logged    
 
     

Sven   Offline
YaBB Newbies
*
Posts: 4
I Love MindFusion!


   
     
 
Re: Mulitple text on shapes in diagram exports
Reply #2 - Jun 9th, 2017 at 10:47am
 
Hi Slavcho,

thanks for your quick help. Now I'm able to add additional text in the export of the diagram.
Unfortunately, I have some difficulties with the bounds of the additional text.
I had tried to use the node bounds, but it doesn't work.

Here is the code that I use to draw the additional text:

        private void Diagram_DrawNode(object sender, DrawNodeEventArgs e)
        {
            if (e.Node.Tag != null && e.Node.Tag.ToString() != "0" && e.Node.Tag.ToString() != "")
            {
                e.Graphics.DrawString(e.Node.Tag.ToString(), e.Node.Font, new SolidBrush(Color.Black), e.Node.Bounds.X, e.Node.Bounds.Y);
            }
        }

In the attachment, there is a screenshot of the exported PDF-file. Do you have any idea how to set the bounds correctly?
 
 

 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1141
Gender: male
tech.support


   
     
 
Re: Mulitple text on shapes in diagram exports
Reply #3 - Jun 9th, 2017 at 10:49am
 
Hi Sven,

Try using GetLocalBounds() instead.

Regards,
Slavcho
 
 
 
IP Logged    
 
     

Sven   Offline
YaBB Newbies
*
Posts: 4
I Love MindFusion!


   
     
 
Re: Mulitple text on shapes in diagram exports
Reply #4 - Jun 9th, 2017 at 12:30pm
 
Hi Slavcho,

i can't access to the GetLocalBounds-method out of the Diagram_DrawNode-event.
Is there any other solution or can you share an example with me how it could be works?
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1141
Gender: male
tech.support


   
     
 
Re: Mulitple text on shapes in diagram exports
Reply #5 - Jun 9th, 2017 at 2:18pm
 
DrawNodeEventArgs.Bounds should be in local coordinates actually, have you tried it?

Regards,
Slavcho
 
 
 
IP Logged    
 
     

Sven   Offline
YaBB Newbies
*
Posts: 4
I Love MindFusion!


   
     
 
Re: Mulitple text on shapes in diagram exports
Reply #6 - Jun 9th, 2017 at 2:26pm
 
Hi Slavcho,

that works for me. Thanks a lot!
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print