Stomach Pulser
Unregistered
Hello, I am trying to load a GUI into a form's background image and then set the form's width and height to that of the picture. I have the actually loading the GUI done, but when I try to load the width and height, it sets it incorrectly. Meaning, it makes both to big. Here is my code
Code:
Sub LoadGui(ByVal curForm As Form, ByVal locGUI As String)
curForm.Picture = LoadPicture(App.Path & GFX_GUI & locGUI)
curForm.Width = curForm.Picture.Width
curForm.Height = curForm.Picture.Height
End Sub
In frmMainMenu I use this call:
Code:
Private Sub Form_Load()
Call LoadGui(Me, "menu.bmp")
End Sub
Any tips on loading the correct width and height?
Stomach Pulser
Unregistered
I tried
Code:
curForm.Width = LoadPicture(App.Path & GFX_GUI & locGUI).Width
before I I tried my new code. But they both do the same thing. Shouldn't this have worked since I load the picture's width?
Posts: 2,605
Threads: 412
Joined: Nov 2021
Reputation:
0
You can't do that either. I don't know in my head how to do it with a form.
It's much easier if you use a picture box though.
Stomach Pulser
Unregistered
I know that If I load it into a picture box it will work, but I want to learn the other way, it causes for less controls...
Posts: 2,605
Threads: 412
Joined: Nov 2021
Reputation:
0
We are talking about 1 control, and the size of the exe aint that important.
Stomach Pulser
Unregistered
So there is no way to do this without using a control?
Posts: 2,605
Threads: 412
Joined: Nov 2021
Reputation:
0
Dave just said it is possible. There isn't a default option for it on the form, I'd say there is a declare for it.
Stomach Pulser
Unregistered
Anyone know where I could find this declare? Like a database or something full of functions?
Posts: 2,742
Threads: 115
Joined: Jun 2006
Reputation:
0
There is probably a function which will allow you to get the width and heigh of the image file.
It's stored in the files properties after all.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Stomach Pulser
Unregistered
Dave Wrote:You could extract the size straight from the bitmap file, look for the bitmap fileformat spec. Just open a file just like any binary file, and extract the correct datatype from the correct place.
I'm sorry to ask, but how would I go about doing that? Would I need to make a program that reads binary files?
(already searched through forums)