资源简介
使用C# GDI+开发的基本飞行数据仪表,包括高度、速度和飞行姿态。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AttitudeInstrument
{
public partial class AirSpeedIndicator : UserControl
{
public AirSpeedIndicator()
{
InitializeComponent();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
//base.OnPaintBackground(e);
}
protected override void OnPaint(PaintEventArgs e)
{
if (e.ClipRectangle.Width == 0 || e.ClipRectangle.Height == 0)
return;
using (Bitmap bmp = new Bitmap((int)e.Graphics.VisibleClipBounds.Width (int)e.Graphics.VisibleClipBounds.Height))
{
Graphics g = Graphics.FromImage(bmp);
Pen whitePen = new Pen(Brushes.White 2.0f);
g.Clear(Color.FromArgb(57 49 66));
// 姿态仪的中心位置,即天地分割线的中点。
// 绘制俯仰角标尺时,每2.5°为15像素,因此俯仰角每变动1°,标尺应移动6像素,
// 故中心线也移动6像素
Point center = new Point((int)bmp.Width / 2 (int)(bmp.Height / 2 + _dblAirSpeed * 3));
// 可视的中心位置,即 LCD 的中心,该点在移动刻度时会用到
Point visibleCenter = new Point((int)bmp.Width / 2 (int)(bmp.Height / 2));
Font indicatorFont = new Font(“Time NewRoman“ 9);
double stringWidth = 0;
// 绘制空速表刻度线
for (int i = 0; i <= 500; i+=10)
{
g.DrawLine(whitePen (float)(bmp.Width - 10.0) (float)(bmp.Height/2 - 3.0 * i + _dblAirSpeed * 3) (float)(bmp.Width) (float)(bmp.Height/2 - 3.0 * i + _dblAirSpeed * 3));
stringWidth = g.MeasureString(i.ToString() indicatorFont).Width;
if (i % 20 == 0)
g.DrawString(i.ToString() indicatorFont Brushes.White (float)(bmp.Width - 10.0 - stringWidth) (float)(bmp.Height / 2 - 3.0 * i - 8 + _dblAirSpeed * 3));
}
Point[] indicator = new Point[8];
indicator[0] = new Point(bmp.Width - 45 visibleCenter.Y - 15);
indicator[1] = new Point(bmp.Width - 15 visibleCenter.Y - 15);
indicator[2] = new Point(bmp.Width - 15 visibleCenter.Y - 5);
indicator[3] = new Point(bmp.Width - 10 visibleCenter.Y);
indicator[4] = new Point(bmp.Width - 15 visibleCenter.Y + 5);
indicator[5] = new Point(bmp.Width - 15 visibleCenter.Y + 15);
indicator[6] = new Point(bmp.Width - 45 visibleCenter.Y + 15);
indicator[7] = new Point(bmp.Width - 45 visibleCenter.Y - 15);
g.FillPolygon(new SolidBrush(Color.FromArgb(16 16 49)) indicator);
g.DrawLines(whitePen indicator);
indicatorFont = new Fon
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3694 2012-01-20 14:51 AttitudeInstrument\AttitudeInstrument\AirSpeed\AirSpeed.cs
文件 1375 2012-01-20 12:01 AttitudeInstrument\AttitudeInstrument\AirSpeed\AirSpeed.Designer.cs
文件 619 2012-01-20 14:31 AttitudeInstrument\AttitudeInstrument\AirSpeed\AirSpeed.Properties.cs
文件 5814 2012-01-20 12:00 AttitudeInstrument\AttitudeInstrument\AirSpeed\AirSpeed.resx
文件 329 2012-01-20 14:31 AttitudeInstrument\AttitudeInstrument\AirSpeed\AirSpeed.Vars.cs
文件 3300 2012-01-20 15:00 AttitudeInstrument\AttitudeInstrument\Altitude\Altitude.cs
文件 1367 2012-01-20 14:56 AttitudeInstrument\AttitudeInstrument\Altitude\Altitude.Designer.cs
文件 620 2012-01-20 14:55 AttitudeInstrument\AttitudeInstrument\Altitude\Altitude.Properties.cs
文件 5814 2012-01-20 14:24 AttitudeInstrument\AttitudeInstrument\Altitude\Altitude.resx
文件 321 2012-01-20 14:56 AttitudeInstrument\AttitudeInstrument\Altitude\Altitude.Vars.cs
文件 5091 2012-01-20 15:06 AttitudeInstrument\AttitudeInstrument\AttitudeInstrument.csproj
文件 411 2012-01-20 15:27 AttitudeInstrument\AttitudeInstrument\BasicFlightInfo\BasicFlightInfo.cs
文件 3668 2012-01-20 15:27 AttitudeInstrument\AttitudeInstrument\BasicFlightInfo\BasicFlightInfo.Designer.cs
文件 1433 2012-01-20 15:07 AttitudeInstrument\AttitudeInstrument\BasicFlightInfo\BasicFlightInfo.Properties.cs
文件 5814 2012-01-20 15:27 AttitudeInstrument\AttitudeInstrument\BasicFlightInfo\BasicFlightInfo.resx
文件 12204 2012-01-20 15:16 AttitudeInstrument\AttitudeInstrument\PitchAndBank\PitchAndBank.cs
文件 1388 2012-01-20 14:28 AttitudeInstrument\AttitudeInstrument\PitchAndBank\PitchAndBank.Designer.cs
文件 933 2012-01-20 15:12 AttitudeInstrument\AttitudeInstrument\PitchAndBank\PitchAndBank.Properties.cs
文件 5814 2012-01-19 12:44 AttitudeInstrument\AttitudeInstrument\PitchAndBank\PitchAndBank.resx
文件 369 2012-01-20 14:29 AttitudeInstrument\AttitudeInstrument\PitchAndBank\PitchAndBank.Vars.cs
文件 1398 2012-01-19 11:57 AttitudeInstrument\AttitudeInstrument\Properties\AssemblyInfo.cs
文件 33238 2012-01-19 12:25 AttitudeInstrument\AttitudeInstrument\Resources\bg111.png
文件 1422 2012-05-09 02:00 AttitudeInstrument\AttitudeInstrument.sln
..A..H. 72192 2012-05-09 02:03 AttitudeInstrument\AttitudeInstrument.suo
文件 947 2012-05-09 02:02 AttitudeInstrument\TestForm\Form1.cs
文件 7764 2012-05-09 02:02 AttitudeInstrument\TestForm\Form1.Designer.cs
文件 5814 2012-05-09 02:02 AttitudeInstrument\TestForm\Form1.resx
文件 489 2012-01-19 19:32 AttitudeInstrument\TestForm\Program.cs
文件 1378 2012-01-19 19:32 AttitudeInstrument\TestForm\Properties\AssemblyInfo.cs
文件 2866 2012-01-19 19:32 AttitudeInstrument\TestForm\Properties\Resources.Designer.cs
............此处省略17个文件信息
相关资源
- 各类称重仪表C#源码
- 指针仪表识别halcon代码
- 仪表控件 C#包括圆表,直表测量标尺
- 仪表、开关、按钮、数码管、晶体管
- 电子秤称重仪表串口通讯c#程序
- WPF 数据可视化 大屏展示 实现地图仿
- IOComp.Net WinForms UltraPack 5.0SP1
- WpfGauge仪表盘控件可自定义仪表范围
- 用c#vs2005写的仿汽车仪表做的一个仪表
- 飞控的仪表盘
- WPF开发的仪表盘
- C#仿真飞行仪表盘
- C#做的漂亮的仪表盘
- flights.csv
- C#vs2010仪表盘(源码)
- c#做的两个仪表盘——最原始的仪表盘
- c# GUI+ 多种仪表盘显示
- wince5.0下C#绘制仪表盘控件及Demo源码
- C# 绚丽仪表控件,开关控件,彩色圆
- C#自定义控件之Winform仪表盘控件.zip
- Instrument 仪表盘控件
- C#开关 仪表 按钮等控件
- C#串口通信上位机含源代码
- winform 仪表盘
- WPF网络流量仪表盘
- C#漂亮的工业软件控件源码(含仪表盘
- C#指针仪表自动读数代码和工程halco
- Iocomp工业控件之仪表控件的使用
- AquaGauge仪表盘控件
- C# 仪表盘 源码
评论
共有 条评论