Jump to content
Xtreme .Net Talk

Control Visibility Order (One On Top Of Other)


Recommended Posts

Guest afrinspray
Posted

How do I place one element in a form on top of another element (and make sure that it STAYS on top)? For example, if I want to use a picture box in a form, and then I want to put a label over it half-way through the running of a program, how can I be sure that it will always be on top?

:confused:

  • 4 years later...
Posted

I actually came here to ask the same question basically. I have the user of my program add as many buttons as he wants to a form. So all of my buttons are made programmatically. There is the possibilty that when they choose to make a new button that the new button will be UNDER the older buttons, thus inhibiting the user from changing the location/size of the button because they dont even know where it is.

 

So my question: If i had a stack of 10 buttons how would I ensure that the button of interest is on top and visible?

 

 

 

How do I place one element in a form on top of another element (and make sure that it STAYS on top)? For example, if I want to use a picture box in a form, and then I want to put a label over it half-way through the running of a program, how can I be sure that it will always be on top?

:confused:

Currently Using: Visual Basic.Net 2005, .Net Framework 2.0
Posted

I don't think there's a way to make that a control will ALWAYS on top of another new cotrol.

 

Some solution would be call BringToFront method after you create a new control, or create a function that sort all control after you created a new one.

 

Another one, if you use usercontrol, add a BringToFront method in load method. This will ensure that the control will be on top of other control but only when your created it.

Posted (edited)

I thought I'd post the solution I just found out. It seems the .BringToFront is a function that still works on buttons. For some reason many functions on controls aren't showing up in the list you get after you type a period.. this is irritating to say the least.

For instance

typing "Button1." brings up a list of all the functions and properties of that button that you can use on it. But many usable functions are not on there! BringToFront is one of those functions and it works perfectly for what I needed to be done.

 

Does anyone know why all of the functions available to a control do not show up after "Button1." ?

 

Edit: It might be because I added the buttons programmatically.

 

I don't think there's a way to make that a control will ALWAYS on top of another new cotrol.

 

Some solution would be call BringToFront method after you create a new control, or create a function that sort all control after you created a new one.

 

Another one, if you use usercontrol, add a BringToFront method in load method. This will ensure that the control will be on top of other control but only when your created it.

Edited by NeuralJack
Currently Using: Visual Basic.Net 2005, .Net Framework 2.0
Posted
The intellisense should still work regardless of whether you added the control programatically, assuming the control is in scope.
Anybody looking for a graduate programmer (Midlands, England)?
Posted

ya the control was in scope. Somethings are just somtimes not listed, i'm not sure why.

 

The intellisense should still work regardless of whether you added the control programatically' date=' assuming the control is in scope.[/quote']
Currently Using: Visual Basic.Net 2005, .Net Framework 2.0
  • Leaders
Posted
VB Express has a feature I am not particularly fond of. It has two tabs in the intellisense. Make sure you are looking at the second tab, which lists all memebers as opposed to "commonly used members," which the first tab lists.
[sIGPIC]e[/sIGPIC]
  • 2 weeks later...
Posted
I thought I'd post the solution I just found out. It seems the .BringToFront is a function that still works on buttons. For some reason many functions on controls aren't showing up in the list you get after you type a period.. this is irritating to say the least.

For instance

typing "Button1." brings up a list of all the functions and properties of that button that you can use on it. But many usable functions are not on there! BringToFront is one of those functions and it works perfectly for what I needed to be done.

 

Does anyone know why all of the functions available to a control do not show up after "Button1." ?

 

AFAIK, Intellisense will display all control's functions and methods (It's hasn't change from VB6). Maybe you've declare a control with different name (example you created butProces, but you tried to call butProcess ??. Sometimes, it get me too).

 

Edit: It might be because I added the buttons programmatically.

 

No. It's always the same. Even if you add your button programmatically, at least you have to declare it first (dim blabla as new window.forms.button). So, IDE will sure know that you've declare an object.

  • Leaders
Posted
What will have an effect on what intellisense shows is what the variable is declared as. If you store a Button in an Object variable, the compiler doesn't know that (and Button methods are not available without a cast) so intellisense will only show members of System.Object. If you declare the variable as Control you will see only Control-specific members.
[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...