IM喜試圖以編譯爲了解決這個問題,並不能找到一種方法通用參數錯誤
錯誤:
Pro\AGeeksToy\Controls\LadderHeader.cs(218,98): error CS0426: The type name 'menuData' does not exist in the type '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
編譯錯誤。
如果任何人都可以在這裏
幹線也可用,但不能直接後鏈接來下載該項目或檢查源的產品尚未推出。
感謝您的任何幫助
請做,你的調試,然後回來,所以... – Mahm00d
這是在stackoverflow上最無用的問題之一。 – gdoron