Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

picturebox: some help with be nice

Status
Not open for further replies.

davext

Programmer
Oct 6, 2003
18
CA
Hi I'm a new VB programmer, I'm drawing a pie shaped object in a picture box. The pie must move across the screen, how do I do that without stretching the picture box across the screen? If I have to stretch the picture box, how do I set it so that it won't cover the buttons and everything else on the screen? Also when it moves across the screen in the picture box, it leaves a trail of what the drawing at been before, how do I get rid of that?

Thanks for all your help in advance
 

I take it the picture box contains the other controls that you mention? Because you could use the top or left properties of the picture box to move your graphic across the screen if the picture box does not contain the other controls. The only thing you have to be sure about is that the picture box's Zorder is last. Which you can do with something like...
[tt]
Picture1.ZOrder (Me.Controls.Count - 1)
[/tt]
Now if the picture box does contain the other controls, then let me suggest placing another picture box inside of the one you are using as a container. If you do not want to go that way then you can use the .Cls to clear the graphical contents of the picture box before you repaint the pie.

Good Luck

 
thanks for the reply, I haven't had a chance to test it yet. I'll get back to you on that.
 
Ok great, the is helping. But in order for the pie that I drew in the picture box to show, it must be within the size of the picture box, that means for me to move the pie across the screen requires me to have the picture box across the entire screen. If this is the case, how do I make the background of the picture box transparent? So I have a picture box, that contains the pie. The pie is red, but the picture box is the default colour of the buttons. I want to make the picture box transparent but the pie not transparent. Is this possible? If I put the picture box across the screen and it is not transparent, then it covers everything else on my screen. Thanks for your help!
 

The easiest way I can think of for you to do transparency in this manner is to use an image control instead of a picture box. However since you are creating this graphic from code (from the sounds of it) and not from a file I would suggest that you create the graphic in an invisible picture box and then set the image control's picture to the picture box's picture. Also you can set the image control's stretch property to true and control the size of the graphic.

Good Luck

 
You could always figure out where you want the picture to move to and use the x and y points and make it jump to that point. If that is not what you want to do then I am sorry I can not help you.
 
hi VB5prgrmr,

how would I go about doing this? setting the controls picture to the picture box's picture? THanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top