如何在System.Windows.Forms.Cntrols中添加滑块? [英] How to add a Slider in System.Windows.Forms.Cntrols?
本文介绍了如何在System.Windows.Forms.Cntrols中添加滑块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在System.Windows.Forms.Cntrols
中添加一个Slider.但是当我使用this.Controls.Add(slider)
时,它给出了错误: System.Windows.Controls.Control无法在System.Windows.Forms.Controls中进行类型转换
请给我解决方法.
约束:我不能使用WPF
I want to add a Slider in System.Windows.Forms.Cntrols
. But when I use this.Controls.Add(slider)
, it gives error: System.Windows.Controls.Control can not be typecast in System.Windows.Forms.Controls
Please give me solution.
Constraint: I cannot use WPF
推荐答案
您可以改用System.Windows.Forms.TrackBar
.
同样,这样的控件也太容易实现了.真的没有什么要讨论的,只是从System.Windows.Forms.Control
派生的.
正如您没有告诉slider
的声明(可能有些胡言乱语)一样,我不知道为什么它不能编译.就像Controls
属性的名称所建议的那样,它应该是Control
(难读的帮助信息吗?).我也不相信这是真正的错误信息,因为语法看起来很混乱.如果您需要帮助,请务必准确.
瞧,即使名字"System.Windows.Forms.Cntrols
"也是用不正确的拼写写的;复制和粘贴太难了吗?表现出这种态度时,谁会乐意回答?
-SA
You can useSystem.Windows.Forms.TrackBar
instead.
Also, controls like that are too easy to implement; there is nothing to discuss here, really, just derive fromSystem.Windows.Forms.Control
.
As you did not tell the declaration ofslider
(probably, some gibberish), I don''t know why it does not compile; it should beControl
, as the name of theControls
property suggests (is is that hard to read help?). I also don''t believe this is real error message, as grammar looks broken. If you need some help, please be precise.
Look, even the name "System.Windows.Forms.Cntrols
" is written in incorrect spelling; is it too hard to copy and paste? Who will be happy to answer when such attitude is manifested?
—SA
除了第一个答案之外, ^ ]的讨论也应该帮助您转到正确的链接.
In addition to the first answer, this[^] discussion should also help you go to the right links.
这篇关于如何在System.Windows.Forms.Cntrols中添加滑块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文