|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting Label zorder above picture controlHow can I keep a label above a picture (control), without making it a
container of the picture? Otherwise the label always gets covered by the picture control regardless of the label's zorder that I set. thanks "jim" <edasich@nooo.spam.yahoo.com> wrote in message You can't. Labels aren't separate windows; they are drawn directly ontonews:uHtISkXZFHA.228@TK2MSFTNGP12.phx.gbl > How can I keep a label above a picture (control), without making it a > container of the picture? Otherwise the label always gets covered by > the picture control regardless of the label's zorder that I set. their container. You can use a textbox and set the properties so that it looks like a label or you can change the label's container. -- Reply to the group so all can participate VB.Net: "Fool me once..." "jim" <edasich@nooo.spam.yahoo.com> wrote You might use a textbox. But, why can't the lable be on the picturebox?> How can I keep a label above a picture (control), without making it a > container of the picture? Otherwise the label always gets covered by the > picture control regardless of the label's zorder that I set. > thanks LFS > You might use a textbox. But, why can't the lable be on the picturebox? A label is considered a "lightweight" or "windowless" control with no window handle and all the perks that come with. Lighter on system resources, etc, etc. - Kev > > You might use a textbox. But, why can't the lable be on the Larry knows that... he meant "situated on (or in)" the PictureBox; notpicturebox? > > A label is considered a "lightweight" or "windowless" control with no window > handle and all the perks that come with. Lighter on system resources, etc, > etc. "on top of" the PictureBox. Rick - MVP Thanks for replies and sorry for late response. My need for using the
label was based on having a large array of image controls and I just wanted to superimpose a single word "TEST" across only one image (with varying index) of the control array. It was only a hassle to make a label inside every container for every image control instead of making do with just one. AND curious people just want to know! > Thanks for replies and sorry for late response. My need for using Your statement above is confusing. You say you have a large array ofthe > label was based on having a large array of image controls and I just wanted > to superimpose a single word "TEST" across only one image (with varying > index) of the control array. It was only a hassle to make a label inside > every container for every image control instead of making do with just one. > AND curious people just want to know! image controls, but that it is a hassle to make a label inside every container. The Image Control (not PictureBox) is NOT a container; you can just move the Label control to the center of the Image Control like this Label1.Move (Image1.Width - Label1.Width) / 2, _ (Image1.Height - Label1.Height) / 2 and follow that with Label1.ZOrder to make sure the Label Control is visibly on top of the Image Control. However, if you are using the term "image control" loosely and, in fact, mean you have a control array of PictureBoxes (these CAN be a container for other controls), then you can still use a single Label control and move it inside the PictureBox using its own Container property. Here is a Sub that will do that (assuming default names for your controls; change them in the code to match what you have named your own controls) Sub MoveLabel(PBoxIndex As Long) Set Label1.Container = Picture1(PBoxIndex) Label1.Move (Picture1(PBoxIndex).ScaleWidth - Label1.Width) / 2, _ (Picture1(PBoxIndex).ScaleHeight - Label1.Height) / 2 End Sub Just call the MoveLabel subroutine and pass in the Index number of the Picture1 control array of PictureBox Controls that you want to place the Label Control in and it will appear centered inside the PictureBox with that Index value. Rick - MVP
Using "Include" Approach for Repetitive Code...
Draw line on picture; change width determining a rising\falling trend Search box at bottom of screen Duplicate forms loop Control with previous focus Working application - Now generates error help with passing values from an aspx page? Windows Media Player 9 or 10 Playlist in visual basic 6 |
|||||||||||||||||||||||