사용자 지정 컨트롤, 도구 모음을 만드는 방법을 배우려고합니다. .NET Reflector를 사용하여 ToolStripDesigner 클래스를 "다시 작성"하려고했습니다 (지금은 리플렉터의 코드를 Visual Studio로 복사하는 것만을 의미합니다). System.Design.dll 내부에 많은 클래스를 사용하기 때문에 Reflector를 사용하여 클래스를 더 복사해야했습니다. 이 필드,플래그 열거 형에 대한 이진 연산
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 열거 공개 : System.Windows.Forms.Design.OleDragDropHandler
클래스에서이 코드를 발견했습니다 당신이 볼 수있는
[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 주셔서 감사합니다, 다른 도구를 사용하여 배울 시간;) –