|
-
Nov 17th, 2007, 02:14 AM
#1
[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...
-
Nov 17th, 2007, 06:05 AM
#2
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 17th, 2007, 06:06 AM
#3
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.
-
Nov 17th, 2007, 07:34 AM
#4
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
-
Nov 17th, 2007, 12:22 PM
#5
Re: Have color of ctl take the color of ctl underneath it
 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.
-
Nov 17th, 2007, 02:34 PM
#6
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.
-
Nov 17th, 2007, 06:19 PM
#7
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
-
Nov 18th, 2007, 07:28 AM
#8
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).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|