-- 作者:jiangxun
-- 发布时间:2017/11/29 22:53:00
-- 第三方控件事件问题请求帮助
1、控件代理事件代码
/// when a new connection is added event /// </summary> /// public delegate bool ConnectionInfo(object sender, ConnectionEventArgs e); public delegate bool ConnectionInfo(object sender, ConnectionEventArgs e);
这里这个bool可能是出错的来源
2、控件事件类
using System; using System.Collections; using System.ComponentModel; using System.Drawing.Design;
namespace Netron.GraphLib { /// <summary> /// Provides data for the new connection event /// </summary> public class ConnectionEventArgs : EventArgs { #region Fields /// <summary> /// the end of the connection /// </summary> private Connector to; /// <summary> /// the start of the connection /// </summary> private Connector from; /// <summary> /// the connection under consideration /// </summary> private Connection connection; /// <summary> /// whether it was added via the mouse /// </summary> private bool manual = false; #endregion
/// <summary> /// Gets whether the new connection was created manually, i.e. via user interaction. /// If false it means that the connection was created programmatically. /// </summary> public bool Manual { get{return manual;} }
/// <summary> /// Initializes a new instance of the ConnectionEventArgs class. /// </summary> public ConnectionEventArgs(Connection connection) { this.connection=connection; this.to=connection.To; this.from=connection.From; }
/// <summary> /// Constructor /// </summary> /// <param name="connection"></param> /// <param name="manual"></param> public ConnectionEventArgs(Connection connection, bool manual) { this.connection=connection; this.to=connection.To; this.from=connection.From; this.manual = manual; }
/// <summary> /// Gets the newly created connection /// </summary> public Connection Connection { get { return connection; } }
/// <summary> /// Gets the \'to\' connector of the connection /// </summary> public Connector To { get { return to; } } /// <summary> /// Gets the \'from\' connector of the connection /// </summary> public Connector From { get { return from; } } }
}
3、我的全局代码
Public Sub GraphControl_OnConnectionAdd(ByVal sender As System.Object, ByVal e As Netron.GraphLib.ConnectionEventArgs) messagebox.show(sender.from) End Sub
我的窗口afterload调用事件代码
AddHandler graphControl1.OnConnectionAdded, AddressOf GraphControl_OnConnectionAdd
4、报错内容
此主题相关图片如下:qq截图20171129224044.png

急,请求帮助
另一各成功的事件就没报错如下:
/// <summary> /// when a new shape is added /// </summary> public delegate void ShapeInfo(object sender, Shape shape);
全局代码
Public Sub GraphControl_OnShapeAdd(ByVal sender As System.Object, ByVal e As Netron.GraphLib.Shape) messagebox.show(sender.text) End Sub 窗口afterload调用代码 AddHandler graphControl1.OnShapeAdded, AddressOf GraphControl_OnShapeAdd
请求帮助
|