作文纸

如图:

程序如下:

        Dim ForePen = Pens.Green
        Dim ForeBrush = Brushes.Green
        Dim Lines = 22, Sqs = 23
        Dim LineSpace = 10
        Dim SqW = 30, SqH = 30
        Dim PageW = Sqs * SqW + 720 * 0, PageH = (Lines + 1) * (SqH + LineSpace) + LineSpace
        Dim Origin = New Point(35, 50)

        MyGraphics.DrawLine(ForePen, Origin, Origin + New Point(PageW, 0))
        MyGraphics.DrawLine(ForePen, Origin + New Point(0, LineSpace), Origin + New Point(PageW, 0) + New Point(0, LineSpace))

        MyGraphics.DrawLine(ForePen, Origin, Origin + New Point(0, PageH))
        MyGraphics.DrawLine(ForePen, Origin + New Point(PageW, 0), Origin + New Point(0, PageH) + New Point(PageW, 0))
        For y = 0 To Lines
            MyGraphics.DrawLine(ForePen, Origin + New Point(0, y * (SqH + LineSpace) + LineSpace), Origin + New Point(PageW, y * (SqH + LineSpace) + LineSpace))
            For x = 0 To Sqs
                MyGraphics.DrawLine(ForePen, Origin + New Point(x * (SqW), y * (SqH + LineSpace) + LineSpace), Origin + New Point(x * (SqW), y * (SqH + LineSpace) + SqH + LineSpace))
            Next
            MyGraphics.DrawLine(ForePen, Origin + New Point(0, y * (SqH + LineSpace) + SqH + LineSpace), Origin + New Point(PageW, y * (SqH + LineSpace) + SqH + LineSpace))
        Next
        MyGraphics.DrawLine(ForePen, Origin + New Point(0, PageH), Origin + New Point(PageW, PageH))
        MyGraphics.DrawString("第  页, 共  页", New Font("宋体", 13), ForeBrush, Origin + New Point(PageW - 150, -20))
        MyGraphics.DrawString(Sqs.ToString & "×" & Lines.ToString & "=" & (Sqs * Lines).ToString & "字", New Font("宋体", 13), ForeBrush, Origin + New Point(PageW - 150, PageH + 3))
        MyGraphics.DrawString("作文纸 Generated at " & Now.ToString & "  http://twd2.me", New Font("宋体", 13), ForeBrush, Origin + New Point(0, PageH + 3))
        PictureBox1.Refresh()

酌情处理吧。

发表评论?

2 条评论。

  1. DT啊 直接画一个就好了 非得写出来

发表评论

注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)

本文链接:https://twd2.me/archives/1580QrCode