Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Textformatting (Read 4768 times)
lindborg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 30th, 2008
Textformatting
Jan 30th, 2009 at 2:38pm
Print Post  
I am using a RtfBox for inplace editing. In this rtfbox I can set parts of the text to bold, inlined and so on.

But how can I get this formatting to appear on a shape.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Textformatting
Reply #1 - Jan 30th, 2009 at 4:14pm
Print Post  
Set EnableStyledText for the shape and use html tags to format the text. There are only a few formatting tags supported at this time; check the help file for details.

Stoyan
  
Back to top
 
IP Logged
 
lindborg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 30th, 2008
Re: Textformatting
Reply #2 - Feb 3rd, 2009 at 8:49am
Print Post  
I have set the EnableStyledText . And it worked.

Now I have another problem though,

As I said earlier, I have a RichTextBox as my inplace editor. I have no problem to get the formatted text to appear on the shape but the problem is when I try to edit the formatted text again. Then the formattings is gone


When I debug the Diagram_CreateEditControl even I can see that The richtextbox has the formatting in its RTF property. But no formatting is shown in the inplaceeditor control.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Textformatting
Reply #3 - Feb 3rd, 2009 at 9:10am
Print Post  
Are you directly assigning RichTextBox.Rtf = ShapeNode.Text?

Stoyan
  
Back to top
 
IP Logged
 
lindborg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 30th, 2008
Re: Textformatting
Reply #4 - Feb 3rd, 2009 at 9:29am
Print Post  
I've tried that but then the textbox show the rtf code like

Code
Select All
{\rtf1\ansi\ansicpg1252\deff0\deflang1053{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\b\f0\fs17 Bold\b0  tesst\par
\par
}
 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Textformatting
Reply #5 - Feb 3rd, 2009 at 10:40am
Print Post  
Seems you will have to convert between the Flowchart.NET's HTML formatting tags and the RichtextBox RTF codes when assigning text from the one control to the other.
  
Back to top
 
IP Logged
 
lindborg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 30th, 2008
Re: Textformatting
Reply #6 - Feb 3rd, 2009 at 2:02pm
Print Post  
I am doing that already, the conversion works fine.

I have tested the rtfstring and it validates.

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Textformatting
Reply #7 - Feb 3rd, 2009 at 2:06pm
Print Post  
Are you setting RichTextBox.Text or RichTextBox.Rtf?
  
Back to top
 
IP Logged
 
lindborg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 30th, 2008
Re: Textformatting
Reply #8 - Feb 3rd, 2009 at 2:11pm
Print Post  
This is how my CreateEditControl event looks like

Code
Select All
void Diagram_CreateEditControl(object sender,InPlaceEditEventArgs e) {



if(e.Node is ShapeNode) {

            //editor = new InplaceEditor();
                editor = new RichTextBox();
                e.EditControl = editor;




editor.Click += new EventHandler(Editor_Click);




editor.MouseHover += new EventHandler(Editor_MouseHover);




String text = e.Item.GetTextToEdit();




e.Item.SetEditedText("");




RectangleF docRect = e.Item.GetEditRect(PointF.Empty);




editor.Bounds = diagramView1.DocToClient(docRect);




editor.Visible = true;
                /



    editor.Rtf = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1053{\\fonttbl{\\f0\\fnil\\fcharset0 microsoft sans serif;}{\\f1\\fnil\\fcharset0 Microsoft Sans Serif;}}\r\n{\\colortbl ;\\red0\\green0\\blue0;}\r\n\\viewkind4\\uc1\\pard\\cf1\\b\\f0\\fs10 Bold \\b0\\i italics \\ul\\i0 underlined\\cf0\\ulnone\\f1\\fs17\\par\r\n}\r\n";






editor.ContextMenuStrip = contextMenuStrip2;










Editing = true;



}


} 



When the editcontrol displays the text the formatting is gone.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Textformatting
Reply #9 - Feb 4th, 2009 at 11:18am
Print Post  
This code worked fine in my test, just without the lines that attach event handlers.

Stoyan
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Textformatting
Reply #10 - Jun 10th, 2009 at 11:39pm
Print Post  
Hi guys!
Quote:
I am using a RtfBox for inplace editing. In this rtfbox I can set parts of the text to bold, inlined and so on.


Which editor do you use? RichTextBox? Because if I use it as inplace editor for editing shapes text there is only area for text without any icons or whatever... How do you set bold/italic...? Via code? Maybe im blind and I dont know to use RichTextBox Sad

So how can I edit RTF text without any 3rd part solutions (DevExpress,...) or without using code solution?

Thx.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Textformatting
Reply #11 - Jun 11th, 2009 at 5:01am
Print Post  
Hi,

Check the RichEdit control used in the control-hosting steps in the demo.

Stoyan
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Textformatting
Reply #12 - Jun 11th, 2009 at 6:08am
Print Post  
Hi Stoyo!

But I didnt find any RTF control with panel/buttons which I need. Only that one which I described above. Could you pls state concrete example from demo browser + screen?

Thx.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Textformatting
Reply #13 - Jun 11th, 2009 at 10:54am
Print Post  
There is a user control in RichEdit.cs in the Demo example; it has a toolbar and a rich-edit control inside. You can see it used in the Control Hosting -> Control Diagram page. The toolbar is displayed only when the control is on focus.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Textformatting
Reply #14 - Jun 11th, 2009 at 3:07pm
Print Post  
Hi!

Thx Stoyo, I was checking Samples Smiley Yes I found it in Demo now so thank you.

...MUDO...
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint