嗨,我正在尝试修复此代码以进行编译但找不到方法
错误:
Pro\AGeeksToy\Controls\LadderHeader.cs(218,98):错误 CS0426:类型名称 'menuData' 不存在于类型 'AGeeksToy.CoreDataTypes.AGeeksToyToolStripMenuItem>'
这是错误。
private void ChangeStakingType(AGeeksToyToolStripMenuItem<EnhancedType<StakingTypeEnum>>.menuData newType)
{
this.StakeBox.StakingType.Value = newType.Data.Value;
}
AGeeksToyToolStripMenuItem 类代码:
namespace AGeeksToy.CoreDataTypes
{
using System;
using System.Windows.Forms;
public abstract class AGeeksToyToolStripMenuItem<T> : ToolStripMenuItem, AGeeksToyMenu
{
public MouseButtons LastMouseButton;
public MenuData<T> menuData;
public static readonly VoidEventWithParam<MenuData<T>> RightClicked;
static AGeeksToyToolStripMenuItem()
{
AGeeksToyToolStripMenuItem<T>.RightClicked = new VoidEventWithParam<MenuData<T>>();
}
protected AGeeksToyToolStripMenuItem(T obj, string text) : this(obj, text, null)
{
}
protected AGeeksToyToolStripMenuItem(T obj, string text, Control ctrl)
{
base.DropDown.ImageList = IconManager.m_ImageList;
this.menuData = new MenuData<T>(obj, ctrl);
this.Text = text;
}
protected override void Dispose(bool disposing)
{
base.DropDown.ImageList = null;
base.Dispose(disposing);
}
protected override void OnClick(EventArgs e)
{
if (this.MenuControl != null)
{
this.MenuControl.Refresh();
}
base.OnClick(e);
if (this.LastMouseButton == MouseButtons.Right)
{
AGeeksToyToolStripMenuItem<T>.RightClicked.TriggerEvent(this.menuData);
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
this.LastMouseButton = e.Button;
base.OnMouseDown(e);
}
public virtual void SetMenu()
{
this.LastMouseButton = MouseButtons.Left;
if (this.MenuControl != null)
{
base.Visible = this.MenuControl.Visible;
this.Enabled = this.MenuControl.Enabled;
}
foreach (ToolStripItem item in base.DropDownItems)
{
if (item is AGeeksToyMenu)
{
(item as AGeeksToyMenu).SetMenu();
}
}
}
public T Menu_Data
{
get
{
return this.MenuObject;
}
}
protected Control MenuControl
{
get
{
return this.menuData.Control;
}
}
protected T MenuObject
{
get
{
return this.menuData.Data;
}
set
{
this.menuData.Data = value;
}
}
public class MenuData<T>
{
public System.Windows.Forms.Control Control;
public T Data;
public MenuData(T obj, System.Windows.Forms.Control ctrl)
{
this.Data = obj;
this.Control = ctrl;
}
}
}
}
http://i.stack.imgur.com/XfUIA.png
编译错误。
如果有人可以下载该项目或在此处查看可用的源代码
中继也可用,但还不能发布直接链接。
谢谢你的帮助