How to set the color of the HighlightText Tool
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
-
- User
- Posts: 93
- Joined: Mon Jul 07, 2008 8:41 am
How to set the color of the HighlightText Tool
Is there a possibility to set the color of the Highlight tool via code. I need to create 4 different buttons, I preffer in the toolbar of the control, with 4 different colors.
- John - Tracker Supp
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
- Contact:
Re: How to set the color of the HighlightText Tool
Hi,
It is possible - but is undocumented.
:
0. Select needed text-fragment in the document:
1. SetProperty("Annots.Defaults.<HighlightType>.SColor", RGB(255,0,0), 0);
<HighlightType>=HightLight | Underline | StrikeOut | Replace;
2. Run command:
DoVerb(NULL, "ExecuteCommand", "<CommandName>", NULL, 0);
<CommandName> = HighlightSelText | UnderlineSelText | CrossOutSelText | ReplaceSelText
Hope that helps
It is possible - but is undocumented.
:
0. Select needed text-fragment in the document:
1. SetProperty("Annots.Defaults.<HighlightType>.SColor", RGB(255,0,0), 0);
<HighlightType>=HightLight | Underline | StrikeOut | Replace;
2. Run command:
DoVerb(NULL, "ExecuteCommand", "<CommandName>", NULL, 0);
<CommandName> = HighlightSelText | UnderlineSelText | CrossOutSelText | ReplaceSelText
Hope that helps
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 93
- Joined: Mon Jul 07, 2008 8:41 am
Re: How to set the color of the HighlightText Tool
I have problems with the RGB(255,0,0) value.
I tried to convert a Color.ToARGB, but that won't work. What do I need to do?
private void SetHighlightColor(Color mColor)
{
axCoPDFXCview1.SetProperty("Annots.Defaults.Highlight.SColor", (mColor.R,mColor.G,mColor.B), 0);
object vDataOut;
axCoPDFXCview1.DoVerb(null,"ExecuteCommand","HightlightSelText",out vDataOut,0);
}
I tried to convert a Color.ToARGB, but that won't work. What do I need to do?
private void SetHighlightColor(Color mColor)
{
axCoPDFXCview1.SetProperty("Annots.Defaults.Highlight.SColor", (mColor.R,mColor.G,mColor.B), 0);
object vDataOut;
axCoPDFXCview1.DoVerb(null,"ExecuteCommand","HightlightSelText",out vDataOut,0);
}
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2352
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: How to set the color of the HighlightText Tool
The correct example:
Color Clr = Color.FromArgb(0, 0, 255); // blue
try
{
axCoPDFXCview1.SetProperty("Annots.Defaults.Hightlight.SColor", System.Drawing.ColorTranslator.ToWin32(Clr), 0);
object vDataOut;
axCoPDFXCview1.DoVerb(null, "ExecuteCommand", "HighlightSelText", out vDataOut, 0);
}
catch (Exception ex)
{
//..
}
NOTE: the selected 't' character in 'Hightlight' fragment of the property name will be removed in the future (in next build) - it is our mistake, should be 'Highlight'.
You should check it before use for next build.
Color Clr = Color.FromArgb(0, 0, 255); // blue
try
{
axCoPDFXCview1.SetProperty("Annots.Defaults.Hightlight.SColor", System.Drawing.ColorTranslator.ToWin32(Clr), 0);
object vDataOut;
axCoPDFXCview1.DoVerb(null, "ExecuteCommand", "HighlightSelText", out vDataOut, 0);
}
catch (Exception ex)
{
//..
}
NOTE: the selected 't' character in 'Hightlight' fragment of the property name will be removed in the future (in next build) - it is our mistake, should be 'Highlight'.
You should check it before use for next build.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 93
- Joined: Mon Jul 07, 2008 8:41 am
Re: How to set the color of the HighlightText Tool
It works great!!!
-
- User
- Posts: 93
- Joined: Mon Jul 07, 2008 8:41 am
Re: How to set the color of the HighlightText Tool
Hey guys,
Is there an extensive reference for the stuff we can do with the SetProperty command on the activeX control?
Need to set the color of the pencil tool, but can't find which verb to use.
Checked the documentation that came with the SDK, but that did not list it.
cheers
Is there an extensive reference for the stuff we can do with the SetProperty command on the activeX control?
Need to set the color of the pencil tool, but can't find which verb to use.
Checked the documentation that came with the SDK, but that did not list it.
cheers
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2352
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: How to set the color of the HighlightText Tool
This possibility (changing color of the pencil tool), and others, will be added in the nearest future.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 93
- Joined: Mon Jul 07, 2008 8:41 am
-
- User
- Posts: 223
- Joined: Wed Aug 22, 2007 4:40 pm
Re: How to set the color of the HighlightText Tool
I have a couple of questions about this.Vasyl-Tracker Dev Team wrote:This possibility (changing color of the pencil tool), and others, will be added in the nearest future.
1) Can this be used to set the default properties for annotations, or only to modify existing text/annotations?
2) Have any more of these been added, and is it the plan that they will remain undocumented, or will they be added to the documentation in the future?
Thanks.
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2352
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: How to set the color of the HighlightText Tool
In nearest future you will be able to edit default properties of annots, like as:1) Can this be used to set the default properties for annotations, or only to modify existing text/annotations?
// edit/get specified style for line-annot:
SetProperty("Commenting.Line.Styles[0].SColor", "yellow", 0);
SetProperty("Commenting.Line.Styles[0].Opacity", 0.75, 0);
// get ID of this line-style
GetProperty("Commenting.Line.Styles[0].ID", LineStyleID, 0);
// select this style to line-tool:
SetProperty("Tool.Line.Style", LineStyleID, 0);
-and more others.
Also you will be able to edit existing annots, like as:
SetProperty("Documents[0].Pages[0].Annots[2].SColor", "red", 0);
SetProperty("Documents[0].Pages[0].Annots[2].Opacity", 0.75, 0);
// get annot type:
GetProperty("Documents[0].Pages[0].Annots[2].Type", AnnotType, 0);
// after call AnnotType="Line", for example
These features are still undocumented because we still working on it. We will update documentation when we finish work on it.2) Have any more of these been added, and is it the plan that they will remain undocumented, or will they be added to the documentation in the future?
Also earlier code you should change to:
Color Clr = Color.FromArgb(0, 0, 255); // blue
try
{
axCoPDFXCview1.SetProperty("Commenting.Highlight.Styles[0].SColor", System.Drawing.ColorTranslator.ToWin32(Clr), 0);
object vDataOut;
axCoPDFXCview1.DoVerb(null, "ExecuteCommand", "HighlightSelText", out vDataOut, 0);
}
catch (Exception ex)
{
//..
}
Note: this code will work properly if "Commenting.Highlight.Styles[0].ID" == "Tools.Highlight.Style"
For simplify, you can use new method for highlight selected text - look to AX help, "Objects::Documents::<Item>.HighlightSelection" section.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.