Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to load GUI through code
#1
OK. This is a very simple tutorial. It will allow you to load a GUI when the form loads, so that you don't have to change it constantly at run time. To change a form's GUI, all you need to do is edit the GUI itself (outside mirage, such as in paint). And the changes will be made.

Difficulty 1/5 (C + P): My Second Tutorial

All Client Side
First off, we need to declare some variables.
Go into ModConstants and find
Code:
' Gfx Path and variables

Add this right below
Code:
Public Const GFX_GUI = GFX_PATH & "GUI\"

Now, go into modGameLogic and add this to the very bottom
Code:
Sub LoadGui(ByVal curForm As Form, ByVal locGUI As String)
    curForm.Picture = LoadPicture(App.Path & GFX_GUI & locGUI)
End Sub

OK. Now, for every form that you wish to add this GUI loader, call this in your Form_Load.
The final part it to open your GFX folder and add a new folder called "GUI". Inside there, put all of you GUI components.

An example from my frmMainMenu
Code:
Private Sub Form_Load()
    Call LoadGui(Me, "menu.bmp")
End Sub

It calls on Load_GUI and says that I am the current form (Me, means the object that the sub is placed in, which is, in this case the frmMainMenu). Then, I placed "menu.bmp" in there because that is what I want to load. You can change it to any name and any picture file type (such as .jpg, .gif, .png).

Challenge:
In Sub LoadGUI, use the Select Case function to load every forms graphics so that you can simply call the function and it will do everything else.
Reply
#2
win32 ftw.
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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)