如何在VB.NET中制作MultiColor边框 [英] How to make MultiColor Border in VB.NET

查看:70
本文介绍了如何在VB.NET中制作MultiColor边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我,如何在vb.net中创建这种类型的多色边框 - https://i.gyazo.com /81e95a7c68e29eddbbc66ce64878a1b1.png [ ^ ]

解决方案

请参阅我对该问题的评论。您可以在客户区域中简单地渲染所需的边框,您可以在重写的方法 System.Windows.Forms.Control.OnPaint 中执行此操作,或者通过处理事件 System.Windows.Forms.Control.Paint



有一个微妙的时刻:你也可以避免重叠你与表格内其他元素的边界。您可以根据实际外部控件大小覆盖此方法以调整控件内的客户端大小: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.setclientsizecore%28v=vs.110%29.aspx [ ^ ]。



另请参阅解释图形渲染的过去答案:

什么样的俏皮方法是Paint? (DataGridViewImageCell.Paint(...)) [ ^ ],

在面板上捕获绘图 [ ^ ],

mdi子表单之间的绘制线 [ ^ ]。



-SA

Please help me, how can i create this type of multicolor border in vb.net - https://i.gyazo.com/81e95a7c68e29eddbbc66ce64878a1b1.png[^]

解决方案

Please see my comment to the question. You can simply render the border you want in the client area, which you can do in your overridden method System.Windows.Forms.Control.OnPaint, or by handling the event System.Windows.Forms.Control.Paint.

There is one delicate moment: you can also avoid superimposing of your border with other elements inside the form. You can override this method to adjust the client size inside the control, based on actual outer control size: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.setclientsizecore%28v=vs.110%29.aspx[^].

See also my past answers explaining graphics rendering:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
capture the drawing on a panel[^],
Drawing Lines between mdi child forms[^].

—SA


这篇关于如何在VB.NET中制作MultiColor边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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