In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
How to achieve QQ form side hidden and GG 4.2 latest source code, a lot of novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can come to learn, I hope you can harvest.
QQ has a function of hiding by the side, which is very convenient to use: drag QQ's main form on the screen. When the upper edge of the form is aligned with the upper edge of the screen, the main form will be duang~~ hidden. When the mouse is moved to the corresponding area of the upper edge of the screen, the main form will be duang~~ displayed.
GG4.2 also adds the function of hiding by the side, supporting three modes of hiding by the left edge, hiding by the upper edge and hiding by the right edge, and realizing the hiding by the side as a reusable component AutoDocker.
So, how does the hidden function work? (In the initial implementation process, I encountered many problems and spent a lot of time. Now I directly share the results.)
I. The principle of hiding by the side
The essence of hiding by the side isn't really to set the form's Visiable to false, but to move the entire form out of the screen area. For example, hide along the right edge, and the actual effect is as follows:
The programme is described as follows:
(1)When dragging the form across the screen, detect the position of the form, whether it reaches the boundary of the screen, and if it reaches the boundary, prepare to hide to the side.
(2)When the hiding condition is reached and the mouse cursor has left the main window, hiding is achieved.
(3)After the form is hidden, when the mouse cursor moves to the boundary position where the form intersects the screen, the form is displayed normally; after that:
a. When the mouse leaves the form area again, the form is hidden again.
b. If mouse-dragging the form changes its position so that it no longer meets the hidden condition, the form remains displayed normally thereafter.
II. specific implementation process
1. Basic element definition
First, we need to define the types of hide to the side: left, top, and right. Use DockHideType enumeration to indicate:
/// ///type hidden by the side. /// public enum DockHideType { /// ///not hidden /// None = 0, /// ///hide by the upper edge /// Top, /// ///hide along the left edge /// Left, /// ///hide along the right edge /// Right }
Secondly, according to the principle described above, we know that the window has three states: normal display, ready to hide, hidden. These three states are represented using the FormDockHideStatus enumeration:
/// ///Show or hide status of the form /// public enum FormDockHideStatus { /// ///hidden /// Hide = 0, /// ///prepare to hide /// ReadyToHide, /// ///normal display /// ShowNormally }
2. Determine whether the hiding condition is met
Obviously, we should make this determination every time the position of the form changes, so this determination should be called in the LocationChanged event of the Form.
private void dockedForm_LocationChanged(object sender, EventArgs e) { this.ComputeDockHideType(); if (! this.IsOrg) { this.lastBoard = this.dockedForm.Bounds; this.IsOrg = true; } } /// ///Is the hidden condition met? And what kind of hiding it is. /// private void ComputeDockHideType() { if (this.dockedForm.Top
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.