开发者

Subcontrols not visible in custom control derived from another control

I'm trying to create a custom control by deriving from a ZedGraphControl

I need to add a ProgressBar to the control, but I encountered some开发者_如何转开发 problems.

When I create a custom control and add both, ZedGraphCOntrol and ProgressBar to it, everything is OK:

MyCustomControl
{
    ZedGraphControl
    ProgressBar
}

All elemnets are visible and working as expected.

But I need to derive from ZGC and when I add a progress bar as a subcontrol of ZedGraphControl:

MyCustomControl : ZedGRaphControl
{
   ProgressBar
}

The progress bar is not visible.

Is there any way to force the visibility of ProgressBar? Is it possible, that ZedGraphControl is not displaying its subcontrols? I tried do the same thing with a simple button and it's also not being displayed.


it seems that I solved the problem... There must be a call to the InitializeComponent() method in the Control's constructor.
When I was creating a custom control, it was added by default by the VS. But while deriving from ZedGraphControl I was creating the constructor from scratch, and that's why the subcontrols were not visible.

So the question can be closed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜