.net特殊按钮设计控件

发布于 2024-08-19 01:40:31 字数 231 浏览 5 评论 0原文

我有以下编程任务(Visual Studio .net - 无网络应用程序),我想知道是否有某种自定义控件(第三方?),这可能很有用:

有一个矩形布局,应该可以创建并移动矩形按钮。用户应该能够在用户级别创建按钮并调整颜色、图片、设置文本等属性。还应该可以为按钮设置自定义属性。理想情况下,应该可以在网格上对齐按钮、多选等。

有谁知道我是否必须从头开始创建它,或者有什么东西可以让我的生活更轻松。

谢谢

I have the following programming task (Visual Studio .net - no web application) where I wonder if there is maybe some sort of custom control (Third Party?), which could be useful:

There is a rectangular layout and it should be possible to create and move around rectangular buttons. The user should be able to create button and adjust properties like color, picture, set a text etc on the user level. It should also be possible to set custom properties for a button. Ideally it should be possible to align buttons on a grid, muti-select, etc.

Does anyone know if I have to create that from scratch or is there something that makes my live easier..

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事灯 2024-08-26 01:40:31

如果您使用的是 WinForms,您可能需要查看 DesignSurface,它允许您向应用程序添加设计器界面...您可以像 Visual Studio 设计器一样移动按钮。看看:

http://msdn.microsoft.com/en-us/杂志/cc163634.aspx

If you are using WinForms, you might want to look at the DesignSurface, which allows you to add a designer surface to your app... you can move buttons around like the Visual Studio designer. Check it out :

http://msdn.microsoft.com/en-us/magazine/cc163634.aspx

剪不断理还乱 2024-08-26 01:40:31

根据鼠标位置移动标准按钮的简单示例 此处

您可以创建继承现有控件的控件,以使生活更轻松。
MSDN 中查看此内容

至于在表单中,您可以创建覆盖并捕获鼠标按下事件的事件,并根据鼠标移动实际更改位置值 (x,y)。您还可以根据鼠标移动或颜色更改和文本值与任何其他属性进行交互...

例如,如果我想更改鼠标悬停时的按钮颜色。我将重写从按钮继承的自定义控件的鼠标悬停方法。当它被困时,我将在这个方法中设置颜色。

您甚至可以重写 onPaint 并自己处理所有绘图。

Simple example of moving a standard button around based on mouse position here.

You can create controls that inherit from existing controls to make life easier.
Check this out from MSDN

As for moving controls and such around on the form, you can create events that override and trap the mouse down event and actually change the location values (x,y) based on mouse movement. You can also interact with any of the other properties as well based on mouse movement or color change and text value....

For example, if i want to change the button color on mouse over. I would override the mouse over method of my custom control that inherits from the button. I will set the color in this method when its trapped.

You can even override onPaint and handle all the drawing yourself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文