Thursday, September 16, 2010

Produced with the VB toolbox floating upper normal place of residence


Through visualization icon float kit can save users the trouble of clicking the main menu. When the mouse is located when its icon in the bottom of the mouse will automatically "fall out" a small label, indicating its function. And the upper normal place of residence will not be covered by the open file. And can change the shape and position, occupied by as much as possible to reduce desktop space.

Can our own applications using this advanced method? Here to introduce a simple to use VB to implement method. Main programming ideas: Reference Windows APL function, to achieve the top form of usual residence; establish control array, through the control of the MouseMove event, triggering a pop-up notes and disappeared.

A floating toolbox visualization and

1. Form1 put control SSRIBBON button (because it itself has three states: pressed, bounce, banned, most of the icon buttons are the type of button). To place the text boxes Text1 (can also use the Label control, but the effect will be different, will be mentioned later), then place a command button Command1. The control properties shown in Table 1 (the table only one example, the other as long as you can modify the corresponding attributes).

2. Click GP3D1, press ALT + Del cut, and then press ALT + Insert copy number, form a control array GP3D1 (0), GP3D1 (2), GP3D1 (3) ... ..., Another example is established by Text1 (0), Text1 (1) , Text1 (3) ... ....

3. Adjustment button and text box location.

During this period, each a work is necessary, such as text box Visible value False, in order to ensure that the program starts, do not display text box, and the Enable value of False is to run the process, the text box can not enter text. If you use the label (Label) instead of text boxes, icon buttons can not be arranged vertically, only horizontally. Because the button below will cover Label, but use the Label text box than the province of memory.

In order to achieve the effect of the upper normal place of residence, must call the Windows API function, in fact, a lot of VB methods cited in the Windows API. Here we use SetWindowsPos process, this process is defined in User.exe, it is important Windows system, the dynamic link library. Reference in the VB API function must be registered in the general declarations section of a statement. Statement API function is often troublesome and error-prone, such as:

Declare Sub SetWindowPos Lib "User" (ByVal hwnd As Integer, ByVal
hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal
cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)

If all of the API function declarations are so many inputs, low efficiency. Fortunately, all versions of VB provides a Windows API Help program, open it, search SetWindowPos, found one, click on hypertext with an explanation, you can copy.

Second, create a code in the general declarations section enter the following code and declare some constants and global variables:

Declare Sub setwindowpos Lib "User" (ByVal hwnd As Integer, ByVal
hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer,
ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)

Const SWP_NOSIZE = 1

Const SWP_nomove = 2

Const flags = SWP_NOSIZE Or SWP_nomove

Const hwnd_topmost = -1

Const hwnd_notopmost = -2

Dim I As Integer

Dim B As Integer

MouseMove event for the GP3D1 button to add the following code, where only the realization of the mouse device in its pop-up when the comment, not when its faded features, readers can add a timer control and some code, you can easily achieve the mouse After a moment in its comments on the effect of pop-up device, so there is no mouse "pass" button, note the results of the device appears.

Sub GP3D1_MouseMove (index As Integer, Button As Integer, Shift

As Integer, X As Single, Y As Single)

I = index 'record in which the current mouse button

text1 (I). Visible = True "to the pop-up

If B <> I Then 'of the other buttons omitted

text1 (B). Visible = False

End If

B = I 'Please have a good understanding the role of the variable B

End Sub

Command1 button's Click event to add the following code:

Sub Command1_Click ()

do While DoEvents () 'use DoEvents () to achieve free circulation under the multi-task monitoring

setwindowpos hwnd, hwnd_topmost, 0, 0, 0, 0, flags' to achieve the top place of usual residence

loop

End Sub

MouseMove event for the Command1 button to add the following code:

Sub Command1_MouseMove (Button As Integer, Shift As Integer, X

As Single, Y As Single)

text1 (I). Visible = False 'mouse leave the button area, located on the command button on the device when the omitted Notes

End Sub

The MouseMove event to Form1 add the following code:

Sub Form_MouseMove (Button As Integer, Shift As Integer, X

As Single, Y As Single)

text1 (I). Visible = False 'mouse leave the button area, enter the device form, omitted comment

End Sub







Recommended links:



Expert Icon Tools



mp4 to ipod Converter



Cattle were made with Maya the WHOLE process of real eye



ASE15 Trained For Several Years With Great Concentration "six Pulse Sword"



Audio Speech brief



Infomation Components And Libraries



Big Dragon: China's PR Industry Subversion



Thunder's humor: the content of our nearly 100% Genuine



e-cology in the PAN Micro Series 31



Official air strike 2 Cheats



Process



Infomation Web Servers



Ts Format



Beijing: a comprehensive modernization of EDUCATION promote capital



vob to mpg



M4v to flv



Simple jigsaw puzzle PRODUCTION



No comments:

Post a Comment