/// <summary>
/// Methods directly produces DXF string for text of the Flowchart object
/// </summary>
/// <param name="TextID">Id of the text tag</param>
/// <param name="rect">Text's rectangle</param>
/// <param name="sText">Text string</param>
/// <param name="crText">Text color</param>
/// <param name="fnText">Text font</param>
/// <param name="sft">Text format</param>
/// <param name="Multiline">true if text is multi-lined</param>
/// <param name="RA">Rotation angle of the text</param>
/// <param name="IsArrowText">true if text is on arrow ( not used )</param>
/// <returns>true if succesfull otherwise false</returns>
public bool AddText(long TextID, RectangleF rect, string sText, Color crText, Font fnText, StringFormat sft, bool Multiline, float RA, bool IsArrowText)
{
string sResult = "";
if ( sText == "" )
return false;
if ( sText == null )
return false;
if ( fnText == null )
fnText = m_FlowChart.Font;
try
{
if (IsArrowText)
sft.FormatFlags = StringFormatFlags.FitBlackBox;
if ( Multiline ) // If the is 'Multylined' producing MTEXT DXF output
{
sText = sText.Replace("\n"," ");
sText = sText.Replace("\r"," ");
/* USE IF YOU WANT TO SEE TEXT AREA AS RED FRAME
AddRect(rect, TextID, Color.Red, Color.Transparent, Color.Transparent,DashStyle.Solid,
"", null, null);
*/
sResult = String.Format(provider, "0\nMTEXT\n 100\nAcDbEntity\n{0:HAN} 8\n{15}\n 62\n{0:ACI}\n 100\nAcDbMText\n 10\n{1:U}\n 20\n{2:U}\n 40\n{10:U}\n 41\n{3:U}\n 71\n{4:SAL}\n 72\n{5}\n 1\n{6}{7:ATEXT}{8}{9}\n 7\n{14}\n 42\n{11:U}\n 43\n{12:U}\n 50\n{13}\n",
crText, rect.Left + ((sft.Alignment==StringAlignment.Center) ? rect.Width/2 : 0f) , m_FlowChart.DocExtents.Height - ( rect.Top + rect.Height/2) , rect.Width , sft, "1" , "" , fnText , sText, "" , fnText.Size*0.6, rect.Width/2 , rect.Height/2, (-1)*RA , "Standard", TEXT_LAYER);
}
else // If the is not 'Multylined' producing TEXT DXF output
sResult = String.Format(provider, "0\nTEXT\n 100\nAcDbEntity\n{0:HAN} 8\n{15}\n 62\n{0:ACI}\n 100\nAcDbText\n 10\n{1:U}\n 20\n{2:U}\n 40\n{10:U}\n 71\n{4}\n 1\n{6}{7:ATEXT}{8}{9}\n 41\n0.6\n 7\n{14}\n 50\n{13}\n 72\n{5}\n 11\n{1:U}\n 21\n{2:U}\n 100\nAcDbText\n 73\n{18}\n",
crText,
(RA!=0) ? (rect.Left + rect.Width/4) : (rect.Left),
m_FlowChart.DocExtents.Height - rect.Top,
rect.Width,
"0",
(RA!=0) ? "1" : "0",
"" ,
fnText ,
sText,
"" , fnText.Size, rect.Width, rect.Height, RA , "Standard", TEXT_LAYER, rect.Left + rect.Width,
m_FlowChart.DocExtents.Height - ( rect.Top + rect.Height),
(RA!=0) ? "1" : "2");
Trace.WriteLine(String.Format("{0}:{1}", sText, rect.ToString()));
AddEntity(String.Format("TEXT{0:X5}", TextID),sResult);
}
catch ( Exception ex)
{
Trace.WriteLine(String.Format("{0} error {1}\n","AddText",ex.Message));
return false;
}
return true;
}