I have recently started to learn image processing. I will record what I learn, and after I finish writing it, a small software will be released~
Here is: drawing an official seal.
#region 绘制公章 private void simpleButton_绘制公章_Click(object sender, EventArgs e) { int tem_Line = 0; //圆的直径 int circularity_W = 5; //画笔的粗细 string star_Str = "★"; //星星 Font star_Font = new Font("Arial", 30, FontStyle.Regular);//设置星号的字体样式 #region 画圆 if (panel_绘制公章.Height > panel_绘制公章.Width) //如果panel控件的高度大于等于宽度 { tem_Line = panel_绘制公章.Width; //设置宽度为圆的直径 } else { tem_Line = panel_绘制公章.Height; //设置高度为圆的直径 } //设置圆的绘制区域=>现在是正方形的区域 rect = new Rectangle(circularity_W, circularity_W, tem_Line - 2 * circularity_W, tem_Line - 2 * circularity_W); //补充:Graphics必须有载体,也就是在哪里绘 //所以必须是this.CreateGraphics或者Panel..CreateGraphics等格式 Graphics g = panel_绘制公章.CreateGraphics();//实例化Graphics类 //消除绘制图形的锯齿 g.SmoothingMode = SmoothingMode.AntiAlias; //System.Drawing.Drawing2D; g.Clear(Color.White); //以白色清空panel1控件的背景,防止重复画 Pen myPen = new Pen(Color.Red, circularity_W); //设置画笔(颜色和粗细) g.DrawEllipse(myPen, rect); //绘制圆 #endregion #region 画星星 SizeF Var_Size = new SizeF(rect.Width, rect.Height); //实例化SizeF类 Var_Size = g.MeasureString(star_Str, star_Font); //对指定字符串进行测量 //正中间的位置绘制星号 float star_x = (rect.Width / 2F) + circularity_W - Var_Size.Width / 2F; float star_y = rect.Height / 2F - Var_Size.Width / 2F; g.DrawString(star_Str, star_Font, myPen.Brush, new PointF(star_x, star_y)); #endregion #region 画文字 Var_Size = g.MeasureString("本人专用章", Var_Font);//对指定字符串进行测量 //绘制文字:在中间,但是在星星下面 float m = (rect.Width / 2F) + circularity_W - Var_Size.Width / 2F; float n = rect.Height / 2F + Var_Size.Height * 2; g.DrawString("本人专用章", Var_Font, myPen.Brush, new PointF(m, n)); int len = 0; if (inputWords != null) //如果没有输入文字,加判断 { len = inputWords.Length;//获取字符串的长度 } float angle = 180;//设置文字的初始旋转角度 float change = 0; if (len > 1) //一个字的需要特殊处理 { change = 180 / (len - 1); } for (int i = 0; i < len; i++)//将文字以指定的弧度进行绘制 { if (len > 1) { //相当于把坐标系移动到了正中间 float x = (tem_Line + circularity_W / 2) / 2; float y = (tem_Line + circularity_W / 2) / 2; //将指定的平移添加到g的变换矩阵前 g.TranslateTransform(x, y); g.RotateTransform(angle);//将指定的旋转用于g的变换矩阵 Brush myBrush = Brushes.Red;//定义画刷 //需要注意,这时文字的位置的坐标位置是以新的坐标系为基础得到的 float words_x = tem_Line / 2 - 6 * circularity_W; float words_y = 0; g.DrawString(inputWords.Substring(i, 1), Var_Font, myBrush, words_x, words_y);//显示旋转文字 g.ResetTransform();//将g的全局变换矩阵重置为单位矩阵=>对应TranslateTransform,相当于恢复操作 angle += change;//设置下一个文字的角度 } else { //输入的文字为一个时候是特殊情况,单独考虑 float x = (tem_Line + circularity_W / 2) / 2; float y = (tem_Line + circularity_W / 2) / 2; g.TranslateTransform(x, y); g.RotateTransform(0); Brush myBrush = Brushes.Red; float words_x = -circularity_W*3; float words_y = -(tem_Line / 2 - 2 * circularity_W); g.DrawString(inputWords.Substring(i, 1), Var_Font, myBrush, words_x, words_y); g.ResetTransform(); } } #endregion } private void simpleButton2_Click(object sender, EventArgs e) { inputWords = textBox_文字.Text; MessageBox.Show("保存成功!"); } #endregion
Effect preview:

The C#.NET ecosystem provides rich frameworks and libraries to help developers build applications efficiently. 1.ASP.NETCore is used to build high-performance web applications, 2.EntityFrameworkCore is used for database operations. By understanding the use and best practices of these tools, developers can improve the quality and performance of their applications.

How to deploy a C# .NET app to Azure or AWS? The answer is to use AzureAppService and AWSElasticBeanstalk. 1. On Azure, automate deployment using AzureAppService and AzurePipelines. 2. On AWS, use Amazon ElasticBeanstalk and AWSLambda to implement deployment and serverless compute.

The combination of C# and .NET provides developers with a powerful programming environment. 1) C# supports polymorphism and asynchronous programming, 2) .NET provides cross-platform capabilities and concurrent processing mechanisms, which makes them widely used in desktop, web and mobile application development.

.NETFramework is a software framework, and C# is a programming language. 1..NETFramework provides libraries and services, supporting desktop, web and mobile application development. 2.C# is designed for .NETFramework and supports modern programming functions. 3..NETFramework manages code execution through CLR, and the C# code is compiled into IL and runs by CLR. 4. Use .NETFramework to quickly develop applications, and C# provides advanced functions such as LINQ. 5. Common errors include type conversion and asynchronous programming deadlocks. VisualStudio tools are required for debugging.

C# is a modern, object-oriented programming language developed by Microsoft, and .NET is a development framework provided by Microsoft. C# combines the performance of C and the simplicity of Java, and is suitable for building various applications. The .NET framework supports multiple languages, provides garbage collection mechanisms, and simplifies memory management.

C# and .NET runtime work closely together to empower developers to efficient, powerful and cross-platform development capabilities. 1) C# is a type-safe and object-oriented programming language designed to integrate seamlessly with the .NET framework. 2) The .NET runtime manages the execution of C# code, provides garbage collection, type safety and other services, and ensures efficient and cross-platform operation.

To start C#.NET development, you need to: 1. Understand the basic knowledge of C# and the core concepts of the .NET framework; 2. Master the basic concepts of variables, data types, control structures, functions and classes; 3. Learn advanced features of C#, such as LINQ and asynchronous programming; 4. Be familiar with debugging techniques and performance optimization methods for common errors. With these steps, you can gradually penetrate the world of C#.NET and write efficient applications.

The relationship between C# and .NET is inseparable, but they are not the same thing. C# is a programming language, while .NET is a development platform. C# is used to write code, compile into .NET's intermediate language (IL), and executed by the .NET runtime (CLR).


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
