| Mirage Source http://miragesource.net/forums/ |
|
| How to load GUI through code http://miragesource.net/forums/viewtopic.php?f=210&t=3171 |
Page 1 of 1 |
| Author: | Stomach Pulser [ Sat Dec 15, 2007 10:21 pm ] |
| Post subject: | How to load GUI through code |
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. |
|
| Author: | Lea [ Sat Dec 15, 2007 10:56 pm ] |
| Post subject: | Re: How to load GUI through code |
Dave's challenge: Delete every control and every form. Start in sub Main() and create each form through code Enjoy~ |
|
| Author: | Robin [ Sat Dec 15, 2007 11:34 pm ] |
| Post subject: | Re: How to load GUI through code |
win32 ftw. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|