FormMain.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

namespace RotateText
{
    public partial class FormMain : Form
    {
        private Font _font = new Font("Arial", 12);
        private Brush _brush = new SolidBrush(Color.Black);
        private Pen _pen = new Pen(Color.Black, 1f);
        private string _text = "Crow Soft";

        public FormMain()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            GraphicsText graphicsText = new GraphicsText();
            graphicsText.Graphics = e.Graphics;

            // 绘制围绕点旋转的文本
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Center;
            format.LineAlignment = StringAlignment.Center;

            graphicsText.DrawString(_text, _font, _brush, new PointF(100, 80), format, 45f);
            graphicsText.DrawString(_text, _font, _brush, new PointF(200, 80), format, -45f);
            graphicsText.DrawString(_text, _font, _brush, new PointF(300, 80), format, 90f);
            graphicsText.DrawString(_text, _font, _brush, new PointF(400, 80), format, -60f);

            // 绘制矩形内旋转的文本
            // First line
            RectangleF rc = RectangleF.FromLTRB(50, 150, 200, 230);
            RectangleF rect = rc;
            format.Alignment = StringAlignment.Near;

            e.Graphics.DrawRectangle(_pen, rect.Left, rect.Top, rect.Width, rect.Height);
            graphicsText.DrawString(_text, _font, _brush, rect, format, 30);

            rect.Location += new SizeF(180, 0);
            format.LineAlignment = StringAlignment.Near;
            e.Graphics.DrawRectangle(_pen, rect.Left, rect.Top, rect.Width, rect.Height);
            graphicsText.DrawString(_text, _font, _brush, rect, format, -30);

            rect.Location += new SizeF(180, 0);
            format.LineAlignment = StringAlignment.Center;
            e.Graphics.DrawRectangle(_pen, rect.Left, rect.Top, rect.Width, rect.Height);
            graphicsText.DrawString(_text, _font, _brush, rect, format, -90);

            rect.Location += new SizeF(180, 0);
            format.LineAlignment = StringAlignment.Far;
            e.Graphics.DrawRectangle(_pen, rect.Left, rect.Top, rect.Width, rect.Height);
后面还有 55 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。