Board index » Visual Studio » Setting Label zorder above picture control
|
SteveneJames
|
|
SteveneJames
|
Setting Label zorder above picture control
Visual Studio20
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 - |
| Larry
Registered User |
Mon May 30 20:08:11 CDT 2005
Re:Setting Label zorder above picture control"jim" <edasich@nooo.spam.yahoo.com>wrote QuoteHow can I keep a label above a picture (control), without making it a LFS - |
| Bob
Registered User |
Mon May 30 20:04:47 CDT 2005
Re:Setting Label zorder above picture control
"jim" <edasich@nooo.spam.yahoo.com>wrote in message
QuoteHow can I keep a label above a picture (control), without making it a 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..." - |
| Casey
Registered User |
Mon May 30 20:09:16 CDT 2005
Re:Setting Label zorder above picture controlQuoteYou might use a textbox. But, why can't the lable be on the picturebox? handle and all the perks that come with. Lighter on system resources, etc, etc. - Kev - |
| Rick
Registered User |
Mon May 30 20:23:51 CDT 2005
Re:Setting Label zorder above picture controlQuote>You might use a textbox. But, why can't the lable be on the "on top of" the PictureBox. Rick - MVP - |
| jim
Registered User |
Thu Jun 02 08:55:54 CDT 2005
Re:Setting Label zorder above picture control
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! - |
| Rick
Registered User |
Thu Jun 02 09:41:16 CDT 2005
Re:Setting Label zorder above picture controlQuoteThanks for replies and sorry for late response. My need for using 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 - |
