WPF notes (2.5 Canvas)--layout

Source: Internet
Author: User

Original: WPF notes (2.5 Canvas)--layout

Canvas is the most accurate layout container-absolute positioning, this book author is not recommended to use, the size of the control is generally with the internal font image dynamic generation and automatically change, so the use of the first three layouts is the best choice, at this point, I also hold the same opinion.

Canvas uses the Top/bottom property to control the height of the top/bottom of the distance, and the Left/right property to control the distance left/right. Interestingly, by resizing the form, the position of the second TextBlock changes, but the distance from the bottom and right is constant, and the code is shown below:

<Canvas Background="Yellow">
<TextBlock Canvas.Left="Ten"Canvas.Top=" -">Hello</TextBlock>
<TextBlock canvas.right="Ten"Canvas.bottom=" -"> World!</TextBlock>
</Canvas>
In addition, canvas does not automatically cut content beyond its own range, meaning that the extra content appears outside of the canvas because the default cliptobounds= "False", and if set cliptobounds= "True", more content will be cropped.

Finally, using Viewbox together can make the automatic layout control resizable (see next section).

WPF notes (2.5 Canvas)--layout

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.