display layer as semi-transparent

Hi

we defined some layers in our Diagram

we need to be able to show a selected layer , and all other layes semi transparent.

can you help


2 Replies

KR Karkuvel Rajan Shanmugavel Syncfusion Team June 2, 2023 04:26 AM UTC

Hi Tal,


Currently, we are analyzing your requirement of “Need to set semi-transparent background to present layer”. We will update you with more details before EOD.


Regards,

Karkuvel Rajan S



KR Karkuvel Rajan Shanmugavel Syncfusion Team June 2, 2023 10:33 AM UTC

Hi Tal,


Layers are transparent sheets that can be added to the model and the objects are added to it. Layers allow to categorically arrange a set of nodes onto the diagram. Layers are used to group nodes in collections and then show or hide layers with all nodes. One node can be assigned to many layers. Node will be visible, if all layers are visible; even if one layer is hidden, node will not be visible. For your requirement to show semi-transparent background for active layers. Currently, we don’t have any option to achieve it in layers. You can achieve this in Groups. But you can’t able to add a single node to multiple groups. We have prepared a simple sample for the Groups and set its background as semi-transparent. Please find the sample in below attachment.


 

    public class CustomGrp : Group

    {

        protected override void PrepareGraphics(Graphics gfx)

        {

            // Based on your condition you can use this code, we have used visible property

            if (this.Visible)

            {

                System.Drawing.Brush brush = new SolidBrush(System.Drawing.Color.SkyBlue);

                gfx.FillRectangle(brush, this.BoundingRect);

            }

            base.PrepareGraphics(gfx);

        }

    }

 



Regards,

Karkuvel Rajan S


Attachment: DiagramSample_44fb5cdd.zip

Loader.
Up arrow icon