Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Started by JoeBussell at 08-13-2008 15:11. Topic has 8 replies.

Print Search « Previous Thread Next Thread »
  08-13-2008, 15:11
JoeBussell is not online. Last active: 12/13/2008 12:04:09 AM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 62
How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
The VB ocx annotation example 'annotate' provided with LeadTools 14.5 has a nice right-click menu option for adjusting the fill of an annotation object.  When I look at the options for the polygon I see that a fill mode that is available is 'Alpha' and that I can set a value from 0-255.  This is precisely what I was hoping for, but I have not been able to locate the information in the API or user documentation.  The documentation only offers me the choice of Opaque, Translucent, and Transparent.  I need to be able to set this up, I was hoping that  AnnSetFillMode would do the trick, but unless the Alpha value is at zero by default it is not doing anything.

Is this property exposed somehow?

   Report 
  08-13-2008, 17:12
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,816
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value

Attachment: OCX - V145 - L_AnnSetFillModeExt.zip
Reply Quote
The OCX control doesn't necessarily provide ALL of the same functionality as the other low level interfaces.  Therefore it is sometimes necessary to supplement it by declaring and using functions from the API interface.  This is done just like you would any Windows API function.  You can get documentation and examples from the API help file.  Attached is a simple project that shows how to declare and use this function.

I have submitted a feature request regarding to at least make all of the annotation functionality match since it's possible to set the properties with automated annotations but not non-automated annotations.  For your reference, the feature request number is 984FRQ.  If chosen for implementation, most feature requests are added at major releases (16, 17 etc.).

If this is an urgent need, please contact our custom development department by visiting http://www.leadtools.com/devservices/ for a quote.

Greg Ross
LEADTOOLS Technical Support
   Report 
  08-13-2008, 17:30
JoeBussell is not online. Last active: 12/13/2008 12:04:09 AM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 62
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
This works for me.  Thanks for the tip.

Where is the API help file you referred to?  There are a number of help files in the installation, but I have not located the one that contains the actual interface definition.

   Report 
  08-13-2008, 18:06
JoeBussell is not online. Last active: 12/13/2008 12:04:09 AM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 62
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
This works for me when I create a new annotation, but I have one phase where the annotations are being refreshed from disk.  During this time I have turned off repaints.  The trouble is that the L_AnnSetFillModeExt returns a -13 when I am loading.  The draw function is the same function, the only difference is the state of the display frame.  Does the annotation have to be  visible, or does the LEAD object have to be in any particular state for this call to work?

   Report 
  08-13-2008, 19:55
JoeBussell is not online. Last active: 12/13/2008 12:04:09 AM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 62
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
So, this does not work 100% of the time.  I can add an annotation and set the value using the lib, then add another annotation and it will error out.  I have not been able to get a repeated pattern to determine what the state is that I am in sometimes and not in others.  In all cases I am just using the code you gave me with a constant value of Alpha = 155.

Is there anything that I can read to understand the state that I need to have lead in to adjust the Alpha?

   Report 
  08-14-2008, 0:10
JoeBussell is not online. Last active: 12/13/2008 12:04:09 AM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 62
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
This method never fails in a simple test project.  I have added hundreds...

<scratches head>

Now my simple project only has one lead object and it occurs to me that since I have several in play that the dll call really doesn't have anything to go on but the annotation handle.  What is the chance that the dll call is bottoming out in the wrong lead object when it goes awry?  Is there any way to perform this call with the annotation container object handle as an argument to disambiguate this?

Thanks.


   Report 
  08-14-2008, 9:05
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,816
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
 JoeBussell wrote:

Where is the API help file you referred to?  There are a number of help files in the installation, but I have not located the one that contains the actual interface definition.

The API help file can be found in:
Start Menu\Programs\LEADTOOLS Medical Imaging Suite 14.5\Raster Imaging Pro\API\Raster API Helpfile.  The actual file name of the help file is ltdlln.chm.

 JoeBussell wrote:

This works for me when I create a new annotation, but I have one phase where the annotations are being refreshed from disk.  During this time I have turned off repaints.  The trouble is that the L_AnnSetFillModeExt returns a -13 when I am loading.

Why are you modifying the properties of annotations after loading?  If you've saved the annotations out with AnnSave and load them back up with AnnLoad, then you shouldn't have to modify any properties because they would have all been stored in the annotation file.

 JoeBussell wrote:

Is there anything that I can read to understand the state that I need to have lead in to adjust the Alpha?

This property is just like any other annotation property, so you must be in design mode in order to edit it.  Is this what you mean?  If not, please explain your question in more detail.

 JoeBussell wrote:

Now my simple project only has one lead object and it occurs to me that since I have several in play that the dll call really doesn't have anything to go on but the annotation handle.  What is the chance that the dll call is bottoming out in the wrong lead object when it goes awry?  Is there any way to perform this call with the annotation container object handle as an argument to disambiguate this?

Are you saying that your main application uses several LEAD Main controls?  In some cases it is necessary to use more than one, but I don't know of any reason to have more than 2-4.  Giving an object that doesn't support the fillmode is a likely cause to getting the Invalid Parameter Passed (-13) error when calling L_AnnSetFillModeExt (or any other function).

You can get the handle to the root container of a main control with the AnnContainer property.

Greg Ross
LEADTOOLS Technical Support
   Report 
  08-15-2008, 23:25
JoeBussell is not online. Last active: 12/13/2008 12:04:09 AM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 62
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
I was not using the automated save and load procedure because I am storing my data remotely on a database.  Can the annotations be streamed to a table using standard SQL using existing save and load functions?

I am using four frames.  Still I do understand that this could be a total red herring.  The lead library could have a table of items and existing frames from which to reference, and a means of insuring that they do not interfere. 

I believe that your point about the need for the Lead object to be in author mode is key here.  I had a call in my drawPolygon code that set the mode to 'run' after it was done.

So problem solved, but curiosity remains...


   Report 
  08-18-2008, 9:42
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,816
Re: How can I programatically set the fill mode to Alpha on a polygon annotation and control the value
Reply Quote
Yes, you can save to a database, but not directly.  You can use the AnnSaveMemory or AnnSaveArray methods to save the annotations to a memory handle or array which you can then save to a database as a blob.  Then to load the annotations you can use the AnnLoadMemory and AnnLoadArray methods.

I still do not understand what you mean by the four frames and table of items and existing frames.  If the AnnLoad* and AnnSave* methods do not help correct this problem, please send a small sample project (NOT your entire application) that isolates this problem so I can try to reproduce it here.

Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Developer » Annotations » How can I programatically set the fill mode to Alpha on a polygon annotation and control the value

Powered by Community Server, by Telligent Systems