Source : ct|23.04.08
< Tutorials Computer, Multimedia, Chinese
To realize an standalone program who displays an image in a window when we click a command button, we must write a number of code lines relatively important if we use the C or the C++ language. With Justbasic the program becomes relatively short and simple to write.
Put in a directory of your choice ("c:/essai" for instance ) the following program "essai.bas", created with JustBasic, and also a bitmap file (200x200 pixels) called "fond bmp".
nomainwin
WindowWidth = 200: WindowHeight = 200
UpperLeftX = 100 : UpperLeftY = 100
loadbmp "fond", "fond.bmp"
button #1, "bouton1", [b1], UR, 10, 10
open "Essai" for graphics_nsb_nf as #1
print #1, "trapclose [quit]"
wait
[b1]
'placer ici les instructions
print #1, "drawbmp fond 0 0"
wait
[quit]
close #1
unloadbmp("fond")
end
Generate the file "essai.tkn" and copy the runtime files in your directory "C:/essai". If you do not know how to do this operation, you will find explanations clicking the following link :
How to install and use Justbasic.
Click the file "essai.tkn", who must be in your "C:/essai" directory, and the programme will run immediately.
In the window of your program, click the command button "bouton1" and the image "fond.bmp" is immediately displayed inside the window.
© http://turrier.fr (2007) |