C# 绘制正弦曲线实现示例:Form1_Resize 和 Form1_Paint 方法的使用

在 C# 中绘制正弦曲线时,需要使用 Form1_ResizeForm1_Paint 方法。以下是实现该功能的源代码示例:

int x1, x2;
double y1, y2;
double a;
Pen myPen = new Pen(Color.Blue, 3);

x1 = x2 = 0;
y1 = y2 = this.ClientSize.Height / 2;

for (x2 = 0; x2 < this xss=removed xss=removed xss=removed xss=removed xss=removed>

此代码片段展示了如何在窗口中动态绘制正弦曲线,使用了 Pen 对象进行绘制。

rar
Sin.rar 预估大小:23个文件
folder
Sin 文件夹
file
Sin.sln 899B
file
Sin.suo 12KB
folder
Sin 文件夹
file
Form1.cs 1KB
folder
bin 文件夹
folder
Debug 文件夹
file
Sin.exe 8KB
file
Sin.vshost.exe.manifest 490B
file
Sin.pdb 22KB
file
Sin.vshost.exe 14KB
folder
obj 文件夹
folder
Debug 文件夹
file
Sin.exe 8KB
file
Sin.pdb 22KB
file
Sin.csproj.FileListAbsolute.txt 328B
file
Sin.Properties.Resources.resources 180B
folder
TempPE 文件夹
file
Sin.csproj.GenerateResource.Cache 847B
file
Sin.Form1.resources 180B
folder
Properties 文件夹
file
Resources.Designer.cs 3KB
file
Settings.settings 249B
file
Resources.resx 5KB
file
Settings.Designer.cs 1KB
file
AssemblyInfo.cs 1KB
file
Program.cs 484B
file
Form1.Designer.cs 2KB
file
Form1.resx 6KB
file
Sin.csproj 4KB
file
新建 文本文档.txt 734B
rar 文件大小:33.39KB