C # World coordinates page coordinates pageunit PageScale

Source: Internet
Author: User

PageScale: Gets or sets the ratio between the world units of this Graphics and the page units.
PageUnit: Gets or sets the unit of measure used for page coordinates in this Graphics.

Words don't say much, on the code:

        Private voidForm1_paint (Objectsender, PaintEventArgs e) {Graphics DC=E.graphics; dc. PageUnit= GraphicsUnit.Pixel;//page Coordinatesdc. PageScale =0.5f;//World Coordinate and page coordinate scale factorPen P=NewPen (color.red); intStartX = -; intStarty = -; Point StartPoint=NewPoint (StartX, starty);  for(inti =0; I < -; ++i) {DC. DrawLine (P, StartPoint,NewPoint (StartX +I, starty)); }        }

Again

PageScale = 0.5 PageScale = 1 PageScale = 2

Visible from above, PageUnit = GraphicsUnit.Pixel, that is, when displayed in pixels, the program draws 100 coordinate positions

PageScale = 1, a coordinate position corresponds to one pixel, so the length of the line is displayed as 100 pixels

PageScale = 0.5, a coordinate corresponds to 0.5 pixels, so the length of the line is displayed as 50 pixels

PageScale = 2, a coordinate corresponds to 2 pixels, so the length of the line is displayed as 200 pixels (beyond the window Size: D), and the width of the visible line becomes 2 pixels.

Comprehensive: page coordinates = WORLD coordinates * pagescale!!! I understand the world coordinates that are logical coordinates, the page coordinates are physical coordinates or called device coordinates!

C # World coordinates page coordinates pageunit PageScale

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.