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.
Unfortunately, activation email could not send to your email. Please try again.

Label Position and size not correctly calculated by Diagram.Refresh

Thread ID:





33864 Aug 28,2005 12:00 PM Sep 9,2005 10:31 AM Windows Forms 4
Tags: Diagram
Richard Deverson
Asked On August 28, 2005 12:00 PM

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.

Administrator [Syncfusion]
Replied On August 30, 2005 04:11 PM

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.,

Richard Deverson
Replied On August 31, 2005 07:01 AM

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?

Richard Deverson
Replied On August 31, 2005 07:20 AM

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.

Richard Deverson
Replied On September 9, 2005 10:31 AM

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.