0

I have a textbox inside of a panel.

If the TextBow.Visible = true and the Panel.Visible = False,

Is there anyway I can tell that the textbox, although it is visible, is not actually seen by the user.

Greater Clarity.

I have a visible textbox inside of an invisible panel. Because the panel is not visible, but the controls inside of it are, checking the visibie property of the textbox does not give me the desired answer.

What I am really looking for is how to check if the user can actually see the control.

RobV
  • 28,022
  • 11
  • 77
  • 119
DidIReallyWriteThat
  • 1,033
  • 1
  • 10
  • 39

1 Answers1

2

Maybe you can check with a recursive method if any parent of the control is invisible?

If true then the control is invisible. If all parents are visible the control is visible too unless the control itself is invisible.

Anything like this:

    public bool isVisible(Control c)
    {
        if (c.Visible == false)
            return false;
        else
            if (c.Parent != null)
                return isVisible(c);
            else
                return c.Visible;
    }
Corné Strijkert
  • 290
  • 1
  • 5
  • 12