' Gambas class file Public Sub Form_Open() FMain.Center FMain.Resizable = False PictureBox1.Border = Border.None PictureBox1.Picture = Picture["muster.jpg"] Label1.text = "Fractal Geometry (Computer Science Course 12)" FMain.Height += 24 ' Space must be created for the menu bar MM.ShowMenu End ' Form_Open() Public Sub ImageOpen() Dialog.Title = "Import a image file!" Dialog.Filter = ["*.png", "image files"] If Dialog.OpenFile(False) = True Then ' Multiselect=False (Standard) Message.Info("The opening of the image file was cancelled!") Return ' Cancel button pressed Else Try PictureBox1.Picture = Picture.Load(Dialog.Path) If Error Then Message.Error("Error opening the image file") Else Label1.Alignment = Align.Left Label1.Text = " File: " & File.Name(Dialog.Path) Endif ' ERROR? Endif ' Dialog.OpenFile End ' ImageOpen() Public Sub CreateImage() Message.Info("A programme is called up to generate an image file..") End ' CreateImage() Public Sub SaveImage() Message.Info("Call: Save dialogue") End ' SaveImage() Public Sub SaveAsDialog() Message.Info("Call: Save sub-dialogue") End ' SaveAsDialog() Public Sub PrintImage() Message.Info("Now the image is printed ...") End ' PrintImage() Public Sub SetOptions() Message.Info("Programme options can be set here...") End ' SetOptions() Public Sub GetColor_1() Message.Info("A colour selection dialogue 1 is called up here.") End ' GetColor1() Public Sub GetColor_2() Message.Info("A colour selection dialogue 2 is called up here.") End ' GetColor1() Public Sub Form_Close() FHelp.Close FMain.Close End ' Form_Close()
Comments:
In the download area you will find 3 projects with the same goal. For the first project, the file Form. class contains the complete source code. A module is used in the second project and the third project works with functions within a module. This makes the source code shorter, but also more complicated in the syntax when declaring individual menus.