This paper discusses the technique of using Delphi to modify the graphic interface, gives the realization source code of the window fading background, the 3D boundary, the 3D border, and an example of a software interface.
As a programmer, in the development of the program, all want their own program interface beautiful some, different, have their own distinctive features, which need to beautify their own interface. The general method is to use graphics tools to create a graphical interface, and then through simple programming will be able to achieve an ideal effect, many of the procedures to interface skin change is based on this thinking
But programmers are generally not proficient in graphics production tools, please outside the art to do is not convenient, in fact, the general 3D effect, we can also use the program to do.
How to achieve 3D effect programmatically
In order to change the computer in the early days of the single state of the text interface, major software companies have made unremitting efforts, has launched as a graphic processing industry standard OpenGL and Microsoft Research and development of Direct3D, as for some companies for their own 3D technology is countless. However, the method proposed in this paper does not need the above technology of large companies, purely using the basic functions of Delphi to achieve a more realistic 3D effect.
I used to have a karaoke OK Computer VOD program, there are a variety of song, there is a traditional song way called the Code song, it needs to draw a song on the screen of the keyboard, with the mouse click on the keyboard (touch screen with hand touch) input song encoding, the interface as shown below:
In addition to the image above the welcome pine, other such as background, copper column border, 3D keyboard, etc. are implemented by the program, the following I to implement the program to be a simple description of the full implementation of the interface, see this article with the source program.
Before giving the program the technical thought first, some objects in Delphi have the canvas attribute canvas, it is also an object, it has many attributes and methods, here only a few of this article is used.
Canvas.Brush.Style:=bsClear;//设置画刷风格
Canvas.pen.color:=rgb(R,G,B);// 设置画笔颜色
Canvas.pen.style:=psSolid;// 设置画笔风格
Canvas.pen.width:=1;//设置画笔宽度
procedure MoveTo(X, Y: Integer);
//将画笔移到坐标(X, Y) 处作为画画的起点
procedure LineTo(X, Y: Integer);
//从当前位置画一条直线到坐标(X, Y) 处
procedure RoundRect(X1, Y1, X2, Y2, X3, Y3: Integer);
//根据给定的参数画一个圆角矩形,X3、Y3用于确定圆角大小