iNET Interactive - Online Advertising Agency
          
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > Label witch diseapear in a picturebox


Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2004, 05:08 PM
Falbala Falbala is offline
Regular
 
Join Date: Jan 2004
Location: Paris / France
Posts: 70
Default Label witch diseapear in a picturebox

Hy !
Sorry for my really bad english, I'll do my best. Well i would like to have à gradien on a commandbutton with à label on it. Problem I can't put gradien on a objet witch dont have the 'line' methode ! So i draw my own button with picturebox and put label on it . Good it works, but now when i want to apply gradien on it, the label diseapear !!!
I tried lots of possibilities with all the property of this 2 controls but without succes. So if someone has an idea, it would be great. Thanks a lot...
Reply With Quote
  #2  
Old 01-12-2004, 07:13 PM
rpgnewbie's Avatar
rpgnewbie rpgnewbie is offline
Contributor
 
Join Date: Sep 2003
Location: Portland OR
Posts: 581
Default No labels

Quote:
Originally Posted by Falbala
Hy !
Sorry for my really bad english, I'll do my best. Well i would like to have à gradien on a commandbutton with à label on it. Problem I can't put gradien on a objet witch dont have the 'line' methode ! So i draw my own button with picturebox and put label on it . Good it works, but now when i want to apply gradien on it, the label diseapear !!!
I tried lots of possibilities with all the property of this 2 controls but without succes. So if someone has an idea, it would be great. Thanks a lot...



Labels are lightweight controls without their own device context, so that's why you are having problems. Just use picboxes. Why are you trying to use labels? If you want to display text in a picturebox you can use the Print method of Picboxs. It won't come up in the Intellisense dropdown but it's just:

Picture1.Print "Output text"

Remember to set AutoRedraw to True

The other option is bitblting, or use the line method to "draw" the letters...
Reply With Quote
  #3  
Old 01-12-2004, 07:21 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Preferred language:
Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 6,748
Default

If you set AutoRedraw to True in your picture box, then the label should
show on top of the graphics without a problem. I'm assuming you set
the label's BackStyle to Transparent.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #4  
Old 01-14-2004, 04:25 PM
Falbala Falbala is offline
Regular
 
Join Date: Jan 2004
Location: Paris / France
Posts: 70
Default

Quote:
Originally Posted by passel
If you set AutoRedraw to True in your picture box, then the label should
show on top of the graphics without a problem. I'm assuming you set
the label's BackStyle to Transparent.




Yes !!!!! you're right, it's exactly what i wanted. Thanks a lot.

Sorry rpgnewbie but it doesn't work with : "Picture1.Print "Output text" !!!!!! I mean nothing appear on my 'like a button but with a picbox' so I don't know what is it for ?
Reply With Quote
  #5  
Old 01-14-2004, 05:09 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Preferred language:
Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 6,748
Default

After drawing your gradient, the CurrentX and CurrentY values are
probably left in the lower right corner so the text is being printed
outside the picturebox.

Try something like this (without a label in the picturebox, of course):
Code:
' Dim buttonTxt As String buttonTxt = "Test Button" 'Draw your gradient Picture1.CurrentX = (Picture1.ScaleWidth - Picture1.TextWidth(buttonTxt)) / 2 Picture1.CurrentY = (Picture1.ScaleHeight - Picture1.TextHeight(buttonTxt)) / 2 Picture1.Print buttonTxt
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #6  
Old 01-16-2004, 07:06 PM
Falbala Falbala is offline
Regular
 
Join Date: Jan 2004
Location: Paris / France
Posts: 70
Default

Yes, Yes, Yes, that's good ... thanks a lot !
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Graphics - Picturebox Contents MarkS API 8 05-11-2004 04:17 AM
PictureBox contents disappearing when I open a another form in the application. debbied General 2 01-14-2004 08:43 PM
Label Control Refresh Problem eemcclure Interface and Graphics 2 03-02-2003 12:01 PM
transfer focus from a label to picturebox alanyap Interface and Graphics 3 04-04-2002 03:17 PM

Advertisement: