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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a title screen (and imgbox, width, height, etc)

Status
Not open for further replies.

KingofSnake

Programmer
Jul 25, 2000
73
US
I'm creating a new game, and I want to make a title screen. I have a form that is black with a border style of flat, and it is also maximized. The problem is that I want to have a picture centered in the form, but the Width and Height values never seem to change if the form is maximized or not. I was also trying to get to pic to shrink if the form is too big for the users resoulution, but I don't know how to find out the size of a screen. Will someone help this QBASIC to VB programmer?


zachberry@hotmail.com
Buy Cheetos and fight world hunger one step at a time.
 
I guess that your title screen is what is normally called in VB a splash screen. That's the screen that shows up at the start of an application. If you want to add such a screen to your application have a look at:
Screen information can be obtained either through the Screen object, which is part of the VB language or through the Sysinfo control which you have to add to your program.

Probably, for the application you have in mind you can do it with the Screen object. Height and Width are obtained as: Screen.Height and Screen.Width
 
These properties will change, but you have to find out where to put your code to react to the form being maximised.

Normally this is done in the Resize event of the form.

Place a picture control on a form and then place the code below in the form module:

Option Explicit

Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\aa\test.gif")
Call Centre_Picture
End Sub

Private Sub Form_Resize()
Call Centre_Picture
End Sub

Private Sub Centre_Picture()
Picture1.Left = (Form1.Width - Picture1.Width) / 2
Picture1.Top = (Form1.Height - Picture1.Height) / 2
End Sub


Ta add resizing of the picture to fit the users screen setting, inside the Centre_Picture subroutine, add code to test Screen.Height and Screen.Width and change the Height and Width properties of the picture control before setting the top and left properties. Unfortunately, using a picture control is not good, as the resizing will not resize the picture displayed, but chop it off instead - unless there is something that I am not aware of.

Simon
 
Already done all that you've said said Simon. I'm using an image box control, which will allow you to stretch the picture to any dimension. I got it now so if the pic is too big for the user's resolution, then it squishes it in so it will fit.


zachberry@hotmail.com
Buy Cheetos and fight world hunger one step at a time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top