几何绘图与三角函数计算应用

news2025/6/6 18:45:24

几何绘图与三角函数计算应用

设计思路

  • 左侧为绘图控制面板,右侧为绘图区域
  • 支持绘制点、线、矩形、圆、多边形等基本几何图形
  • 实现三角函数计算器(正弦、余弦、正切等)
  • 包含角度/弧度切换和常用数学常数
  • 历史记录功能保存用户绘图

完整实现代码

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace GeometryDrawingApp
{
    public partial class MainForm : Form
    {
        // 绘图状态变量
        private enum DrawingMode { None, Point, Line, Rectangle, Circle, Polygon, Select }
        private DrawingMode currentMode = DrawingMode.None;

        // 图形存储
        private List<Shape> shapes = new List<Shape>();
        private Shape currentShape = null;
        private Point startPoint;
        private Point endPoint;

        // 多边形绘制状态
        private List<Point> polygonPoints = new List<Point>();
        private bool isPolygonDrawing = false;

        // 选择状态
        private Shape selectedShape = null;

        // 颜色设置
        private Color drawingColor = Color.Blue;
        private Color selectedColor = Color.Red;

        public MainForm()
        {
            InitializeComponent();
            InitializeApp();
        }

        private void InitializeApp()
        {
            // 设置绘图区域背景
            drawingPanel.BackColor = Color.White;
            drawingPanel.Paint += DrawingPanel_Paint;
            drawingPanel.MouseDown += DrawingPanel_MouseDown;
            drawingPanel.MouseMove += DrawingPanel_MouseMove;
            drawingPanel.MouseUp += DrawingPanel_MouseUp;

            // 设置初始绘图模式
            SetDrawingMode(DrawingMode.Select);

            // 初始化三角函数计算器
            InitializeTrigCalculator();

            // 设置颜色选择器
            colorComboBox.Items.AddRange(new object[] { "Blue", "Red", "Green", "Purple", "Orange", "Black" });
            colorComboBox.SelectedIndex = 0;
            colorComboBox.SelectedIndexChanged += (s, e) =>
            {
                string colorName = colorComboBox.SelectedItem.ToString();
                drawingColor = Color.FromName(colorName);
            };

            // 设置线宽选择器
            for (int i = 1; i <= 5; i++)
                lineWidthComboBox.Items.Add(i);
            lineWidthComboBox.SelectedIndex = 0;

            // 设置填充样式
            fillStyleComboBox.Items.AddRange(new object[] { "None", "Solid", "Hatch" });
            fillStyleComboBox.SelectedIndex = 0;

            // 设置历史记录列表
            historyListBox.DisplayMember = "Description";
        }

        private void InitializeTrigCalculator()
        {
            // 初始化三角函数计算器UI
            angleTypeComboBox.Items.AddRange(new object[] { "Degrees", "Radians" });
            angleTypeComboBox.SelectedIndex = 0;

            // 添加常用常数
            constantComboBox.Items.AddRange(new object[] { "π", "e", "√2", "√3", "φ" });
            constantComboBox.SelectedIndex = 0;

            // 设置默认值
            angleTextBox.Text = "30";
            CalculateTrigFunctions();
        }

        private void SetDrawingMode(DrawingMode mode)
        {
            currentMode = mode;
            statusLabel.Text = $"Mode: {mode}";

            // 如果从多边形绘制切换到其他模式,清除多边形点
            if (mode != DrawingMode.Polygon && isPolygonDrawing)
            {
                polygonPoints.Clear();
                isPolygonDrawing = false;
                polygonButton.Text = "Polygon";
            }
        }

        // 图形基类
        public abstract class Shape
        {
            public Color Color { get; set; }
            public int LineWidth { get; set; }
            public bool Filled { get; set; }
            public bool Selected { get; set; }

            public abstract void Draw(Graphics g);
            public abstract bool Contains(Point point);
            public abstract string Description { get; }
        }

        // 点类
        public class PointShape : Shape
        {
            public Point Location { get; set; }

            public override void Draw(Graphics g)
            {
                using (Brush brush = new SolidBrush(Selected ? Color.Red : Color))
                {
                    g.FillEllipse(brush, Location.X - 3, Location.Y - 3, 6, 6);
                }
            }

            public override bool Contains(Point point)
            {
                return Math.Sqrt(Math.Pow(point.X - Location.X, 2) + Math.Pow(point.Y - Location.Y, 2)) < 5;
            }

            public override string Description => $"Point at ({Location.X}, {Location.Y})";
        }

        // 线类
        public class LineShape : Shape
        {
            public Point Start { get; set; }
            public Point End { get; set; }

            public override void Draw(Graphics g)
            {
                using (Pen pen = new Pen(Selected ? Color.Red : Color, LineWidth))
                {
                    g.DrawLine(pen, Start, End);
                }
            }

            public override bool Contains(Point point)
            {
                // 简化的点线距离计算
                double distance = Math.Abs((End.Y - Start.Y) * point.X - (End.X - Start.X) * point.Y +
                                          End.X * Start.Y - End.Y * Start.X) /
                                 Math.Sqrt(Math.Pow(End.Y - Start.Y, 2) + Math.Pow(End.X - Start.X, 2));
                return distance < 5;
            }

            public override string Description => $"Line from ({Start.X}, {Start.Y}) to ({End.X}, {End.Y})";
        }

        // 矩形类
        public class RectangleShape : Shape
        {
            public Rectangle Rect { get; set; }

            public override void Draw(Graphics g)
            {
                using (Pen pen = new Pen(Selected ? Color.Red : Color, LineWidth))
                {
                    if (Filled)
                    {
                        using (Brush brush = new SolidBrush(Color.FromArgb(100, Color)))
                        {
                            g.FillRectangle(brush, Rect);
                        }
                    }
                    g.DrawRectangle(pen, Rect);
                }
            }

            public override bool Contains(Point point)
            {
                return Rect.Contains(point);
            }

            public override string Description => $"Rectangle at ({Rect.X}, {Rect.Y}), Size: {Rect.Width}x{Rect.Height}";
        }

        // 圆类
        public class CircleShape : Shape
        {
            public Point Center { get; set; }
            public int Radius { get; set; }

            public override void Draw(Graphics g)
            {
                Rectangle rect = new Rectangle(Center.X - Radius, Center.Y - Radius,
                                               Radius * 2, Radius * 2);
                using (Pen pen = new Pen(Selected ? Color.Red : Color, LineWidth))
                {
                    if (Filled)
                    {
                        using (Brush brush = new SolidBrush(Color.FromArgb(100, Color)))
                        {
                            g.FillEllipse(brush, rect);
                        }
                    }
                    g.DrawEllipse(pen, rect);
                }
            }

            public override bool Contains(Point point)
            {
                double distance = Math.Sqrt(Math.Pow(point.X - Center.X, 2) + Math.Pow(point.Y - Center.Y, 2));
                return distance <= Radius + 3 && distance >= Radius - 3;
            }

            public override string Description => $"Circle at ({Center.X}, {Center.Y}), Radius: {Radius}";
        }

        // 多边形类
        public class PolygonShape : Shape
        {
            public List<Point> Points { get; set; } = new List<Point>();

            public override void Draw(Graphics g)
            {
                if (Points.Count < 2) return;

                using (Pen pen = new Pen(Selected ? Color.Red : Color, LineWidth))
                {
                    if (Filled && Points.Count > 2)
                    {
                        using (Brush brush = new SolidBrush(Color.FromArgb(100, Color)))
                        {
                            g.FillPolygon(brush, Points.ToArray());
                        }
                    }

                    // 修复:当只有两个点时绘制线段而不是多边形
                    if (Points.Count == 2)
                    {
                        g.DrawLine(pen, Points[0], Points[1]);
                    }
                    else
                    {
                        g.DrawPolygon(pen, Points.ToArray());
                    }
                }
            }

            public override bool Contains(Point point)
            {
                if (Points.Count == 0) return false;

                // 对于只有两个点的情况,使用线段包含检测
                if (Points.Count == 2)
                {
                    double distance = Math.Abs((Points[1].Y - Points[0].Y) * point.X -
                                     (Points[1].X - Points[0].X) * point.Y +
                                     Points[1].X * Points[0].Y - Points[1].Y * Points[0].X) /
                                Math.Sqrt(Math.Pow(Points[1].Y - Points[0].Y, 2) +
                                          Math.Pow(Points[1].X - Points[0].X, 2));
                    return distance < 5;
                }

                // 对于三个点以上的多边形
                GraphicsPath path = new GraphicsPath();
                path.AddPolygon(Points.ToArray());
                return path.IsVisible(point);
            }

            public override string Description => $"Polygon with {Points.Count} points";
        }

        private void DrawingPanel_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.SmoothingMode = SmoothingMode.AntiAlias;

            // 绘制所有图形
            foreach (Shape shape in shapes)
            {
                shape.Draw(g);
            }

            // 绘制当前正在绘制的图形
            if (currentShape != null)
            {
                currentShape.Draw(g);
            }

            // 绘制多边形点(如果正在绘制多边形)
            if (isPolygonDrawing && polygonPoints.Count > 0)
            {
                // 绘制点之间的连线
                if (polygonPoints.Count > 1)
                {
                    using (Pen pen = new Pen(Color.Gray, 1))
                    {
                        pen.DashStyle = DashStyle.Dash;
                        g.DrawLines(pen, polygonPoints.ToArray());
                    }
                }

                // 绘制所有点
                foreach (Point p in polygonPoints)
                {
                    g.FillEllipse(Brushes.Blue, p.X - 3, p.Y - 3, 6, 6);
                }

                // 绘制从最后一个点到当前鼠标位置的线
                Point currentPos = drawingPanel.PointToClient(Cursor.Position);
                if (polygonPoints.Count > 0)
                {
                    using (Pen pen = new Pen(Color.DarkGray, 1))
                    {
                        pen.DashStyle = DashStyle.Dot;
                        g.DrawLine(pen, polygonPoints[polygonPoints.Count - 1], currentPos);
                    }
                }
            }
        }

        private void DrawingPanel_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && isPolygonDrawing)
            {
                // 右键取消多边形绘制
                polygonPoints.Clear();
                isPolygonDrawing = false;
                polygonButton.Text = "Polygon";
                drawingPanel.Invalidate();
                return;
            }

            if (e.Button != MouseButtons.Left) return;

            if (currentMode == DrawingMode.Select)
            {
                // 选择图形
                selectedShape = null;
                foreach (Shape shape in shapes)
                {
                    shape.Selected = false;
                    if (shape.Contains(e.Location))
                    {
                        selectedShape = shape;
                        shape.Selected = true;
                        statusLabel.Text = $"Selected: {shape.Description}";
                    }
                }
                drawingPanel.Invalidate();
                return;
            }

            startPoint = e.Location;

            switch (currentMode)
            {
                case DrawingMode.Point:
                    currentShape = new PointShape
                    {
                        Location = e.Location,
                        Color = drawingColor,
                        LineWidth = (int)lineWidthComboBox.SelectedItem
                    };
                    shapes.Add(currentShape);
                    historyListBox.Items.Add(currentShape.Description);
                    currentShape = null;
                    break;

                case DrawingMode.Line:
                case DrawingMode.Rectangle:
                case DrawingMode.Circle:
                    // 这些图形需要开始点和结束点
                    break;

                case DrawingMode.Polygon:
                    if (!isPolygonDrawing)
                    {
                        isPolygonDrawing = true;
                        polygonPoints.Clear();
                        polygonPoints.Add(e.Location);
                        polygonButton.Text = "Complete Polygon";
                    }
                    else
                    {
                        polygonPoints.Add(e.Location);
                    }
                    break;
            }

            drawingPanel.Invalidate();
        }

        private void DrawingPanel_MouseMove(object sender, MouseEventArgs e)
        {
            // 更新坐标显示
            coordinatesLabel.Text = $"X: {e.X}, Y: {e.Y}";

            if (e.Button != MouseButtons.Left) return;

            endPoint = e.Location;

            switch (currentMode)
            {
                case DrawingMode.Line:
                    currentShape = new LineShape
                    {
                        Start = startPoint,
                        End = endPoint,
                        Color = drawingColor,
                        LineWidth = (int)lineWidthComboBox.SelectedItem
                    };
                    break;

                case DrawingMode.Rectangle:
                    int width = endPoint.X - startPoint.X;
                    int height = endPoint.Y - startPoint.Y;
                    currentShape = new RectangleShape
                    {
                        Rect = new Rectangle(startPoint.X, startPoint.Y, width, height),
                        Color = drawingColor,
                        LineWidth = (int)lineWidthComboBox.SelectedItem,
                        Filled = fillStyleComboBox.SelectedIndex > 0
                    };
                    break;

                case DrawingMode.Circle:
                    int radius = (int)Math.Sqrt(Math.Pow(endPoint.X - startPoint.X, 2) +
                                               Math.Pow(endPoint.Y - startPoint.Y, 2));
                    currentShape = new CircleShape
                    {
                        Center = startPoint,
                        Radius = radius,
                        Color = drawingColor,
                        LineWidth = (int)lineWidthComboBox.SelectedItem,
                        Filled = fillStyleComboBox.SelectedIndex > 0
                    };
                    break;
            }

            drawingPanel.Invalidate();
        }

        private void DrawingPanel_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left || currentShape == null) return;

            switch (currentMode)
            {
                case DrawingMode.Line:
                case DrawingMode.Rectangle:
                case DrawingMode.Circle:
                    shapes.Add(currentShape);
                    historyListBox.Items.Add(currentShape.Description);
                    currentShape = null;
                    break;
            }
        }

        private void pointButton_Click(object sender, EventArgs e) => SetDrawingMode(DrawingMode.Point);
        private void lineButton_Click(object sender, EventArgs e) => SetDrawingMode(DrawingMode.Line);
        private void rectangleButton_Click(object sender, EventArgs e) => SetDrawingMode(DrawingMode.Rectangle);
        private void circleButton_Click(object sender, EventArgs e) => SetDrawingMode(DrawingMode.Circle);
        private void selectButton_Click(object sender, EventArgs e) => SetDrawingMode(DrawingMode.Select);

        private void polygonButton_Click(object sender, EventArgs e)
        {
            if (isPolygonDrawing)
            {
                // 完成多边形绘制
                if (polygonPoints.Count > 1) // 至少需要两个点
                {
                    currentShape = new PolygonShape
                    {
                        Points = new List<Point>(polygonPoints),
                        Color = drawingColor,
                        LineWidth = (int)lineWidthComboBox.SelectedItem,
                        Filled = fillStyleComboBox.SelectedIndex > 0
                    };
                    shapes.Add(currentShape);
                    historyListBox.Items.Add(currentShape.Description);
                }
                else if (polygonPoints.Count == 1)
                {
                    // 如果只有一个点,创建点对象
                    currentShape = new PointShape
                    {
                        Location = polygonPoints[0],
                        Color = drawingColor,
                        LineWidth = (int)lineWidthComboBox.SelectedItem
                    };
                    shapes.Add(currentShape);
                    historyListBox.Items.Add(currentShape.Description);
                }

                polygonPoints.Clear();
                isPolygonDrawing = false;
                polygonButton.Text = "Polygon";
                SetDrawingMode(DrawingMode.Select);
            }
            else
            {
                SetDrawingMode(DrawingMode.Polygon);
            }
            drawingPanel.Invalidate();
        }

        private void clearButton_Click(object sender, EventArgs e)
        {
            // 修复:正确清空所有图形和多边形状态
            shapes.Clear();
            historyListBox.Items.Clear();
            selectedShape = null;

            // 清空多边形绘制状态
            polygonPoints.Clear();
            isPolygonDrawing = false;
            polygonButton.Text = "Polygon";

            // 重置为选择模式
            SetDrawingMode(DrawingMode.Select);

            drawingPanel.Invalidate();
        }

        private void CalculateTrigFunctions()
        {
            if (double.TryParse(angleTextBox.Text, out double angleValue))
            {
                bool isDegrees = angleTypeComboBox.SelectedIndex == 0;
                double radians = isDegrees ? angleValue * Math.PI / 180.0 : angleValue;

                sinLabel.Text = $"sin: {Math.Sin(radians):F4}";
                cosLabel.Text = $"cos: {Math.Cos(radians):F4}";
                tanLabel.Text = $"tan: {Math.Tan(radians):F4}";

                // 避免除以零错误
                if (Math.Cos(radians) != 0)
                    secLabel.Text = $"sec: {1.0 / Math.Cos(radians):F4}";
                else
                    secLabel.Text = "sec: undefined";

                if (Math.Sin(radians) != 0)
                    cscLabel.Text = $"csc: {1.0 / Math.Sin(radians):F4}";
                else
                    cscLabel.Text = "csc: undefined";

                if (Math.Tan(radians) != 0)
                    cotLabel.Text = $"cot: {1.0 / Math.Tan(radians):F4}";
                else
                    cotLabel.Text = "cot: undefined";
            }
            else
            {
                sinLabel.Text = "sin: invalid input";
                cosLabel.Text = "cos: invalid input";
                tanLabel.Text = "tan: invalid input";
                secLabel.Text = "sec: invalid input";
                cscLabel.Text = "csc: invalid input";
                cotLabel.Text = "cot: invalid input";
            }
        }

        private void calculateButton_Click(object sender, EventArgs e)
        {
            CalculateTrigFunctions();
        }

        private void constantComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (constantComboBox.SelectedIndex)
            {
                case 0: // π
                    angleTextBox.Text = Math.PI.ToString("F6");
                    break;
                case 1: // e
                    angleTextBox.Text = Math.E.ToString("F6");
                    break;
                case 2: // √2
                    angleTextBox.Text = Math.Sqrt(2).ToString("F6");
                    break;
                case 3: // √3
                    angleTextBox.Text = Math.Sqrt(3).ToString("F6");
                    break;
                case 4: // φ (黄金比例)
                    angleTextBox.Text = ((1 + Math.Sqrt(5)) / 2).ToString("F6");
                    break;
            }
            CalculateTrigFunctions();
        }

        private void deleteButton_Click(object sender, EventArgs e)
        {
            if (selectedShape != null)
            {
                shapes.Remove(selectedShape);
                selectedShape = null;
                drawingPanel.Invalidate();

                // 更新历史记录
                historyListBox.Items.Clear();
                foreach (Shape shape in shapes)
                {
                    historyListBox.Items.Add(shape.Description);
                }
            }
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            // 添加示例图形
            shapes.Add(new PointShape { Location = new Point(100, 100), Color = Color.Blue });
            shapes.Add(new LineShape
            {
                Start = new Point(150, 150),
                End = new Point(250, 200),
                Color = Color.Green,
                LineWidth = 2
            });
            shapes.Add(new RectangleShape
            {
                Rect = new Rectangle(300, 100, 80, 60),
                Color = Color.Purple,
                LineWidth = 2
            });
            shapes.Add(new CircleShape
            {
                Center = new Point(200, 300),
                Radius = 50,
                Color = Color.Orange,
                LineWidth = 2
            });

            // 添加历史记录
            foreach (Shape shape in shapes)
            {
                historyListBox.Items.Add(shape.Description);
            }
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            HelpForm f = new HelpForm();
            f.ShowDialog();
        }
    }
}

窗体设计代码 (MainForm.Designer.cs)

namespace GeometryDrawingApp
{
    partial class MainForm
    {
        private System.ComponentModel.IContainer components = null;

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
            this.drawingPanel = new System.Windows.Forms.Panel();
            this.controlPanel = new System.Windows.Forms.Panel();
            this.deleteButton = new System.Windows.Forms.Button();
            this.clearButton = new System.Windows.Forms.Button();
            this.fillStyleComboBox = new System.Windows.Forms.ComboBox();
            this.label5 = new System.Windows.Forms.Label();
            this.lineWidthComboBox = new System.Windows.Forms.ComboBox();
            this.label4 = new System.Windows.Forms.Label();
            this.colorComboBox = new System.Windows.Forms.ComboBox();
            this.label3 = new System.Windows.Forms.Label();
            this.polygonButton = new System.Windows.Forms.Button();
            this.selectButton = new System.Windows.Forms.Button();
            this.circleButton = new System.Windows.Forms.Button();
            this.rectangleButton = new System.Windows.Forms.Button();
            this.lineButton = new System.Windows.Forms.Button();
            this.pointButton = new System.Windows.Forms.Button();
            this.calculatorGroup = new System.Windows.Forms.GroupBox();
            this.cotLabel = new System.Windows.Forms.Label();
            this.cscLabel = new System.Windows.Forms.Label();
            this.secLabel = new System.Windows.Forms.Label();
            this.tanLabel = new System.Windows.Forms.Label();
            this.cosLabel = new System.Windows.Forms.Label();
            this.sinLabel = new System.Windows.Forms.Label();
            this.calculateButton = new System.Windows.Forms.Button();
            this.constantComboBox = new System.Windows.Forms.ComboBox();
            this.label2 = new System.Windows.Forms.Label();
            this.angleTypeComboBox = new System.Windows.Forms.ComboBox();
            this.angleTextBox = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.statusStrip = new System.Windows.Forms.StatusStrip();
            this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
            this.coordinatesLabel = new System.Windows.Forms.ToolStripStatusLabel();
            this.historyGroup = new System.Windows.Forms.GroupBox();
            this.historyListBox = new System.Windows.Forms.ListBox();
            this.controlPanel.SuspendLayout();
            this.calculatorGroup.SuspendLayout();
            this.statusStrip.SuspendLayout();
            this.historyGroup.SuspendLayout();
            this.SuspendLayout();
            // 
            // drawingPanel
            // 
            this.drawingPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.drawingPanel.BackColor = System.Drawing.Color.White;
            this.drawingPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.drawingPanel.Location = new System.Drawing.Point(12, 12);
            this.drawingPanel.Name = "drawingPanel";
            this.drawingPanel.Size = new System.Drawing.Size(600, 500);
            this.drawingPanel.TabIndex = 0;
            // 
            // controlPanel
            // 
            this.controlPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Right));
            this.controlPanel.BackColor = System.Drawing.SystemColors.ControlLight;
            this.controlPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.controlPanel.Controls.Add(this.deleteButton);
            this.controlPanel.Controls.Add(this.clearButton);
            this.controlPanel.Controls.Add(this.fillStyleComboBox);
            this.controlPanel.Controls.Add(this.label5);
            this.controlPanel.Controls.Add(this.lineWidthComboBox);
            this.controlPanel.Controls.Add(this.label4);
            this.controlPanel.Controls.Add(this.colorComboBox);
            this.controlPanel.Controls.Add(this.label3);
            this.controlPanel.Controls.Add(this.polygonButton);
            this.controlPanel.Controls.Add(this.selectButton);
            this.controlPanel.Controls.Add(this.circleButton);
            this.controlPanel.Controls.Add(this.rectangleButton);
            this.controlPanel.Controls.Add(this.lineButton);
            this.controlPanel.Controls.Add(this.pointButton);
            this.controlPanel.Controls.Add(this.calculatorGroup);
            this.controlPanel.Controls.Add(this.historyGroup);
            this.controlPanel.Location = new System.Drawing.Point(618, 12);
            this.controlPanel.Name = "controlPanel";
            this.controlPanel.Size = new System.Drawing.Size(280, 640);
            this.controlPanel.TabIndex = 1;
            // 
            // deleteButton
            // 
            this.deleteButton.BackColor = System.Drawing.Color.LightCoral;
            this.deleteButton.Location = new System.Drawing.Point(142, 295);
            this.deleteButton.Name = "deleteButton";
            this.deleteButton.Size = new System.Drawing.Size(120, 30);
            this.deleteButton.TabIndex = 16;
            this.deleteButton.Text = "Delete Selected";
            this.deleteButton.UseVisualStyleBackColor = false;
            this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click);
            // 
            // clearButton
            // 
            this.clearButton.BackColor = System.Drawing.Color.LightCoral;
            this.clearButton.Location = new System.Drawing.Point(16, 295);
            this.clearButton.Name = "clearButton";
            this.clearButton.Size = new System.Drawing.Size(120, 30);
            this.clearButton.TabIndex = 15;
            this.clearButton.Text = "Clear All";
            this.clearButton.UseVisualStyleBackColor = false;
            this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
            // 
            // fillStyleComboBox
            // 
            this.fillStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.fillStyleComboBox.FormattingEnabled = true;
            this.fillStyleComboBox.Location = new System.Drawing.Point(90, 258);
            this.fillStyleComboBox.Name = "fillStyleComboBox";
            this.fillStyleComboBox.Size = new System.Drawing.Size(172, 21);
            this.fillStyleComboBox.TabIndex = 14;
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(16, 261);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(48, 13);
            this.label5.TabIndex = 13;
            this.label5.Text = "Fill Style:";
            // 
            // lineWidthComboBox
            // 
            this.lineWidthComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.lineWidthComboBox.FormattingEnabled = true;
            this.lineWidthComboBox.Location = new System.Drawing.Point(90, 231);
            this.lineWidthComboBox.Name = "lineWidthComboBox";
            this.lineWidthComboBox.Size = new System.Drawing.Size(172, 21);
            this.lineWidthComboBox.TabIndex = 12;
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(16, 234);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(60, 13);
            this.label4.TabIndex = 11;
            this.label4.Text = "Line Width:";
            // 
            // colorComboBox
            // 
            this.colorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.colorComboBox.FormattingEnabled = true;
            this.colorComboBox.Location = new System.Drawing.Point(90, 204);
            this.colorComboBox.Name = "colorComboBox";
            this.colorComboBox.Size = new System.Drawing.Size(172, 21);
            this.colorComboBox.TabIndex = 10;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(16, 207);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(34, 13);
            this.label3.TabIndex = 9;
            this.label3.Text = "Color:";
            // 
            // polygonButton
            // 
            this.polygonButton.Location = new System.Drawing.Point(142, 168);
            this.polygonButton.Name = "polygonButton";
            this.polygonButton.Size = new System.Drawing.Size(120, 30);
            this.polygonButton.TabIndex = 8;
            this.polygonButton.Text = "Polygon";
            this.polygonButton.UseVisualStyleBackColor = true;
            this.polygonButton.Click += new System.EventHandler(this.polygonButton_Click);
            // 
            // selectButton
            // 
            this.selectButton.Location = new System.Drawing.Point(16, 168);
            this.selectButton.Name = "selectButton";
            this.selectButton.Size = new System.Drawing.Size(120, 30);
            this.selectButton.TabIndex = 7;
            this.selectButton.Text = "Select";
            this.selectButton.UseVisualStyleBackColor = true;
            this.selectButton.Click += new System.EventHandler(this.selectButton_Click);
            // 
            // circleButton
            // 
            this.circleButton.Location = new System.Drawing.Point(142, 132);
            this.circleButton.Name = "circleButton";
            this.circleButton.Size = new System.Drawing.Size(120, 30);
            this.circleButton.TabIndex = 6;
            this.circleButton.Text = "Circle";
            this.circleButton.UseVisualStyleBackColor = true;
            this.circleButton.Click += new System.EventHandler(this.circleButton_Click);
            // 
            // rectangleButton
            // 
            this.rectangleButton.Location = new System.Drawing.Point(16, 132);
            this.rectangleButton.Name = "rectangleButton";
            this.rectangleButton.Size = new System.Drawing.Size(120, 30);
            this.rectangleButton.TabIndex = 5;
            this.rectangleButton.Text = "Rectangle";
            this.rectangleButton.UseVisualStyleBackColor = true;
            this.rectangleButton.Click += new System.EventHandler(this.rectangleButton_Click);
            // 
            // lineButton
            // 
            this.lineButton.Location = new System.Drawing.Point(142, 96);
            this.lineButton.Name = "lineButton";
            this.lineButton.Size = new System.Drawing.Size(120, 30);
            this.lineButton.TabIndex = 4;
            this.lineButton.Text = "Line";
            this.lineButton.UseVisualStyleBackColor = true;
            this.lineButton.Click += new System.EventHandler(this.lineButton_Click);
            // 
            // pointButton
            // 
            this.pointButton.Location = new System.Drawing.Point(16, 96);
            this.pointButton.Name = "pointButton";
            this.pointButton.Size = new System.Drawing.Size(120, 30);
            this.pointButton.TabIndex = 3;
            this.pointButton.Text = "Point";
            this.pointButton.UseVisualStyleBackColor = true;
            this.pointButton.Click += new System.EventHandler(this.pointButton_Click);
            // 
            // calculatorGroup
            // 
            this.calculatorGroup.Controls.Add(this.cotLabel);
            this.calculatorGroup.Controls.Add(this.cscLabel);
            this.calculatorGroup.Controls.Add(this.secLabel);
            this.calculatorGroup.Controls.Add(this.tanLabel);
            this.calculatorGroup.Controls.Add(this.cosLabel);
            this.calculatorGroup.Controls.Add(this.sinLabel);
            this.calculatorGroup.Controls.Add(this.calculateButton);
            this.calculatorGroup.Controls.Add(this.constantComboBox);
            this.calculatorGroup.Controls.Add(this.label2);
            this.calculatorGroup.Controls.Add(this.angleTypeComboBox);
            this.calculatorGroup.Controls.Add(this.angleTextBox);
            this.calculatorGroup.Controls.Add(this.label1);
            this.calculatorGroup.Location = new System.Drawing.Point(16, 331);
            this.calculatorGroup.Name = "calculatorGroup";
            this.calculatorGroup.Size = new System.Drawing.Size(246, 180);
            this.calculatorGroup.TabIndex = 2;
            this.calculatorGroup.TabStop = false;
            this.calculatorGroup.Text = "Trigonometry Calculator";
            // 
            // cotLabel
            // 
            this.cotLabel.AutoSize = true;
            this.cotLabel.Location = new System.Drawing.Point(130, 150);
            this.cotLabel.Name = "cotLabel";
            this.cotLabel.Size = new System.Drawing.Size(30, 13);
            this.cotLabel.TabIndex = 11;
            this.cotLabel.Text = "cot: ";
            // 
            // cscLabel
            // 
            this.cscLabel.AutoSize = true;
            this.cscLabel.Location = new System.Drawing.Point(130, 130);
            this.cscLabel.Name = "cscLabel";
            this.cscLabel.Size = new System.Drawing.Size(30, 13);
            this.cscLabel.TabIndex = 10;
            this.cscLabel.Text = "csc: ";
            // 
            // secLabel
            // 
            this.secLabel.AutoSize = true;
            this.secLabel.Location = new System.Drawing.Point(130, 110);
            this.secLabel.Name = "secLabel";
            this.secLabel.Size = new System.Drawing.Size(30, 13);
            this.secLabel.TabIndex = 9;
            this.secLabel.Text = "sec: ";
            // 
            // tanLabel
            // 
            this.tanLabel.AutoSize = true;
            this.tanLabel.Location = new System.Drawing.Point(20, 150);
            this.tanLabel.Name = "tanLabel";
            this.tanLabel.Size = new System.Drawing.Size(28, 13);
            this.tanLabel.TabIndex = 8;
            this.tanLabel.Text = "tan: ";
            // 
            // cosLabel
            // 
            this.cosLabel.AutoSize = true;
            this.cosLabel.Location = new System.Drawing.Point(20, 130);
            this.cosLabel.Name = "cosLabel";
            this.cosLabel.Size = new System.Drawing.Size(30, 13);
            this.cosLabel.TabIndex = 7;
            this.cosLabel.Text = "cos: ";
            // 
            // sinLabel
            // 
            this.sinLabel.AutoSize = true;
            this.sinLabel.Location = new System.Drawing.Point(20, 110);
            this.sinLabel.Name = "sinLabel";
            this.sinLabel.Size = new System.Drawing.Size(27, 13);
            this.sinLabel.TabIndex = 6;
            this.sinLabel.Text = "sin: ";
            // 
            // calculateButton
            // 
            this.calculateButton.Location = new System.Drawing.Point(150, 70);
            this.calculateButton.Name = "calculateButton";
            this.calculateButton.Size = new System.Drawing.Size(80, 25);
            this.calculateButton.TabIndex = 5;
            this.calculateButton.Text = "Calculate";
            this.calculateButton.UseVisualStyleBackColor = true;
            this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click);
            // 
            // constantComboBox
            // 
            this.constantComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.constantComboBox.FormattingEnabled = true;
            this.constantComboBox.Location = new System.Drawing.Point(90, 73);
            this.constantComboBox.Name = "constantComboBox";
            this.constantComboBox.Size = new System.Drawing.Size(54, 21);
            this.constantComboBox.TabIndex = 4;
            this.constantComboBox.SelectedIndexChanged += new System.EventHandler(this.constantComboBox_SelectedIndexChanged);
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(20, 76);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(56, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "Constants:";
            // 
            // angleTypeComboBox
            // 
            this.angleTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.angleTypeComboBox.FormattingEnabled = true;
            this.angleTypeComboBox.Location = new System.Drawing.Point(170, 43);
            this.angleTypeComboBox.Name = "angleTypeComboBox";
            this.angleTypeComboBox.Size = new System.Drawing.Size(60, 21);
            this.angleTypeComboBox.TabIndex = 2;
            // 
            // angleTextBox
            // 
            this.angleTextBox.Location = new System.Drawing.Point(90, 43);
            this.angleTextBox.Name = "angleTextBox";
            this.angleTextBox.Size = new System.Drawing.Size(74, 20);
            this.angleTextBox.TabIndex = 1;
            this.angleTextBox.Text = "30";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(20, 46);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(37, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Angle:";
            // 
            // statusStrip
            // 
            this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.statusLabel,
            this.coordinatesLabel});
            this.statusStrip.Location = new System.Drawing.Point(0, 665);
            this.statusStrip.Name = "statusStrip";
            this.statusStrip.Size = new System.Drawing.Size(910, 22);
            this.statusStrip.TabIndex = 2;
            this.statusStrip.Text = "statusStrip1";
            // 
            // statusLabel
            // 
            this.statusLabel.Name = "statusLabel";
            this.statusLabel.Size = new System.Drawing.Size(42, 17);
            this.statusLabel.Text = "Ready";
            // 
            // coordinatesLabel
            // 
            this.coordinatesLabel.Name = "coordinatesLabel";
            this.coordinatesLabel.Size = new System.Drawing.Size(34, 17);
            this.coordinatesLabel.Text = "X: Y:";
            // 
            // historyGroup
            // 
            this.historyGroup.Controls.Add(this.historyListBox);
            this.historyGroup.Location = new System.Drawing.Point(16, 3);
            this.historyGroup.Name = "historyGroup";
            this.historyGroup.Size = new System.Drawing.Size(246, 87);
            this.historyGroup.TabIndex = 0;
            this.historyGroup.TabStop = false;
            this.historyGroup.Text = "Drawing History";
            // 
            // historyListBox
            // 
            this.historyListBox.Dock = System.Windows.Forms.DockStyle.Fill;
            this.historyListBox.FormattingEnabled = true;
            this.historyListBox.Location = new System.Drawing.Point(3, 16);
            this.historyListBox.Name = "historyListBox";
            this.historyListBox.Size = new System.Drawing.Size(240, 68);
            this.historyListBox.TabIndex = 0;
            // 
            // MainForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(910, 687);
            this.Controls.Add(this.statusStrip);
            this.Controls.Add(this.controlPanel);
            this.Controls.Add(this.drawingPanel);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "MainForm";
            this.Text = "Geometry Drawing App";
            this.Load += new System.EventHandler(this.MainForm_Load);
            this.controlPanel.ResumeLayout(false);
            this.controlPanel.PerformLayout();
            this.calculatorGroup.ResumeLayout(false);
            this.calculatorGroup.PerformLayout();
            this.statusStrip.ResumeLayout(false);
            this.statusStrip.PerformLayout();
            this.historyGroup.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Panel drawingPanel;
        private System.Windows.Forms.Panel controlPanel;
        private System.Windows.Forms.StatusStrip statusStrip;
        private System.Windows.Forms.ToolStripStatusLabel statusLabel;
        private System.Windows.Forms.GroupBox historyGroup;
        private System.Windows.Forms.ListBox historyListBox;
        private System.Windows.Forms.Button pointButton;
        private System.Windows.Forms.Button lineButton;
        private System.Windows.Forms.Button rectangleButton;
        private System.Windows.Forms.Button circleButton;
        private System.Windows.Forms.Button polygonButton;
        private System.Windows.Forms.Button selectButton;
        private System.Windows.Forms.ComboBox colorComboBox;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.ComboBox lineWidthComboBox;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.ComboBox fillStyleComboBox;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Button clearButton;
        private System.Windows.Forms.GroupBox calculatorGroup;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox angleTextBox;
        private System.Windows.Forms.ComboBox angleTypeComboBox;
        private System.Windows.Forms.Button calculateButton;
        private System.Windows.Forms.ComboBox constantComboBox;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label sinLabel;
        private System.Windows.Forms.Label cotLabel;
        private System.Windows.Forms.Label cscLabel;
        private System.Windows.Forms.Label secLabel;
        private System.Windows.Forms.Label tanLabel;
        private System.Windows.Forms.Label cosLabel;
        private System.Windows.Forms.Button deleteButton;
        private System.Windows.Forms.ToolStripStatusLabel coordinatesLabel;
    }
}

功能说明

这个几何绘图应用包含以下核心功能:

  1. 绘图功能

    • 支持绘制点、线、矩形、圆和多边形
    • 可选择颜色、线宽和填充样式
    • 选择工具可选取已绘制的图形
    • 可删除选中的图形或清空整个画布
  2. 三角函数计算器

    • 支持角度和弧度模式
    • 计算正弦、余弦、正切及其倒数函数
    • 内置常用数学常数(π、e、√2等)
  3. 历史记录

    • 记录所有绘制的图形
    • 显示图形类型和位置信息
  4. 用户界面

    • 左侧为绘图区域,右侧为控制面板
    • 状态栏显示当前模式和鼠标坐标
    • 直观的工具栏和设置选项

使用说明

  1. 绘图

    • 选择要绘制的图形类型(点、线、矩形等)
    • 在绘图区域点击并拖动鼠标创建图形
    • 对于多边形:点击多个点,最后点击"Complete Polygon"按钮完成
  2. 编辑

    • 使用选择工具点击图形可选中它
    • 点击"Delete Selected"删除选中图形
    • 点击"Clear All"清空整个画布
  3. 三角函数计算

    • 输入角度值(或使用预设常数)
    • 选择角度单位(度或弧度)
    • 点击"Calculate"按钮计算结果

这个应用程序结合了几何绘图和数学计算功能,适合用于教学、工程绘图和数学学习场景。界面设计直观,功能完整,代码结构清晰易于扩展。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2399245.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

leetcode 二叉搜索树中第k小的元素 java

中序遍历 定义一个栈&#xff0c;用于存取二叉树中的元素 Deque<TreeNode> stack new ArrayDeque<TreeNode>();进入while循环while(! stack.isEmpty()|| root ! null){}将root的左节点入栈&#xff0c;直到rootnull while(rootnull){stack.push(root);root ro…

5.1 初探大数据流式处理

在本节中&#xff0c;我们深入探讨了大数据流式处理的基础知识和关键技术。首先&#xff0c;我们区分了批式处理和流式处理两种大数据处理方式&#xff0c;了解了它们各自的适用场景和特点。流式处理以其低延迟和高实时性适用于需要快速响应的场景&#xff0c;而批式处理则适用…

传输层协议 UDP 介绍 -- UDP 协议格式,UDP 的特点,UDP 的缓冲区

目录 1. 再识的端口号 1.1 端口号范围划分 1.2 知名端口号&#xff08;Well-Know Port Number&#xff09; 2. UDP 协议 2.1 UDP 协议格式 2.2 UDP 的特点 2.3 UDP 的缓冲区 2.4 一些基于 UDP 的应用层协议 传输层&#xff08;Transport Layer&#xff09;是计算机网络…

ApacheSuperset CVE-2023-27524

前言:CVE-2023-27524 是一种远程代码执行漏洞&#xff0c;攻击者通过该漏洞可在受影响系统上执行任意代码&#xff0c;从而获得未授权访问权 CVE-2023-27524 GitHubhttps://github.com/horizon3ai/CVE-2023-27524 任务一 代理 | 拉取镜像 vi /etc/proxychains4.conf //最下面修…

如何在 HTML 中添加按钮

原文&#xff1a;如何在 HTML 中添加按钮 | w3cschool笔记 &#xff08;请勿将文章标记为付费&#xff01;&#xff01;&#xff01;&#xff01;&#xff09; 在网页开发中&#xff0c;按钮是用户界面中不可或缺的元素之一。无论是用于提交表单、触发动作还是导航&#xff0…

Linux--进程的程序替换

问题导入&#xff1a; 前面我们知道了&#xff0c;fork之后&#xff0c;子进程会继承父进程的代码和“数据”&#xff08;写实拷贝&#xff09;。 那么如果我们需要子进程完全去完成一个自己的程序怎么办呢&#xff1f; 进程的程序替换来完成这个功能&#xff01; 1.替换原理…

调教 DeepSeek - 输出精致的 HTML MARKDOWN

【序言】 不知道是不是我闲的蛋疼&#xff0c;对百度AI 和 DeepSeek 的回答都不太满意。 DeepSeek 回答句子的引用链接&#xff0c;始终无法准确定位。有时链接只是一个域名&#xff0c;有时它给的链接是搜索串如: baidu.com/?q"搜索内容"。 百度AI 回答句子的引用…

【笔记】Windows系统部署suna基于 MSYS2的Poetry 虚拟环境backedn后端包编译失败处理

基于 MSYS2&#xff08;MINGW64&#xff09;中 Python 的 Poetry 虚拟环境包编译失败处理笔记 一、背景 在基于 MSYS2&#xff08;MINGW64&#xff09;中 Python 创建的 Poetry 虚拟环境里&#xff0c;安装 Suna 开源项目相关包时编译失败&#xff0c;阻碍项目正常部署。 后端…

【深度学习优化算法】02:凸性

【作者主页】Francek Chen 【专栏介绍】 ⌈ ⌈ ⌈PyTorch深度学习 ⌋ ⌋ ⌋ 深度学习 (DL, Deep Learning) 特指基于深层神经网络模型和方法的机器学习。它是在统计机器学习、人工神经网络等算法模型基础上&#xff0c;结合当代大数据和大算力的发展而发展出来的。深度学习最重…

策略公开了:年化494%,夏普比率5.86,最大回撤7% | 大模型查询akshare,附代码

原创内容第907篇&#xff0c;专注智能量化投资、个人成长与财富自由。 这位兄弟的策略公开了&#xff0c;年化494%&#xff0c;夏普比率5.86&#xff0c;最大回撤7%&#xff0c;欢迎大家前往围观&#xff1a; http://www.ailabx.com/strategy/683ed10bdabe146c4c0b2293 系统代…

多模态大语言模型arxiv论文略读(101)

ML-Mamba: Efficient Multi-Modal Large Language Model Utilizing Mamba-2 ➡️ 论文标题&#xff1a;ML-Mamba: Efficient Multi-Modal Large Language Model Utilizing Mamba-2 ➡️ 论文作者&#xff1a;Wenjun Huang, Jiakai Pan, Jiahao Tang, Yanyu Ding, Yifei Xing, …

电网“逆流”怎么办?如何实现分布式光伏发电全部自发自用?

2024年10月9日&#xff0c;国家能源局综合司发布了《分布式光伏发电开发建设管理办法&#xff08;征求意见稿&#xff09;》&#xff0c;意见稿规定了户用分布式光伏、一般工商业分布式光伏以及大型工商业分布式光伏的发电上网模式&#xff0c;当选择全部自发自用模式时&#x…

如何查看电脑电池性能

检查电脑电池性能的方法如下&#xff1a; 按下winR键&#xff0c;输入cmd回车&#xff0c;进入命令行窗口 在命令行窗口输入powercfg /batteryreport 桌面双击此电脑&#xff0c;把刚刚复制的路径粘贴到文件路径栏&#xff0c;然后回车 回车后会自动用浏览器打开该报告 红…

kubernetes》》k8s》》kubectl proxy 命令后面加一个

命令后面加一个& 在Linux终端中&#xff0c;如果在命令的末尾加上一个&符号&#xff0c;这表示将这个任务放到后台去执行 kubectl proxy 官网资料 是 Kubernetes 提供的一个命令行工具&#xff0c;用于在本地和 Kubernetes API Server 之间创建一个安全的代理通道。…

网络安全运维实训室建设方案

一、网络安全运维人才需求与实训困境 在数字化时代&#xff0c;网络安全已成为国家安全、社会稳定和经济发展的重要基石。随着信息技术的飞速发展&#xff0c;网络安全威胁日益复杂多样&#xff0c;从个人隐私泄露到企业商业机密被盗&#xff0c;从关键基础设施遭受攻击到社会…

DBeaver 连接mysql报错:CLIENT_PLUGIN_AUTH is required

DBeaver 连接mysql报错&#xff1a;CLIENT_PLUGIN_AUTH is required 一、必须要看这个 >> &#xff1a;参考文献 二、补充 2.1 说明 MySQL5、6这些版本比较老&#xff0c;而DBeaver默认下载的是MySQL8的连接库&#xff0c;所以连接旧版本mysql报错&#xff1a;CLIEN…

Web3时代的数据保护挑战与应对策略

随着互联网技术的飞速发展&#xff0c;我们正步入Web3时代&#xff0c;这是一个以去中心化、用户主权和数据隐私为核心的新时代。然而&#xff0c;Web3时代也带来了前所未有的数据保护挑战。本文将探讨这些挑战&#xff0c;并提出相应的应对策略。 数据隐私挑战 在Web3时代&a…

Qwen3与MCP协议:重塑大气科学的智能研究范式

在气象研究领域&#xff0c;从海量数据的解析到复杂气候模型的构建&#xff0c;科研人员长期面临效率低、门槛高、易出错的挑战。而阿里云推出的Qwen3大模型与MCP协议的结合&#xff0c;正通过混合推理模式与标准化协同机制&#xff0c;为大气科学注入全新活力。本文将深入解析…

CppCon 2015 学习:Benchmarking C++ Code

关于性能问题与调试传统 bug&#xff08;如段错误&#xff09;之间差异的分析。以下是对这一页内容的详细解释&#xff1a; 主题&#xff1a;传统问题&#xff08;如段错误&#xff09;调试流程清晰 问题类型&#xff1a;段错误&#xff08;Segmentation Fault&#xff09; …

linux 故障处置通用流程-36计+1计

通用标准处置快速索引 编号 通 用 标 准 处 置 索 引 001 Linux操作系统标准关闭 002 Linux操作系统标准重启 003 Linux操作系统强行关闭 004 Linux操作系统强行重启 005 检查Linux操作系统CPU负载 006 查询占用CPU资源最多的进程 007 检查Linux操…