|
-
May 1st, 2007, 05:16 AM
#1
Thread Starter
New Member
How To Hide a Control With Solid Colour - What Properties?
Good Evening
I have tried this in VB6 but I am still not 100 percent sure if this right-
I want a control on the form to have a solid colour that won't show through the colour of the form it is placed on.
This is what I think is done to achieve this:
Modify STYLE Property – Set to 1 – Graphical, which turns the control into the same colour as the background
Modify VISIBLE Property – Set to False which sets a value to determine that the object is hidden
Does anyone know if this is correct or is it some other property I use.
I just want on this application for one control to appear to test a condition I am doing.
Any assistance grateful for.
-
May 1st, 2007, 06:01 AM
#2
Re: How To Hide a Control With Solid Colour - What Properties?
Welcome to the forums. 
I'm not 100 percent sure what you are asking.
It would seem that you have the Style and Visible properties set for what you want to do. Is the actual results something other than what you expected?
-
May 1st, 2007, 07:10 AM
#3
Re: How To Hide a Control With Solid Colour - What Properties?
I'm confused as to the whys.... but simply setting Visible = False will hide the control. No need to set the style.
-tg
-
May 1st, 2007, 07:23 PM
#4
Thread Starter
New Member
Re: How To Hide a Control With Solid Colour - What Properties?
Thanks tech, I tried that and yes it worked, the control is hidden.
And thanks Hack for the welcome, nice to see a place where newcomers to VB are not told off for being novices as I have a few questions coming up.
The result was expected Hack, it did hide the control and the text on the control, which was wanted, but I had seen that you had to change 2 properties on the control not just one - yet I tried just false and it did exactly what I wanted it to do - hide the whole control so when it ran it was the same colour as the form. Anyway, that worked.
-
May 2nd, 2007, 03:48 AM
#5
Fanatic Member
Re: How To Hide a Control With Solid Colour - What Properties?
 Originally Posted by michael65
so when it ran it was the same colour as the form.
By setting the control visible = false, it did not get the same colour as the form, it is invisible, so the form itself is shown on that place. It's just like there is no button on the form.
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
-
May 3rd, 2007, 03:55 AM
#6
Thread Starter
New Member
Re: How To Hide a Control With Solid Colour - What Properties?
-
May 3rd, 2007, 04:25 PM
#7
Re: How To Hide a Control With Solid Colour - What Properties?
Michael, making a control invisible is sometimes a double-edged sword so be careful. For example, you cannot give an invisible or disabled control the focus without generating an error. Nor can you set an invisible option button to have a value of True.
And, there are times when you may not want an option button to be visible and yet have a value of True. In that case I usually leave it visible and hide it behind a picture with a back color the same as the form.
Just a thought.
-
May 4th, 2007, 04:28 PM
#8
Thread Starter
New Member
Re: How To Hide a Control With Solid Colour - What Properties?
Ed, it seems to be working ok that it is hidden, I do find it strange that this hidden control is wanted but I will do what the client wants, there are no pictures to hide the control behind - anyway, it seems to do what is wanted. I suppose on some applications the developer wants to see a control that the user is not meant to see - perhaps..
-
May 4th, 2007, 09:22 PM
#9
Fanatic Member
Re: How To Hide a Control With Solid Colour - What Properties?
"To make a control Invisible to the user, but still visible to the program"
Store the Left value in the .Tag property or in a variable.
Then to 'hide' the control, set it's left property to -999
It will still be visible to the code, but not to the user.
Then when you wish to make it visible to the user, you can set it's Left property back to normal.
-
May 5th, 2007, 12:48 AM
#10
Thread Starter
New Member
Re: How To Hide a Control With Solid Colour - What Properties?
Thanks Rob - sure enough that did work too.
-
May 5th, 2007, 03:27 PM
#11
Re: How To Hide a Control With Solid Colour - What Properties?
RobC said, "Then to 'hide' the control, set it's left property to -999."
------------------
That sure does beat all. Thanks a bunch. I figured that would cause some "Invalid Property" or the like, but it works.
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
|