Visibility Not Working For Insert

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
slingblade
Posts: 16
Joined: 31 May 2010, 13:33

Visibility Not Working For Insert

Post by slingblade » 07 Jun 2010, 04:06

Hi,

I have noticed that setting the visibility property to false does not change Insert's visibility, it will change the visibility state of lines.

I am using the FAQ_Demo.Net sample and in the mousedown event I am finding the layer of the entity selected and then I iterate over all the entities in the drawing and if it is on the same layer as the selected entity then I set the visibility property to false.

Can you help me understand why this doesn't work for Inserts but it does work for lines?

I will email you the dwg...

Code: Select all

        private void cadPictBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (this.cadImage == null)
                return;
            
            if (e.Button == MouseButtons.Left)
            {
                if ((this.cadImage.SelectionMode == SelectionEntityMode.Enabled) && useSelectEntity)
                {                    
                    if (cadImage.Select(e.X, e.Y))
                    {
                        CADEntity entity = cadImage.SelectExt(e.X, e.Y, true, false);

                        string layerName = entity.Layer.Name;

                        foreach (CADEntity ent in cadImage.Converter.Entities )
                        {
                            if (ent.Layer.Name == layerName)
                            {
                                ent.Visibility = false;
                            }

                        }

                        cadPictBox.Invalidate(cadImage.GetSelectEntityRegion(this.cadPictBox.ClientRectangle));

                    }
                }
            }
            else
            {
                if ((e.Button == MouseButtons.Right) || (e.Button == MouseButtons.Middle))
                {                    
                    cX = e.X;
                    cY = e.Y;
                    detRMouseDown = true;
                    return;
                }
            }
            if ((!this.clipRectangle.Enabled) && (this.cadImage != null) && (!this.Orb3D.Visible))
                this.clipRectangle.EnableRect(RectangleType.Zooming, new Rectangle(e.X, e.Y, 0, 0));
        }

slingblade
Posts: 16
Joined: 31 May 2010, 13:33

Re: Visibility Not Working For Insert

Post by slingblade » 07 Jun 2010, 12:34

Hi,

I found a work around to make the insert's invisible.

I iterated all of the entities in the block collection for the insert and individually set them to visibility = false and that seems to work.

In a perfect would It would of course be great to not have to do that and if you set the parent control visibility = false then all of the children controls should follow suit and also set their visibility property. This would be more logical and I wouldn't have to spend hours trying different things to get this to work. :roll:

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Visibility Not Working For Insert

Post by support » 07 Jun 2010, 13:12

Hello.
The code is correct and the Visibility property set to false, but insert entity still visible after invalidating. Thank you for finding work around. You're correct - it's not a best way. We will consider the problem and let you know when the solution is ready.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply