私はカスタムコントロール、ツールバーを作成する方法を学びたいと考えています。 .NET Reflectorを使用して、私はToolStripDesignerクラスを "書き直そう"ことを試みました(今のところ、リフレクターからVisual Studioにコードをコピーするだけです)。 System.Design.dllの内部では多くのクラスを使用しているので、リフレクターでいくつかのクラスをコピーする必要がありました。 System.Windows.Forms.Design.OleDragDropHandler
クラスでは、私はこのコードを発見しました:フラグの列挙型のバイナリ操作
DragDropEffects allowedEffects = DragDropEffects.Move | DragDropEffects.Copy;
for (int i = 0; i < components.Length; i++)
{
InheritanceAttribute attribute = (InheritanceAttribute) TypeDescriptor.GetAttributes(components[i])[typeof(InheritanceAttribute)];
if (!attribute.Equals(InheritanceAttribute.NotInherited) && !attribute.Equals(InheritanceAttribute.InheritedReadOnly))
{
allowedEffects &= ~DragDropEffects.Move;
allowedEffects |= 0x4000000; // this causes error
}
}
DragDropEffects列挙はこれらの分野で、公開されている:
[Flags]
public enum DragDropEffects {
Scroll = -2147483648, // 0x80000000
All = -2147483645, // 0x80000003
None = 0,
Copy = 1,
Move = 2,
Link = 4,
}
あなたが見ることができるように、最初の部分に示されている値とはフィールドがありませんのコード(0x4000000)。 また、このコードはVSにエラーをスローします:operator |= cannot be applied to operands of type System.Windows.Forms.DragDropEffects and int
私の質問は - どのようにこのコンパイルでしたか?または.NET Reflectorが逆コンパイルプロセスで間違いを犯した可能性がありますか?何か方法はありませんか?(allowedEffects
変数でこの奇妙な無名の情報を失うことなく)それをバイパスする方法はありますか?
ILSpyをmetioningしてくれてありがとう、別のツールを使って学ぶ時間;) –