iNET Interactive - Online Advertising Agency
          
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Game Programming > picture box


Reply
 
Thread Tools Display Modes
  #1  
Old 07-20-2003, 12:22 PM
chibishmoo chibishmoo is offline
Junior Contributor
 
Join Date: Jun 2003
Posts: 225
Default picture box

Hey, still working on my game, god im so bored... I would work on my online rpg but it was corrupted in my usb drive. Soooo, how do you print directly to a picture box, without using a label inside it? Thanks
Reply With Quote
  #2  
Old 07-20-2003, 01:01 PM
Boris's Avatar
Boris Boris is offline
Junior Contributor
 
Join Date: Jul 2003
Location: Finland
Posts: 238
Default

Quote:
Originally Posted by chibishmoo
Hey, still working on my game, god im so bored... I would work on my online rpg but it was corrupted in my usb drive. Soooo, how do you print directly to a picture box, without using a label inside it? Thanks



just use picture1.print
if you want to clear it just picture1.cls
__________________
To boldly go where every other programmer has gone before
Reply With Quote
  #3  
Old 07-20-2003, 01:10 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,746
Default

Quote:
Originally Posted by Boris
Quote:
Originally Posted by chibishmoo
Hey, still working on my game, god im so bored... I would work on my online rpg but it was corrupted in my usb drive. Soooo, how do you print directly to a picture box, without using a label inside it? Thanks



just use picture1.print
if you want to clear it just picture1.cls



set picture1.CurrentX and picture1.CurrentY to position your
"graphic cursor", which is where your text will print.

I would set the Scalemode to pixels so your CurrentX and CurrentY
values directly match your pixel scale.

The graphic cursor is updated by any drawing commands, including
print.
Print will automatically set CurrentX back to 0 and CurrentY will
increment based on the height of the text.

If you wanted to print a column of strings in one area of the window,
you could save some time by setting the ScaleLeft value to a negative
number, which means 0 is now moved to the right, inside your box.

Example: I want to print four scores in a column at the right side of
the window 40 pixels from the right side, and at the top of the window.
Lets say the area for the four scores is 50 pixels high.

I would.
Assuming my backcolor is 0 (black)

Code:
With Picture1 .ScaleLeft = -(.ScaleWidth - 40) 'put's left at a neg. number that puts "0" 40 pixels from the right edge. Picture1.Line (0, 0)-(40, 50), 0, BF 'clear the Scores area, .CurrentX = 0 'Set my graphic cursor to (0,0) (relative) .CurrentY = 0 For i = 1 To 4 'The scores will print in a column 40 pixels from the right Picture1.Print Score(i) Next .ScaleLeft = 0 'reset scale so that "0" is at the left edge again. End With

So if you are printing to set locations, and you know the size of the
area, you can just clear a block, and write the new text.

Even better, If you are going to write the same number of characters
to the same spot on the screen, you can set FontTransparency to False
and the fonts will have a background color, and will "erase" the old
characters they print over, in which case you wouldn't have to use the
.Line method to clear the area first.

Last edited by passel; 07-20-2003 at 01:54 PM.
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
printing a picture with text on danielz000 Interface and Graphics 0 06-18-2003 06:40 AM
A moving picture? _Danny_ Game Programming 1 03-14-2003 12:59 PM
PropertyPage Picture to change Controls picture, how? SoLoGHoST General 7 01-28-2003 11:55 AM
How to make sure correct Picture files reference hengkok General 5 05-22-2001 07:32 PM
Would Xtreme and Chris1232 Come Here Bunkey23 Game Programming 12 12-11-2000 03:25 AM

Advertisement: