Add a ruler to C #. The scale of the ruler is centimeter.
Source: Internet
Author: User
1 protected override void onpaint (painteventargs E)
2 {
3 form1 frm1 = new form1 ();
4 graphics G = E. graphics;
5
6 For (INT I = 0; I <= frm1.width; I ++ = 5)
7 {
8 if (I % 25! = 0 & I % 50! = 0)
9 {
10g. drawline (new pen (New solidbrush (color. Red), 1), new point (I, 0), new point (I, 4 ));
11}
12
13 if (I % 25 = 0 & I % 50! = 0)
14 {
15g. drawline (new pen (New solidbrush (color. Red), 1), new point (I, 0), new point (I, 7 ));
16}
17
18 if (I % 50 = 0)
19 {
20G. drawline (new pen (New solidbrush (color. Red), 1), new point (I, 0), new point (I, 9 ));
21}
22
23 if (I % 25! = 0 & I % 50! = 0)
24 {
25G. drawline (new pen (New solidbrush (color. Red), 1), new point (0, I), new point (4, I ));
26}
27
28 if (I % 25 = 0 & I % 50! = 0)
29 {
30g. drawline (new pen (New solidbrush (color. Red), 1), new point (0, I), new point (7, I ));
31}
32
33 if (I % 50 = 0)
34 {
35g. drawline (new pen (New solidbrush (color. Red), 1), new point (0, I), new point (9, I ));
36}
37}
38
39 base. onpaint (E );
40}
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