Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, September 12, 2012 2:33:54 PM(UTC)
TEngberg

Groups: Registered
Posts: 9


I tried the following but it did not work

Private Sub AnnRichTextObject_AddRichTextObject(ByVal container As AnnContainer, ByVal rtfText As String)
Dim richText As New AnnRichTextObject()
richText.Font = New AnnFont("Arial", New AnnLength(48, AnnUnit.Point), FontStyle.Regular)
richText.NameFont = New AnnFont("Arial", New AnnLength(48, AnnUnit.Point), FontStyle.Regular)
richText.TextColor = Color.Red
richText.Bounds = New AnnRectangle(100, 100, 400, 100)
richText.Rtf = rtfText
container.Objects.Add(richText)
End Sub
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, September 13, 2012 6:35:38 AM(UTC)

mohamed  
mohamed

Groups: Registered, Tech Support
Posts: 179


The Rtf property itself contains both the text and its formatting codes, including font properties like size and color.
If you want to change the font size, you must parse the rich text (RTF) and modify the font attributes.

For details about RTF formatting codes, see "rich text format (RTF) Specification, version 1.6" in the MSDN library.

I think \fs<number> is used for font size manipulation, but you should consult the specs for full details.

Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Friday, September 14, 2012 9:09:13 AM(UTC)
TEngberg

Groups: Registered
Posts: 9


I'm not sure I follow what your suggesting?


I'm actually trying to change the AnnAutomation Object Rich Text Default Font like the following (The Rich Text AnnObject 10 point default is too small in my Application):


LTmanager.CreateDefaultObjects()
Dim LTannobj As AnnAutomationObject
For idx As Integer = LTmanager.Objects.Count - 1 To 0 Step -1
LTannobj = LTmanager.Objects.Item(idx)
...
If LTannobj.Id = AnnAutomationManager.RichTextObjectId Then
LTannobj.Object.Font = New AnnFont("Arial", New AnnLength(36, AnnUnit.Point), FontStyle.Regular)
End If
...
Next


Do I need to Create a custom Automation Rich Text Object, or can I modify the LTannObj richTextDrawDesigner.DefaultRtf???


The following example is the closest thing I found in Leadtools Documentation to what your suggesting. I could use this to create a Custom Ann Object, but I would prefer to just modify the Automation objects rich Text Draw Designer "DefaultRtf" if possible???


Public Function AnnRichTextDrawDesigner_AnnRichTextDrawDesigner(ByVal viewer As RasterImageViewer, ByVal container As AnnContainer) As AnnRichTextDrawDesigner
' start a new rich text draw designer
Dim richTextDrawDesigner As New AnnRichTextDrawDesigner()
' set up the object template (the rich text object)
Dim richTextObject As New AnnRichTextObject()
richTextObject.Pen = Nothing
richTextObject.Brush = Nothing

' set up the default text to be used
' This is RTF text that is equals to LEADTOOLS in bold red Arial
richTextDrawDesigner.DefaultRtf = _
"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}" + _
"{\f1\fnil\fcharset0 Microsoft Sans Serif;}}{\colortbl ;\red255\green0\blue0;}" + _
"\viewkind4\uc1\pard\cf1\lang9\b\i\fs22 LEADTOOLS\cf0\lang1033\b0\i0\f1\fs17\par}"

' initialize the rest of the designer
richTextDrawDesigner.ObjectTemplate = richTextObject
richTextDrawDesigner.Owner = viewer
richTextDrawDesigner.ClipCursor = True
richTextDrawDesigner.Container = container

Return richTextDrawDesigner
End Function


 
#4 Posted : Friday, September 14, 2012 10:11:53 AM(UTC)
TEngberg

Groups: Registered
Posts: 9


One other Thing about the Rich Text Annotaiton Object.

There are options for Bullets and Numbering but I don't see how to add a second bullet or number.

If I hit enter to end a line it just closes the editor. I don't see how to insert or start a new line therefore how can you add a second bulllet or number into the text box?

I may just remove it from the Annotation List as it doesn't look like it is ready in the 17.5 that I have install which was just released in August 2012.

 
#5 Posted : Monday, September 17, 2012 12:12:39 AM(UTC)

mohamed  
mohamed

Groups: Registered, Tech Support
Posts: 179


You don't need to create a custom object to change the default.

You can change it by calling the following code after AutomationManager.CreateDefaultObjects():

================================

For Each o As AnnAutomationObject In _automationManager.Objects
If o IsNot Nothing Then
If TypeOf (o.Object) Is AnnRichTextObject Then
CType(o.Object, AnnRichTextObject).Rtf = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}" + _
"{\f1\fnil\fcharset0 Microsoft Sans Serif;}}{\colortbl ;\red255\green0\blue0;}" + _
"\viewkind4\uc1\pard\cf1\lang9\b\i\fs22 LEADTOOLS\cf0\lang1033\b0\i0\f1\fs17\par}"
End If
End If
Next
================================

About inserting a new line while editing, you do that by pressing Ctrl+Enter.
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.183 seconds.