Results 1 to 8 of 8

Thread: [RESOLVED] Have color of ctl take the color of ctl underneath it

  1. #1

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Resolved [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...

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  3. #3

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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.

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    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

  5. #5
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    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.

  6. #6
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    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.

  7. #7

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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

  8. #8

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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
  •  



Click Here to Expand Forum to Full Width