We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Label Position and size not correctly calculated by Diagram.Refresh

Hello, Here''s the problem: I select a symbol in a diagram. It''s label properties are fed to a propertyGrid control. When I change the Anchor property (via the propertyGrid) I recalculate the OffsetX property. However the label is drawn in the wrong place until I deselect the symbol by clicking somewhere else in the diagram. Then it is magically redrawn exactly where I want it. Is this the intended behaviour? My test application is based on the Dynamic Symbol code sample. More details: In the Anchor property set method, I call a private method to recalculate the OffsetX property. This is in order to prevent the symbol being obscured by the label text. After changing the Anchor property I call diagram.Refresh. If the symbol has no label, I add one when the user edits the label text in the property grid. Here I also have the problem that the label is not sized or positioned correctly until the symbol is deselected. Even though I call diagram.Refresh after adding/editing the label.

4 Replies

AD Administrator Syncfusion Team August 30, 2005 08:11 PM UTC

Hi Richard, Changing the properties of a SymbolLabel through the collection editor displayed by the PropertyGrid was failing to update the diagram''s view. We have made some changes so that the diagram control will update itself in response to property changes, and this should take care of this problem. The revised code will be available in a forthcoming update of the product. For the time being you can workaround the condition by providing a handler for the Diagram.PropertyChanged event and invoking the Control.Invalidate() method on the diagram control from within the event handler. Thanks, Prakash Surendra Syncfusion Inc.,


RD Richard Deverson August 31, 2005 11:01 AM UTC

Hi Prakash, I tried your suggestion, but it didn''t seem to help. I.e. I call diagram.Invalidate() (and also diagram.Invalidate(true)) in my diagram_PropertyChanged event handler, where diagram is the instance of the Diagram class. This doesn''t change the appearance of my symbol, i.e. the label is still drawn in the wrong position. The label only appears in the correct position AFTER I deselect my symbol, i.e. by clicking on the diagram. Have I missed something here? Is there some other way of "forcing" a redraw when a diagram property changes?


RD Richard Deverson August 31, 2005 11:20 AM UTC

Hi Prakash, Forget what I just wrote. It was my problem. I was setting the Anchor property before adjusting the XOffset. The XOffset change didn''t fire the Diagram.PropertyChanged event, therefore the symbol was redrawn without my new offset. When I do things in the "correct" order, it seems to work fine. Thanks for your excellent support.


RD Richard Deverson September 9, 2005 02:31 PM UTC

Hi, This seems to work much better in V3.3.0.0. Thanks Richard

Loader.
Live Chat Icon For mobile
Up arrow icon