Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Mulitple text on shapes in diagram exports (Read 4242 times)
Sven
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jun 8th, 2017
Mulitple text on shapes in diagram exports
Jun 9th, 2017 at 8:21am
Print Post  
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 | 158 Downloads )
front-end.png
pdf-export.png ( 2 KB | 146 Downloads )
pdf-export.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Mulitple text on shapes in diagram exports
Reply #1 - Jun 9th, 2017 at 8:49am
Print Post  
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
  
Back to top
 
IP Logged
 
Sven
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jun 8th, 2017
Re: Mulitple text on shapes in diagram exports
Reply #2 - Jun 9th, 2017 at 9:47am
Print Post  
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?
  

pdf-export2_pdf.png ( 2 KB | 151 Downloads )
pdf-export2_pdf.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Mulitple text on shapes in diagram exports
Reply #3 - Jun 9th, 2017 at 9:49am
Print Post  
Hi Sven,

Try using GetLocalBounds() instead.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Sven
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jun 8th, 2017
Re: Mulitple text on shapes in diagram exports
Reply #4 - Jun 9th, 2017 at 11:30am
Print Post  
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?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Mulitple text on shapes in diagram exports
Reply #5 - Jun 9th, 2017 at 1:18pm
Print Post  
DrawNodeEventArgs.Bounds should be in local coordinates actually, have you tried it?

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Sven
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jun 8th, 2017
Re: Mulitple text on shapes in diagram exports
Reply #6 - Jun 9th, 2017 at 1:26pm
Print Post  
Hi Slavcho,

that works for me. Thanks a lot!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint