您的位置:首页 > 汽车 > 时评 > 网站建设湖南岚鸿建设_个人网页制作成品整页_百度网站链接提交_湘潭seo培训

网站建设湖南岚鸿建设_个人网页制作成品整页_百度网站链接提交_湘潭seo培训

2024/11/19 7:35:05 来源:https://blog.csdn.net/caoxuefei520/article/details/142833566  浏览:    关键词:网站建设湖南岚鸿建设_个人网页制作成品整页_百度网站链接提交_湘潭seo培训
网站建设湖南岚鸿建设_个人网页制作成品整页_百度网站链接提交_湘潭seo培训
1、DEMO存放位置
D:\Users\Public\Documents\Vector\CANoe\Sample Configurations 11.0.96\CAN\MoreExamples\ActiveX_DotNET_Panels

每个人的电脑因为有区别存放位置不一样

2、控件制作--使用C#控件可以直接制作

 3、控件代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Diagnostics;namespace CSharpPanels
{public class CSharpControl : System.Windows.Forms.UserControl{// Declare typesprivate CANoe.Application         App;private CANoe.Measurement         Measurement;private CANoe.Variable            svMotorSwitch = null;private CANoe.Variable            svTurnSignal = null;private CANoe.Variable            svEngineSpeedEntry = null;private System.Windows.Forms.Timer tmrSignals;private System.Windows.Forms.GroupBox fraMotor;private System.Windows.Forms.GroupBox fraLight;private System.Windows.Forms.Label lblDriving;private System.Windows.Forms.Label lblTurn;private System.Windows.Forms.Button btnLightSwitch;private System.Windows.Forms.Button btnTurnSignal;private System.Windows.Forms.GroupBox fraEntry;private System.Windows.Forms.TrackBar sliSpeedEntry;private System.Windows.Forms.Button btnMotorSwitch;private System.Windows.Forms.Label lblCaption;/// <summary>/// Required designer variable./// </summary>private System.ComponentModel.Container components = null;public CSharpControl(){// This call is required by the Windows.Forms Form Designer.InitializeComponent();// Initialize timer to get Signal changestmrSignals = new System.Windows.Forms.Timer(components);if (tmrSignals != null){tmrSignals.Enabled = true;tmrSignals.Tick += new System.EventHandler(tmrSignals_Tick);}// Initialize typesApp            = new CANoe.Application();Measurement    = (CANoe.Measurement)App.Measurement;CANoe.System system = (CANoe.System)App.System;if (system != null){CANoe.Namespaces namespaces = (CANoe.Namespaces)system.Namespaces;if (namespaces != null){CANoe.Namespace nsEngine = (CANoe.Namespace)namespaces["Engine"];if (nsEngine != null){CANoe.Variables engineVars = (CANoe.Variables)nsEngine.Variables;if (engineVars != null){svMotorSwitch = (CANoe.Variable)engineVars["MotorSwitch"];svEngineSpeedEntry = (CANoe.Variable)engineVars["EngineSpeedEntry"];if (svMotorSwitch != null)svMotorSwitch.OnChange += new CANoe._IVariableEvents_OnChangeEventHandler(svMotorSwitch_OnChange);if (svEngineSpeedEntry != null)svEngineSpeedEntry.OnChange += new CANoe._IVariableEvents_OnChangeEventHandler(svEngineSpeedEntry_OnChange);}}CANoe.Namespace nsLights = (CANoe.Namespace)namespaces["Lights"];if (nsLights != null){CANoe.Variables lightsVars = (CANoe.Variables)nsLights.Variables;if (lightsVars != null){svTurnSignal = (CANoe.Variable)lightsVars["TurnSignal"];if (svTurnSignal != null)svTurnSignal.OnChange += new CANoe._IVariableEvents_OnChangeEventHandler(svTurnSignal_OnChange);}}}}}/// <summary>/// Clean up any resources being used./// </summary>protected override void Dispose( bool disposing ){if( disposing ){if( components != null )components.Dispose();if (tmrSignals != null)tmrSignals.Dispose();}base.Dispose( disposing );}#region Component Designer generated code/// <summary>/// Required method for Designer support - do not modify /// the contents of this method with the code editor./// </summary>private void InitializeComponent(){this.components = new System.ComponentModel.Container();this.fraMotor = new System.Windows.Forms.GroupBox();this.btnMotorSwitch = new System.Windows.Forms.Button();this.fraLight = new System.Windows.Forms.GroupBox();this.btnTurnSignal = new System.Windows.Forms.Button();this.btnLightSwitch = new System.Windows.Forms.Button();this.lblTurn = new System.Windows.Forms.Label();this.lblDriving = new System.Windows.Forms.Label();this.fraEntry = new System.Windows.Forms.GroupBox();this.sliSpeedEntry = new System.Windows.Forms.TrackBar();this.lblCaption = new System.Windows.Forms.Label();this.fraMotor.SuspendLayout();this.fraLight.SuspendLayout();this.fraEntry.SuspendLayout();((System.ComponentModel.ISupportInitialize)(this.sliSpeedEntry)).BeginInit();this.SuspendLayout();// // fraMotor// this.fraMotor.Controls.Add(this.btnMotorSwitch);this.fraMotor.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.fraMotor.Location = new System.Drawing.Point(8, 32);this.fraMotor.Name = "fraMotor";this.fraMotor.Size = new System.Drawing.Size(104, 72);this.fraMotor.TabIndex = 0;this.fraMotor.TabStop = false;this.fraMotor.Text = "Motor Switch";// // btnMotorSwitch// this.btnMotorSwitch.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.btnMotorSwitch.Location = new System.Drawing.Point(24, 32);this.btnMotorSwitch.Name = "btnMotorSwitch";this.btnMotorSwitch.Size = new System.Drawing.Size(56, 25);this.btnMotorSwitch.TabIndex = 0;this.btnMotorSwitch.Text = "Off";this.btnMotorSwitch.Click += new System.EventHandler(this.btnMotorSwitch_Click);// // fraLight// this.fraLight.Controls.Add(this.btnTurnSignal);this.fraLight.Controls.Add(this.btnLightSwitch);this.fraLight.Controls.Add(this.lblTurn);this.fraLight.Controls.Add(this.lblDriving);this.fraLight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.fraLight.Location = new System.Drawing.Point(120, 32);this.fraLight.Name = "fraLight";this.fraLight.Size = new System.Drawing.Size(136, 72);this.fraLight.TabIndex = 1;this.fraLight.TabStop = false;this.fraLight.Text = "Light Switch";// // btnTurnSignal// this.btnTurnSignal.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.btnTurnSignal.Location = new System.Drawing.Point(78, 38);this.btnTurnSignal.Name = "btnTurnSignal";this.btnTurnSignal.Size = new System.Drawing.Size(40, 25);this.btnTurnSignal.TabIndex = 3;this.btnTurnSignal.Text = "Off";this.btnTurnSignal.Click += new System.EventHandler(this.btnTurnSignal_Click);// // btnLightSwitch// this.btnLightSwitch.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.btnLightSwitch.Location = new System.Drawing.Point(14, 38);this.btnLightSwitch.Name = "btnLightSwitch";this.btnLightSwitch.Size = new System.Drawing.Size(40, 25);this.btnLightSwitch.TabIndex = 2;this.btnLightSwitch.Text = "Off";this.btnLightSwitch.Click += new System.EventHandler(this.btnLightSwitch_Click);// // lblTurn// this.lblTurn.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblTurn.Location = new System.Drawing.Point(66, 20);this.lblTurn.Name = "lblTurn";this.lblTurn.Size = new System.Drawing.Size(66, 16);this.lblTurn.TabIndex = 1;this.lblTurn.Text = "Turn signal";// // lblDriving// this.lblDriving.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblDriving.Location = new System.Drawing.Point(14, 20);this.lblDriving.Name = "lblDriving";this.lblDriving.Size = new System.Drawing.Size(48, 16);this.lblDriving.TabIndex = 0;this.lblDriving.Text = "Driving";// // fraEntry// this.fraEntry.Controls.Add(this.sliSpeedEntry);this.fraEntry.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.fraEntry.Location = new System.Drawing.Point(8, 112);this.fraEntry.Name = "fraEntry";this.fraEntry.Size = new System.Drawing.Size(248, 72);this.fraEntry.TabIndex = 2;this.fraEntry.TabStop = false;this.fraEntry.Text = "Motor Entry";// // sliSpeedEntry// this.sliSpeedEntry.Location = new System.Drawing.Point(16, 24);this.sliSpeedEntry.Maximum = 3500;this.sliSpeedEntry.Name = "sliSpeedEntry";this.sliSpeedEntry.Size = new System.Drawing.Size(216, 45);this.sliSpeedEntry.TabIndex = 0;this.sliSpeedEntry.TickFrequency = 350;this.sliSpeedEntry.Scroll += new System.EventHandler(this.sliSpeedEntry_Scroll);// // lblCaption// this.lblCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblCaption.Location = new System.Drawing.Point(8, 8);this.lblCaption.Name = "lblCaption";this.lblCaption.Size = new System.Drawing.Size(256, 16);this.lblCaption.TabIndex = 3;this.lblCaption.Text = "C# Control";this.lblCaption.TextAlign = System.Drawing.ContentAlignment.TopCenter;// // CSharpControl// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.Controls.Add(this.lblCaption);this.Controls.Add(this.fraEntry);this.Controls.Add(this.fraLight);this.Controls.Add(this.fraMotor);this.Name = "CSharpControl";this.Size = new System.Drawing.Size(264, 192);this.fraMotor.ResumeLayout(false);this.fraLight.ResumeLayout(false);this.fraEntry.ResumeLayout(false);this.fraEntry.PerformLayout();((System.ComponentModel.ISupportInitialize)(this.sliSpeedEntry)).EndInit();this.ResumeLayout(false);}#endregionprivate void btnMotorSwitch_Click(object sender, System.EventArgs e){if (Measurement.Running){if (svMotorSwitch != null){if (btnMotorSwitch.Text == "Off"){svMotorSwitch.Value = 1;btnMotorSwitch.Text = "On";}else{svMotorSwitch.Value = 0;btnMotorSwitch.Text = "Off";}}}}private void svMotorSwitch_OnChange(object Value){int tmp = (int)Value;if (tmp == 0){btnMotorSwitch.Text = "Off";}else{btnMotorSwitch.Text = "On";}}private void btnLightSwitch_Click(object sender, System.EventArgs e){if (Measurement.Running){CANoe.Bus bus = null;try{bus = (CANoe.Bus)App.get_Bus("CAN");if (bus != null){CANoe.Signal signal = (CANoe.Signal)bus.GetSignal(1, "LightState", "OnOff");if (signal != null){if (btnLightSwitch.Text == "Off"){signal.Value = 1;btnLightSwitch.Text = "On";}else{signal.Value = 0;btnLightSwitch.Text = "Off";}}}}catch{}}}private void tmrSignals_Tick(object sender, System.EventArgs e){// get all the signal values and actualize controlsif (Measurement.Running){CANoe.Bus bus = null;try{bus = (CANoe.Bus)App.get_Bus("CAN");if (bus != null){CANoe.Signal signal = (CANoe.Signal)bus.GetSignal(1, "LightState", "OnOff");if (signal != null){if (signal.Value == 0)btnLightSwitch.Text = "Off";elsebtnLightSwitch.Text = "On";}}}catch{}}}private void btnTurnSignal_Click(object sender, System.EventArgs e){if (Measurement.Running){if (btnTurnSignal.Text == "Off") {if (svTurnSignal != null){svTurnSignal.Value = 1;btnTurnSignal.Text = "On";}}else{if (svTurnSignal != null){svTurnSignal.Value = 0;btnTurnSignal.Text = "Off";}}}}private void svTurnSignal_OnChange(object Value){int tmp = (int)Value;if (tmp == 0){btnTurnSignal.Text = "Off";}else{btnTurnSignal.Text = "On";}}private void sliSpeedEntry_Scroll(object sender, System.EventArgs e){if(Measurement.Running){if (svEngineSpeedEntry != null){double tmp = sliSpeedEntry.Value;svEngineSpeedEntry.Value = tmp;}}}private void svEngineSpeedEntry_OnChange(object Value){sliSpeedEntry.Value = (int)((double)Value);}}
}
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;namespace CSharpPanels
{public class CSharpDisplay : System.Windows.Forms.UserControl{// Declare typesprivate CANoe.Application App;private CANoe.Measurement Measurement;internal GroupBox fraEngineSpeed;internal GroupBox fraMotor;internal GroupBox fraLight;internal Label lblEngine;internal Label lblRunning;internal Label lblDriving;internal Label lblTurn;internal Label lblDrivingState;internal Label lblTurnState;private System.Windows.Forms.Timer tmrSignals;internal Label lblCaption;private System.ComponentModel.IContainer components;public CSharpDisplay(){// This call is required by the Windows.Forms Form Designer.InitializeComponent();// Initialize typesApp         = new CANoe.Application();Measurement = (CANoe.Measurement)App.Measurement;}protected override void Dispose( bool disposing ){if( disposing ){if(components != null){components.Dispose();}}base.Dispose( disposing );}#region Component Designer generated code/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor./// </summary>private void InitializeComponent(){this.components = new System.ComponentModel.Container();this.fraEngineSpeed = new System.Windows.Forms.GroupBox();this.lblEngine = new System.Windows.Forms.Label();this.fraMotor = new System.Windows.Forms.GroupBox();this.lblRunning = new System.Windows.Forms.Label();this.fraLight = new System.Windows.Forms.GroupBox();this.lblTurnState = new System.Windows.Forms.Label();this.lblDrivingState = new System.Windows.Forms.Label();this.lblTurn = new System.Windows.Forms.Label();this.lblDriving = new System.Windows.Forms.Label();this.tmrSignals = new System.Windows.Forms.Timer(this.components);this.lblCaption = new System.Windows.Forms.Label();this.fraEngineSpeed.SuspendLayout();this.fraMotor.SuspendLayout();this.fraLight.SuspendLayout();this.SuspendLayout();// // fraEngineSpeed// this.fraEngineSpeed.Controls.Add(this.lblEngine);this.fraEngineSpeed.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.fraEngineSpeed.Location = new System.Drawing.Point(6, 26);this.fraEngineSpeed.Name = "fraEngineSpeed";this.fraEngineSpeed.Size = new System.Drawing.Size(111, 39);this.fraEngineSpeed.TabIndex = 0;this.fraEngineSpeed.TabStop = false;this.fraEngineSpeed.Text = "Engine Speed";// // lblEngine// this.lblEngine.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblEngine.Location = new System.Drawing.Point(6, 14);this.lblEngine.Name = "lblEngine";this.lblEngine.Size = new System.Drawing.Size(101, 19);this.lblEngine.TabIndex = 0;this.lblEngine.Text = "0";this.lblEngine.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;// // fraMotor// this.fraMotor.Controls.Add(this.lblRunning);this.fraMotor.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.fraMotor.Location = new System.Drawing.Point(121, 26);this.fraMotor.Name = "fraMotor";this.fraMotor.Size = new System.Drawing.Size(99, 39);this.fraMotor.TabIndex = 1;this.fraMotor.TabStop = false;this.fraMotor.Text = "Motor State";// // lblRunning// this.lblRunning.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblRunning.Location = new System.Drawing.Point(6, 14);this.lblRunning.Name = "lblRunning";this.lblRunning.Size = new System.Drawing.Size(89, 19);this.lblRunning.TabIndex = 0;this.lblRunning.Text = "Not Running";this.lblRunning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;// // fraLight// this.fraLight.Controls.Add(this.lblTurnState);this.fraLight.Controls.Add(this.lblDrivingState);this.fraLight.Controls.Add(this.lblTurn);this.fraLight.Controls.Add(this.lblDriving);this.fraLight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.fraLight.Location = new System.Drawing.Point(6, 70);this.fraLight.Name = "fraLight";this.fraLight.Size = new System.Drawing.Size(214, 39);this.fraLight.TabIndex = 2;this.fraLight.TabStop = false;this.fraLight.Text = "Driving Light";// // lblTurnState// this.lblTurnState.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblTurnState.Location = new System.Drawing.Point(184, 17);this.lblTurnState.Name = "lblTurnState";this.lblTurnState.Size = new System.Drawing.Size(26, 15);this.lblTurnState.TabIndex = 3;this.lblTurnState.Text = "Off";this.lblTurnState.TextAlign = System.Drawing.ContentAlignment.TopRight;// // lblDrivingState// this.lblDrivingState.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblDrivingState.Location = new System.Drawing.Point(80, 17);this.lblDrivingState.Name = "lblDrivingState";this.lblDrivingState.Size = new System.Drawing.Size(26, 15);this.lblDrivingState.TabIndex = 2;this.lblDrivingState.Text = "Off";this.lblDrivingState.TextAlign = System.Drawing.ContentAlignment.TopRight;// // lblTurn// this.lblTurn.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblTurn.Location = new System.Drawing.Point(110, 17);this.lblTurn.Name = "lblTurn";this.lblTurn.Size = new System.Drawing.Size(76, 19);this.lblTurn.TabIndex = 1;this.lblTurn.Text = "Turn signal:";// // lblDriving// this.lblDriving.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));this.lblDriving.Location = new System.Drawing.Point(12, 17);this.lblDriving.Name = "lblDriving";this.lblDriving.Size = new System.Drawing.Size(63, 20);this.lblDriving.TabIndex = 0;this.lblDriving.Text = "Driving:";// // tmrSignals// this.tmrSignals.Enabled = true;this.tmrSignals.Tick += new System.EventHandler(this.tmrSignals_Tick);// // lblCaption// this.lblCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold);this.lblCaption.Location = new System.Drawing.Point(6, 6);this.lblCaption.Name = "lblCaption";this.lblCaption.Size = new System.Drawing.Size(214, 17);this.lblCaption.TabIndex = 3;this.lblCaption.Text = "C# Display";this.lblCaption.TextAlign = System.Drawing.ContentAlignment.TopCenter;// // CSharpDisplay// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.Controls.Add(this.lblCaption);this.Controls.Add(this.fraLight);this.Controls.Add(this.fraMotor);this.Controls.Add(this.fraEngineSpeed);this.Name = "CSharpDisplay";this.Size = new System.Drawing.Size(226, 117);this.fraEngineSpeed.ResumeLayout(false);this.fraMotor.ResumeLayout(false);this.fraLight.ResumeLayout(false);this.ResumeLayout(false);}#endregionprivate void tmrSignals_Tick(object sender, System.EventArgs e){// get all the signal values and actualize controlsif(Measurement.Running){CANoe.Configuration configuration     = null;CANoe.SimulationSetup simulationSetup = null; CANoe.Nodes nodes                     = null;CANoe.Node node                       = null;CANoe.Signals motorInputs             = null;CANoe.Signals motorControlInputs      = null;try{configuration   = (CANoe.Configuration)App.Configuration;simulationSetup = (CANoe.SimulationSetup)configuration.SimulationSetup;nodes           = (CANoe.Nodes)simulationSetup.Nodes;node            = (CANoe.Node)nodes["Motor"];motorInputs     = (CANoe.Signals)node.Inputs;if (motorInputs["OnOff"].Value == 0){lblRunning.Text = "Not Running";}else{lblRunning.Text = "Running";}lblEngine.Text = motorInputs["EngineSpeed"].Value.ToString();motorInputs = null;node = (CANoe.Node)nodes["MotorControl"];motorControlInputs = (CANoe.Signals)node.Inputs;if(motorControlInputs["OnOff"].Value == 0){lblDrivingState.Text = "Off";}else{lblDrivingState.Text = "On";}if(motorControlInputs["TurnSignal"].Value == 0){lblTurnState.Text = "Off";}else{lblTurnState.Text = "On";}}catch{}finally{motorControlInputs = null;node = null;nodes = null;simulationSetup = null;configuration = null;}}}}
}
4、运行效果展示

 

 5、总结

现在啊,汽车电子这块儿技术发展得太快了,对测试和验证这些系统的需求也越来越多。CANoe呢,就像一个超级英雄的工具,专门用来模拟和测试汽车里的网络通信。我们想了个招儿,就是做几个自己定义的小工具,这样跟CANoe打交道就更直观了,能实时看着汽车信号怎么样,还能动手调调。

小工具是咋设计的:

我们做了两个小帮手,一个叫CSharpControl,负责接收你给的信号指令;另一个叫CSharpDisplay,就像个小喇叭,告诉你信号现在是啥状态。这样一分工,它们的职责就很清楚了,以后维护起来也方便,想加点新功能也容易。

信号是怎么处理的:

我们靠CANoe的超能力,实时拿到信号的状态,然后有个定时器(就像个小闹钟,我们叫它tmrSignals),不停地检查信号有没有变,一变就更新到界面上。这样你就能随时知道系统啥情况了,用起来更顺手。

事件驱动是咋回事:

我们还用了个挺聪明的方法,就是事件驱动。比如说你点个按钮,或者信号变了,就会触发一些程序去处理这些事情。这样写代码就更灵活了,以后想加新功能也不费劲。

资源管理这块儿也很重要:

我们得确保用的资源,比如CANoe里的对象和定时器,用完了都得好好收起来,别占着地方。所以我们在控件不用的时候,重写了个Dispose方法,让它们都能被正确回收,这样就不会浪费内存了。

界面长啥样:

界面设计嘛,我们想着得让用户用着舒服。所以用了一些分组框,把控件都归类放好了,看起来就整齐多了。每个区域都有名字,一看就知道是干啥的。

以后还能怎么发展:

现在的设计已经挺好了,但未来还能更上一层楼。比如说,想加更多控制信号和显示的功能,或者把CANoe的其他超能力,比如记录和分析数据,也集成进来。

最后说说感受:

这个项目让我们学会了怎么用C#和CANoe API做个很厉害的用户控件,跟汽车电子系统玩得转。设计得好,不仅现在开发起来快,以后维护、升级也方便。以后啊,我们还要继续挖掘新技能,让用户体验和系统性能都更上一层楼!

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com