Change custom NCompositeShape color/shape at runtime from code.


Author
Message
Mohamed Salti
Mohamed Salti
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 4, Visits: 1
I'm working in a WinForms app. "this" is my custom composite control, I am inheriting from NCompositeShape and using the basic shape factory to compose my own shape.

The IF condition does work as expected, I know this because if I were to save the shape and reload it, the new color is applied, also i've done sufficient debugging to ensure that it works as expected.

If I were to make a change to a shape existing on the drawing document, are there any steps that I need to do after said change to ensure it gets refreshed on the UI?
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Your code and description is not enough. Please specify if this is a WinForm or a WebForm project. What is "this" in your code sample - is it the shape whose fill style you want to change? Also make sure whether your "IF" condition comes true at some point. Because if it is always false, then the NStyle.SetFillStyle method will never be executed and the fill style won't be set.



Best Regards,
Nevron Support Team


Mohamed Salti
Mohamed Salti
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 4, Visits: 1
Hi,

I have a simple NCompositeShape tied to some custom objects. Depending on property values in the underlying custom object I would like the shape or color of the existing shape to change on the drawing document.

Right now I have the following code:

//On the Custom Shape
CustomObject _obj = someCustomObj;

if (_obj.MyType == "sometype")
NStyle.SetFillStyle(this, new NColorFillStyle(GetTypeColor(_obj.MyType)));


The problem is that the color doesn't change on the drawing document. I attempted SmartRefreshAllViews() on the drawing document, but that doesn't seem to update the shape's colour. NStyle.SetFillStyle does seem to be changing the shape's colour, but it doesn't reflect in the drawing document.

Any help would be appreciated.

Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search