Create a dockable component

Source: Internet
Author: User
The dockable component is a component that can be moved to any side.

Example on Web: http://www.codeguru.com/Csharp/Csharp/cs_syntax/controls/article.php/c5849/

In this example, three widgets all inherit the user control. In fact, there can be more. All three are representative:

1. boriner (Border Control): a container that can be used to store data. As a container, the shape changes when it is pushed to the four sides. Long and flat. This should ensure that the content should be adjusted as well. Therefore, the onresize () method of the user control needs to be rewritten.

2. Title Bar (docking handle): it is used by others. Move the mouse up and hold it down. You can check the this. Capture attribute in the onmousemove event of drag. If this. Capture = true, it indicates that the file has been captured and can be followed. Set the value of the dock based on the current mouse position. From horizontal to vertical, the title bar also needs to be changed, so the onpaint event should be rewritten. Why is it silly for Microsoft to place the window key next to CTRL? I need to press Ctrl to switch between Chinese and English. If I do not move, I will press the wrong button. When an error is clicked, a very large Start Menu is displayed, Which is annoying! If you have money in the future, you can buy Microsoft, split windows into parts, and replace the kernel with Linux!

3. Splitter (dockingresize): This is the middle splitter, which can be dragged and adjusted. Like the previous one, this also requires rewriting of onmousemove and onpaint methods. To know how far it is to stretch, you also need to get the position parameter of the start point from onmousedown.

Overall, it is very simple. But there are a lot of details. For example, there must be Splitter In the aspect, the window should be minimized, and the double-click event should be responded. When dragging, a virtual box should be provided to determine the location and maximize the space, minimized drawer animation effects, mouse shapes, circular edges, and more. The principle is very simple, so it is not easy to do well.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.