Mirage Source
Question about forms - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Question about forms (/showthread.php?tid=1465)



Question about forms - Stomach Pulser - 17-12-2007

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?


Re: Question about forms - William - 17-12-2007

You load it into the form picture here:
Code:
curForm.Picture = LoadPicture(App.Path & GFX_GUI & locGUI)

And here you try to get the width from something that doesn't exist:
Code:
curForm.Width = curForm.Picture.Width
    curForm.Height = curForm.Picture.Height

This part doesn't exist. you cant have picture.width. It should be curForm.Width, in that case. But that wont work for you either.
Code:
curForm.Picture.Width



Re: Question about forms - Stomach Pulser - 17-12-2007

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?


Re: Question about forms - William - 17-12-2007

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.


Re: Question about forms - Stomach Pulser - 17-12-2007

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...


Re: Question about forms - William - 18-12-2007

1 control doesn't make any difference what so ever to anything. It's like having 1 more pixel in paint drawn out. Tongue


Re: Question about forms - William - 18-12-2007

We are talking about 1 control, and the size of the exe aint that important.


Re: Question about forms - Stomach Pulser - 18-12-2007

So there is no way to do this without using a control?


Re: Question about forms - William - 18-12-2007

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.


Re: Question about forms - Stomach Pulser - 18-12-2007

Anyone know where I could find this declare? Like a database or something full of functions?


Re: Question about forms - Robin - 18-12-2007

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.


Re: Question about forms - Stomach Pulser - 18-12-2007

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)