Keywords: Interface SKIN Author: Dong Jun interface with a fight out.
The final interface you see is actually a PictureBox (or similar device). VC's friends understand that all the interface we see is actually "painting" on the form, but Microsoft has been for us. Do all the heavy paintings. If you do it like this, you must repeat this part of labor, don't feel complicated, because it is inevitable. Waiting for you to habits, it will be done (it is time consumption)
Method 1: Skin configured for profile
The so-called script (not the script, it should be a configuration information)
Such as conf.ini
The description is that the Press the bitmap file of the XX button is XX1.BMP is time to XX2.BMP is XX3.BMP usually xx0.bmp
Then describe the position of the button XX
10, 10, 200, 100
Example
'conf.ini
[main]
BMPDIR = BMP 'Normal Location Chart File Directory
WAVDIR = WAV 'Specifies the WAV file directory
[butxx] 'button XX related
TOP = 10
LEFT = 10
HEIGHT = 100
Width = 200
STYLE0 = XX0.BMP
STYLE1 = XX1.BMP
STYLE2 = XX2.BMP
Style3 = xx3.bmp
Tooltip = button XX floating prompt
WAV = ding.wav
[but2]
.....
[but3 ...]
After the configuration is complete, the application reads this ini.
Suppose you read the function is loadini (paragraph name, key name) Return the type of string
DIM SKINBMPDIR AS STRING
DIM SKINWAVDIR AS STRING
SUB FORM_LOAD ()
Loadskin "./skin/default/conf.ini"
End Sub
Sub loadskin (Conffile As String)
Skinbmpdir = loadingini ("main", "bmpdir")
Skinwavdir = Loadini ("main", "wavdir")
IMGBUTXX.TOP = CINT (Loadini ("Butxx", "TOP")) '' '(defined location)
IMGBUTXX.LEFT = CINT (Loadini ("Butxx", "Left")))
...
IMGBUTXX.Image = loadingPicture (Skinbmpdir Loadini ("Butxx", "Style0")) '' Read the picture
...
End Sub
In fact, Skin is like this, or almost, it is a data profile.
2 script configuration
The so-called script is troublesome, you need to have a script engine explanation. For those operating interfaces in the game interface, it is implementation, how ?? You don't believe it !!! Just usually you can't use this complicated.
Suppose your program supports VBA like Office, then your script should be like this.
Conf.cfg
'Suppose your program has definitions for each button, such as the ClassButxx class object Objbutxx
Objbutxx.top = ...
Objbutxx.style0 = loadingPicture ("...
'The configuration of the intermediate to the interface is completed by the script ...
Please refer to Ye Valentine's articles
VBScript script uses (the Script Program and Host Program)
http://blog.9cbs.net/yefanqiu/archive/2004/10/15/137928.aspx
VBScript script is used
http://www.bjjr.com.cn/yefan/sourcecode/yfvbscript.rar
3 Plugin technology is the finals of plugin technology
Dynamic loading DLL
Remember how to use API, Declare function XXXX LIB .....
Vc has a loadLibrary (forgot, think that it is Delphi, I am mixed, VC Delphi is all in anyway)
VB is not, only WinAPI can be used to dynamically load DLL
Then DLL provides the same interface function, such as confskin ()
At the beginning of the main program, according to the configuration, dynamically load a DLL, then configure the confskin () completion of the work to the DLL.
The plugin technology is also the case, such as a calculation method (such as WinAmp screen animation), fixed to call a fixed function of a DLL.
With the advancement of technology, the large number of XMLs, the function can not be counted, and the DLL can also be non-valued.
Flash can also be interface ...
HTML is also more and more interface ...
Microsoft's latest example demonstrates how to use D3D to use components ...
Oh, old, can't keep up with the time.