资源简介
使用C#编写winform的仿真飞行仪表盘,可实现俯仰角,滚动角,航向角的可视化监测
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Dashboard
{
public partial class Form1 : Form
{
public Image imgtmp;
public Image imgori;
public Bitmap bitmp;
public Bitmap bm;
public bool IsSure = false;
double DbPitchAngle = new double(); //俯仰角度[-9090]
double DbRowAngle = new double(); //滚转角度[-180180]
double DbYawAngle = new double(); //航向角度[-4545]
public Form1()
{
InitializeComponent();
}
//重绘旋转后的仪表盘图片
public void Overlap(Bitmap btm int x int y int w int h)
{
Bitmap image = new Bitmap(btm);
Bitmap hi = new Bitmap(bm);
Graphics g = Graphics.FromImage(hi);
g.DrawImage(image new Rectangle(x y w h));
bm = hi;
}
//-------------------磁罗盘显示函数-------------------//
//入口参数:
//航向角 dir_angle 范围0~360 度
private void Compass_Disp(double dir_angle)
{
string file = System.IO.Path.Combine(Environment.CurrentDirectory @“point.jpg“);
bitmp = new Bitmap(file);
Bitmap pointImage = new Bitmap(250 250);
System.Drawing.Graphics gPoint = System.Drawing.Graphics.FromImage(pointImage);
gPoint.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
gPoint.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//计算偏移量
Rectangle rectPoint = new Rectangle(0 0 250 250);
gPoint.TranslateTransform(125 125);
//g.RotateTransform(360 - row_angle);
gPoint.RotateTransform((float)dir_angle);
//恢复图像在水平和垂直方向的平移
gPoint.TranslateTransform(-125 -125);
gPoint.DrawImage(bitmp rectPoint);
//重至绘图的所有变换
gPoint.ResetTransform();
gPoint.Dispose();
//保存旋转后的图片
bm = pointImage;
Overlap(pointImage 0 0 250 250);
CompointBox.Image = bm;
// 刻度盘截圆
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
gp.FillMode = 0;
gp.AddEllipse(new Rectangle(0 0 350 350));
ComshellBox.Region = new Region(gp);
//表盘截圆
System.Drawing.Drawing2D.GraphicsPath gp1 = new System.Drawing.Drawing2D.GraphicsPath();
gp1.FillMode = 0;
gp1.AddEllipse(new Rectangle(0 0 250 250));
CompointBox.Region = new Region(gp1);
gp1.Dispose();
gp.Dispose();
gPoint.Dispose();
bitmp.Dispose();
//Graphics gp1 = CompointBox.CreateGraphics();
//gp
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 36801 2018-08-25 16:49 仪表盘\Dashboard\Dashboard\11.jpg
文件 36801 2018-08-25 16:49 仪表盘\Dashboard\Dashboard\bin\Debug\11.jpg
文件 24939 2018-08-24 20:49 仪表盘\Dashboard\Dashboard\bin\Debug\compass.jpg
文件 89600 2018-12-26 11:43 仪表盘\Dashboard\Dashboard\bin\Debug\Dashboard.exe
文件 28160 2018-12-26 11:43 仪表盘\Dashboard\Dashboard\bin\Debug\Dashboard.pdb
文件 11600 2018-12-26 11:43 仪表盘\Dashboard\Dashboard\bin\Debug\Dashboard.vshost.exe
文件 490 2012-06-06 02:06 仪表盘\Dashboard\Dashboard\bin\Debug\Dashboard.vshost.exe.manifest
文件 13901 2018-08-24 20:50 仪表盘\Dashboard\Dashboard\bin\Debug\point.jpg
文件 24939 2018-08-24 20:49 仪表盘\Dashboard\Dashboard\compass.jpg
文件 3908 2018-12-26 11:29 仪表盘\Dashboard\Dashboard\Dashboard.csproj
文件 9711 2018-12-26 11:44 仪表盘\Dashboard\Dashboard\Form1.cs
文件 5138 2018-12-26 11:44 仪表盘\Dashboard\Dashboard\Form1.Designer.cs
文件 6011 2018-12-26 11:44 仪表盘\Dashboard\Dashboard\Form1.resx
文件 526 2018-12-26 11:43 仪表盘\Dashboard\Dashboard\obj\x86\Debug\Dashboard.csproj.FileListAbsolute.txt
文件 1061 2018-12-26 11:41 仪表盘\Dashboard\Dashboard\obj\x86\Debug\Dashboard.csproj.GenerateResource.Cache
文件 89600 2018-12-26 11:43 仪表盘\Dashboard\Dashboard\obj\x86\Debug\Dashboard.exe
文件 180 2018-12-26 11:41 仪表盘\Dashboard\Dashboard\obj\x86\Debug\Dashboard.Form1.resources
文件 28160 2018-12-26 11:43 仪表盘\Dashboard\Dashboard\obj\x86\Debug\Dashboard.pdb
文件 76481 2018-12-26 11:42 仪表盘\Dashboard\Dashboard\obj\x86\Debug\Dashboard.Properties.Resources.resources
文件 2867 2018-12-26 11:06 仪表盘\Dashboard\Dashboard\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6460 2018-12-26 11:43 仪表盘\Dashboard\Dashboard\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 5120 2018-12-26 11:12 仪表盘\Dashboard\Dashboard\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 13901 2018-08-24 20:50 仪表盘\Dashboard\Dashboard\point.jpg
文件 490 2018-12-26 11:06 仪表盘\Dashboard\Dashboard\Program.cs
文件 36801 2018-08-25 16:49 仪表盘\Dashboard\Dashboard\Properties\11.jpg
文件 1350 2018-12-26 11:06 仪表盘\Dashboard\Dashboard\Properties\AssemblyInfo.cs
文件 24939 2018-08-24 20:49 仪表盘\Dashboard\Dashboard\Properties\compass.jpg
文件 13901 2018-08-24 20:50 仪表盘\Dashboard\Dashboard\Properties\point.jpg
文件 3961 2018-12-26 11:12 仪表盘\Dashboard\Dashboard\Properties\Resources.Designer.cs
文件 6645 2018-12-26 11:12 仪表盘\Dashboard\Dashboard\Properties\Resources.resx
............此处省略17个文件信息
- 上一篇:C#动态添加数据到折线图
- 下一篇:winform自绘波形,鼠标滚轮滚动缩放波形尺寸
相关资源
- winform自绘波形,鼠标滚轮滚动缩放波
- C# winform 宿舍管理系统 ,vs2010开发,
- C# winform实现简单的贪吃蛇
- C#TCP服务器和客户端Winform源代码
- winform动态生成label和控件拖动(C#.N
- Winform利用资源文件实现多国语言(含
- winform 多语言化支持Demo
- C#_winform_html编辑器_富文本编辑器③
- Winform实现类似Viso的简单的流程图
- C#语音对讲源码
- winform 快速开发框架 仓库管理系统源
- 利用C#Winform实现区域截屏
- c#员工信息管理系统
- Winform DataGridView中利用WebClient异步加载
- WinForm BackgroundWorker完美
- C# Winform 图形缩放平移
- winform 很好用的分页控件带SQL数据库
- Devexpress GridControl冻结头部几行
- .NET C#研发的授权工具winform
- Winform C#Socket异步通信
- 在winform下,利用控件ZedGraph控件绘制
- C#WinForm获取子窗口返回值
- C#Winform温度计控件
- winForm word转pdf excel转pdf
- Textbox背景透明(winform)
- c#+WINFORM+漂亮的软件启动界面特效源码
- C#winform实现钢琴7音
- C#WinForm使用CefSharp内嵌
- Winform可视化打印模板设计(完整版)
- zw_cwinform用鼠标画拉出来的虚线框鼠标
评论
共有 条评论