Tutorials to .com

Tutorials to .com » Software » Delphi » Delphi in how to achieve transparent button

Delphi in how to achieve transparent button

Print View , by: iSee ,Total views: 19 ,Word Count: 615 ,Date: Sun, 19 Apr 2009 Time: 10:08 PM


Dear readers, delphi programming in combat, we can use the button control to create the button process button. However, the use of other software, we often can see the effect of transparent buttons. Delphi how to achieve transparency in the effect of the button? I search on the Internet a lot of time also did not find the controls in this area, so to determine their own DIY about it, I will be following their own experiences to share with readers some.

Button in order to achieve transparency, a total of three control-image, label, bevel. Image control which is transparent in order to highlight the effects of place (as background), label is displayed on the key word. The bevel is shown a three-dimensional box. (Through the control can be achieved when the mouse button to show the effect of bulge) we take a look at the following concrete steps now.

1, first built in delphi6.0 in a project file

2, please select a picture, and pay attention to their size. Form and then transferred into the same size and picture can be.

3, and then in the form to place a image control will be transferred to its Align property alclient, this picture of the toilet the same size and form can be used as a background. Picture and then select Properties and click the small button in the pop-up window by pressing the load button to select the background you need to do the picture.

4, and then again in the form put a label control, a reasonable set of text buttons and font size. Then click the Transparent property such as a transparent label.

5, the last place in the form of a bevel controls. Set the shape attribute bsBOX, and then set the style attribute bsRaise (such as the effect of a sudden), visible property changed to false (such procedures in the run-time the control is not visible).

6, a reasonable set up and label the location of the bevel control, making the bevel control with the label location and the location of just the same, if you think using the mouse to adjust the location more difficult. Can use Ctrl + arrows to move micro-control, use Shift + arrows to fine-tune the size of the control.

Now we started programming it, please set up in the code window and the statement following the incident.

procedure TForm1.Label1MouseMove (Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Bevel1.visible: = true;
/ / Make bevel controls visual label1.BringToFront;
/ / Label1 controls will be placed in the forefront to ensure the implementation of onclick event to end;

procedure TForm1.Label1Click (Sender: TObject);
begin
/ / Click on this button to join the implementation of the code need to end;

procedure TForm1.Image1MouseMove (Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Bevel1.visible: = false;
/ / When the mouse moves in the image control, so that is not visible bevel button control does not protruding end;

Also look in order to ensure transparent and not very monotonous button You can also place a label near the control icon, this will enable users to get a better look.


Delphi Tutorial Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.