小女子求助大神帮我解析一段C#的code,看不懂,十分捉急

diandian123 发布于 2013/12/04 11:17
阅读 305
收藏 1

如果可以的话,可以加QQ交流吗?这个,,拜托了

using System;

using System.ComponentModel;

using System.Windows.Forms;

using System.Collections;

using System.Drawing;

using System.Text;

using System.Data;

namespace AvionicsInstrumentControlDemo

{

class HeadingIndicatorInstrumentControl : InstrumentControl

{

#region Field

// Parameters

int Heading;

 // Images

 Bitmap bmpCadran = new Bitmap(AvionicsInstrumentControlDemo.AvionicsInstrumentsControls.AvionicsInstrumentsControlsRessources.HeadingIndicator_Background);

Bitmap bmpHedingWeel = new Bitmap(AvionicsInstrumentControlDemo.AvionicsInstrumentsControls.AvionicsInstrumentsControlsRessources.HeadingWeel);

Bitmap bmpAircaft = new Bitmap(AvionicsInstrumentControlDemo.AvionicsInstrumentsControls.AvionicsInstrumentsControlsRessources.HeadingIndicator_Aircraft);

 #endregion

#region Contructor

 /// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.Container components = null;

public HeadingIndicatorInstrumentControl()

{

// Double bufferisation

SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |

ControlStyles.AllPaintingInWmPaint, true);

}

#endregion

#region Component Designer generated code

private void InitializeComponent()

{

components = new System.ComponentModel.Container();

}

#endregion

#region Paint

protected override void OnPaint(PaintEventArgs pe)

{

// Calling the base class OnPaint

base.OnPaint(pe);

// Pre Display computings

Point ptRotation = new Point(150, 150);          

Point ptImgAircraft = new Point(73, 41);

Point ptImgHeadingWeel = new Point(13, 13);

bmpCadran.MakeTransparent(Color.Yellow);

bmpHedingWeel.MakeTransparent(Color.Yellow);

bmpAircaft.MakeTransparent(Color.Yellow);

double alphaHeadingWeel = InterpolPhyToAngle(Heading, 0, 360, 360, 0);

float scale = (float)this.Width / bmpCadran.Width;

// diplay mask

Pen maskPen = new Pen(this.BackColor, 30 * scale);

pe.Graphics.DrawRectangle(maskPen, 0, 0, bmpCadran.Width * scale, bmpCadran.Height * scale);

// display cadran

pe.Graphics.DrawImage(bmpCadran, 0, 0, (float)(bmpCadran.Width * scale), (float)(bmpCadran.Height * scale));

// display HeadingWeel

RotateImage(pe, bmpHedingWeel, alphaHeadingWeel, ptImgHeadingWeel, ptRotation, scale);

 // display aircraft

pe.Graphics.DrawImage(bmpAircaft, (int)(ptImgAircraft.X * scale), (int)(ptImgAircraft.Y * scale), (float)(bmpAircaft.Width * scale), (float)(bmpAircaft.Height * scale));

}

#endregion

#region Methods

/// <summary>

/// Define the physical value to be displayed on the indicator

public void SetHeadingIndicatorParameters(int aircraftHeading)

{

Heading = aircraftHeading;

this.Refresh();

}

#endregion

}

}

加载中
0
diandian123
diandian123

这个是一个动态罗盘的图片组成code,如图

这是成型的headingindicatorinstrumentcontrol 它会根据我从control板里拿出的数据成像

0
diandian123
diandian123

这个是底板 heading indicator background

0
diandian123
diandian123
这个是转盘,也就是唯一的一个会动的部分,
0
diandian123
diandian123
这个就是指针,当然这个和底板是一体的,不懂得
0
zhizhang007
zhizhang007

结构很清晰么~

diandian123
diandian123
回复 @MyKings : 这个是QQ邮箱吧。
zhizhang007
zhizhang007
回复 @diandian123 : MyKingseft@163.com
diandian123
diandian123
拜托拜托了,还有那个Instrumentcontrol 里面算法,拜托了,可以吗?
diandian123
diandian123
这个,看得懂最好啦!那方便加个QQ跟我讲一下吗?这样会比较方便
0
把妹达人老张
把妹达人老张

引用来自“南湖船老大”的答案

是妹子?@张子游
哥喜欢男人
南湖船老大
南湖船老大
这不科学
返回顶部
顶部