.net - Manually Add a Resource File (Visual Studio) -
I have a solution in VB.NET (VS 2005)
In this solution, I have a custom Control, which is obtained from an abstract class.
Now, like V. S. V.S. It does not want to display control in the designer, because the essence of her parents is abstract.
Now, I want to add a photo box with this image box (BMP or ICO) in this control. Generally I have done the job of opening the designer and pulling the pictureback box, the background selection is also an image.
But as the designer is unavailable, how do I add the image to my control?
You have two options:
1 Project Resource Format Add images to, and then create and create PictureBox controls at runtime.
It is a bit messy, but resolves the problem. Add image to project resources. And there is something like this on the runtime:
PictureBox pb = new image box (); Pb.Image = (bitmap) global :: MyProject.MyImage; MyCustomControl.Controls.Add (PB); Pb.Location = new point (X, Y); // and any other attributes that require setting
2 Correct the design time properties of your control
This better long term solution is. There is a lot of information about "designer" features in MSDN, which is similar to code that runs in design mode, so that you can interact with a control in Visual Studio. Sometimes VS It's great for you to find some parts of the designer, second time you have to give some help to it just because a control is based on an intangible class does not mean that you do not set up a designer for it. Can.
Comments
Post a Comment