[RESOLVED] Have color of ctl take the color of ctl underneath it
What I want to do is to have a control (rtb) take the background color of the control it becomes visible over no matter what it is. How would I first determine what control the rtb becomes visible over so that I can use it's background color?
BTW: The control that it becomes visible over does not have to have focus...
Re: Have color of ctl take the color of ctl underneath it
you could loop through controls to get position & size and compare with position of rtb, but what if more than one control under rtb, check the zorder?
i was assuming that you mean a control in your app
Re: Have color of ctl take the color of ctl underneath it
Yes, I do mean inside my app.
At this point there is only one control visible at a time.
Re: Have color of ctl take the color of ctl underneath it
Unless I'm missing something you should be able to use the containers backcolor to set your controls backcolor.
ctl.BackColor = ctl.Container.BackColor
Re: Have color of ctl take the color of ctl underneath it
Quote:
Originally Posted by MarkT
Unless I'm missing something you should be able to use the containers backcolor to set your controls backcolor.
ctl.BackColor = ctl.Container.BackColor
I'm not sure but it sounds to me that the control underneath is not the container control, rather another control lower down the ZOrder.
Re: Have color of ctl take the color of ctl underneath it
I knew I had to be missing something. Rereading it I see what you are saying.
Re: Have color of ctl take the color of ctl underneath it
Milk, you are correct... It can be any control in the container that shares the same physical space but is visible at the current time. There can be several controls in this space inside the container. I have to know the one that is visible at the time.
I will need to check to see if I can cycle thru each control in the container to see if it is visible and in the physical area...
BTW: it's a SSTAB control
Re: [RESOLVED] Have color of ctl take the color of ctl underneath it
I had to check each control for the parent container name "SSTAB1" then check to see if the .Left property was greater than 0. SSTAB work differently that other controls it moves the controls that are not on the selected tab off the screen ex. .Left = -7500. So once I did that I could get the background of the control on the sstab that was visible (.Left > 0).