我不是动态添加自定义控件 [英] I'm not add Custom Control dynamically

查看:63
本文介绍了我不是动态添加自定义控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中有自定义控件(Checkers)和用户控件(Board)。



但是,我不能将Checker添加到Board。 />
我将Checker拖放到Form1,然后将检查器添加到Form_Load中,这个代码;

面板a = board1.AddControl() ;  //   AddControl是董事会控制中的事件 
a.Controls.Add(checkers1);







但是这段代码并没有添加跳棋;

< pre lang =c#> Checkers b = new Checkers();
a.Controls.Add(b);





如何在应用程序运行时在用户控件中添加Checker?

解决方案

我不知道你用 Checkers写的是什么 ??

但是这个怎么样.. ???

 Checkers b =  new  Checkers(); 
b.Size = ???
b.Position = ??? // X和Y坐标
b.Visible = ???



设置这种类型的属性并尝试一下;)GoOd LucK mate:)


I have Custom Control(Checkers) and User Control(Board) in my project.

But, I can''t add Checker to Board.
I drag and drop Checker to Form1 , then add the checker to board in Form_Load, this codes;

Panel a = board1.AddControl(); //AddControl is Event in Board Control
a.Controls.Add(checkers1);




But this code isn''t add the checkers;

Checkers b = new Checkers();
a.Controls.Add(b);



How can I add Checker in User Control while application is running?

解决方案

I don''t know what you''ve written in Checkers ??
but what about this..???

Checkers b = new Checkers();
b.Size = ???
b.Position = ??? // X and Y coordinates
b.Visible = ???


Set this kinda properties and give it a try ;) GoOd LucK mate :)


这篇关于我不是动态添加自定义控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆