Foxtable(狐表)用户栏目专家坐堂 → 第三方控件事件问题请求帮助


  共有2093人关注过本帖树形打印复制链接

主题:第三方控件事件问题请求帮助

帅哥哟,离线,有人找我吗?
jiangxun
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:876 积分:5929 威望:0 精华:0 注册:2014/8/3 12:15:00
第三方控件事件问题请求帮助  发帖心情 Post By: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

 

请求帮助


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/11/29 23:21:00 [只看该作者]

定义改成

 

Public Function GraphControl_OnConnectionAdd(ByVal sender As System.Object, ByVal e As Netron.GraphLib.ConnectionEventArgs) As Boolean
      messagebox.show(sender.from)
End Function


 回到顶部
帅哥哟,离线,有人找我吗?
jiangxun
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:876 积分:5929 威望:0 精华:0 注册:2014/8/3 12:15:00
  发帖心情 Post By:2017/11/30 0:21:00 [只看该作者]

谢谢图片点击可在新窗口打开查看

 回到顶部