IL code from the custom control (C #)

zhaozj2021-02-16  81

Problems encountered when they have customizes

When making a WinForm's custom control, you want to add a picture displayed on the toolbar to use the method to use help: [ToolboxBitmap (MyControl), "MyControl)] Class MyControl: userControl {} But In the toolbox, I can't display it, or the icon of that gear, finally finally found the part of the WEB control in the help: Did not compile the bitmap to the control into the DLL, modify the generating operation of the bitmap " After embedded resources, everything is fine.

Suddenly thought of using the Reflector to see if there is a resources node, you can see the bitmap after expanding, and I have never been taken before. After finding the information, I understand the resources embedded in the DLL are also tagged in the IL: .rsrc (nonsense, not marking how to compile it?) Resource part of the resource section of the control DLL refinement:

.mresource public CustomButton.Resource1.resources {}. mresource public CustomButton.UserControl1.resources {}. mresource public CustomButton.Bitmap1.bmp {} truest sense of the .mresource mark is Manifest Resource declarations rather than I expected Manage Resource, But what should this manifest understand that it is still suitable for this. Please also advise you.

转载请注明原文地址:https://www.9cbs.com/read-14643.html

New Post(0)