1. Create the main menu m_main.
2. Create the main Window w_main and set its property Window Type to mdihelp !, Set the MenuName attribute to m_main.
3. Create the w_pic image Window, place the picture control in the Window, and name it p_1; set the w_pic attribute and set the Window Type attribute to popup !, Select visible. All other properties are canceled.
4. Write w_pic code:
(1) define instance variables)
Boolean isfullscreen
Integer oldwidth, oldheight
(2) Compile an open () event:
Isfullscreen = true
Oldwidth = p_1.width
Oldheight = p_1.height
(3) Compile the resize () event
If isfullscreen then
P_1.x = 0
P_1.y = 0
P_1.resize (newwidth, newheight)
Else
P_1.resize (oldwidth, odlheight)
Integer ax, ay
Ax = (newwidth-oldwidth)/2
If AX <0 Then AX = 0
Ay = (newheight-oldheight)/2
If ay <0 then ay = 0
P_1.x = AX
P_1.y = ay
End if
(4) define function: Init (string as_picture, Boolean as_isfullscreen) Return (none)
Parameters:
Access: public return type: none function name: init
Pass by: value argument type: string argument name: as_picture
Pass by: value argument type: boolean argument name: as_isfullscreen
Code:
P_1.originalsize = ture
P_1.picturename = as_picture
Oldheight = p_1.height
Oldwidth = p_1.width
P_1.originalsize = false
This. Resize (this. Width, this. Height)
5. Write the w_main code:
(1) define instance variables)
W_pic mdipicture
String mdipicturename
Boolean mdiisfullscreen
(2) define function: setpicture ()
Parameters:
Access: public return type :( none) function name: setpicture
Pass by: value argument type: string argument name: as_picture
Pass by: value argument type: boolean argument name: as_isfullscreent
Code:
Mdipicturename = as_picture
Mdiisfullscreen = as_isfullscreen
If isvalid (mdipicture) then
Mdipicture. init (mdipicturename, mdiisfullscreen)
Mdipicture. resize (this. width, this. height)
End if
(3) Compile the resize () event:
If isvalid (mdipicture) = false then
Opensheet (mdipicture, this)
Mdipicture. init (mdipicturename, mdiisfullscreen)
Mdipicture. x = 0
Mdipicture. y = 0
End if
Mdipicture. resize (newwidth, newheight)
6. Compile the application open () event
Open (w_main)
W_main.setpicture ("back.bmp", true)
Figure 1: Minimize the window
Figure 2: maximized window