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

Change default alpha for new nodes

New here, so bear with me....

Is it possible to set the default alpha value for all new nodes added to a diagram?

Do I need to create a custom symbol?

Thanks!

-k


3 Replies

KH Kelly Harrison August 25, 2008 10:06 PM UTC

I guess I should point out that I'm working with rectangles exclusively. I'm messing around with the DrawShapes_2008 sample.

-k

>New here, so bear with me....

Is it possible to set the default alpha value for all new nodes added to a diagram?

Do I need to create a custom symbol?

Thanks!

-k





J. J.Nagarajan Syncfusion Team August 26, 2008 05:04 AM UTC

Hi ,

Thanks for your interest in Syncfusion products.

To change the default alpha factor of the nodes, you have to handle NodeCollectionChanging event of DocumentEventSink and use FillStyle.ColorAlphaFactor of the node in this event. Please refer to the below code snippet.

this.diagram1.Model.EventSink.NodeCollectionChanging += new CollectionExEventHandler(EventSink_NodeCollectionChanging);
void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
{
if (evtArgs.Element is Rectangle)
{
Rectangle m_rect = evtArgs.Element as Rectangle;
m_rect.FillStyle.ColorAlphaFactor = 80;
}
}

Here is the working sample.

http://websamples.syncfusion.com/samples/Diagram.Windows/F76151/main.htm

Please let me know if this helps.

Thanks,
Nagaraj



KH Kelly Harrison August 26, 2008 02:33 PM UTC

Perfect - thanks!

-k

>Hi ,

Thanks for your interest in Syncfusion products.

To change the default alpha factor of the nodes, you have to handle NodeCollectionChanging event of DocumentEventSink and use FillStyle.ColorAlphaFactor of the node in this event. Please refer to the below code snippet.

this.diagram1.Model.EventSink.NodeCollectionChanging += new CollectionExEventHandler(EventSink_NodeCollectionChanging);
void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
{
if (evtArgs.Element is Rectangle)
{
Rectangle m_rect = evtArgs.Element as Rectangle;
m_rect.FillStyle.ColorAlphaFactor = 80;
}
}

Here is the working sample.

http://websamples.syncfusion.com/samples/Diagram.Windows/F76151/main.htm

Please let me know if this helps.

Thanks,
Nagaraj




Loader.
Live Chat Icon For mobile
Up arrow icon