是不是VB.NET中还不支持菜单中带图标的功能?

m_pMain 2003-08-24 06:28:23
是不是VB.NET中还不支持菜单中带图标的功能?
...全文
77 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cnhgj 2003-08-25
  • 打赏
  • 举报
回复
以下示例说明如何处理 DrawItem 事件。本示例使用 Brush 和 Font 绘制一个菜单项,然后在菜单项周围绘制一个 Rectangle。绘制工作是通过 Graphics 对象执行的,该对象被 DrawItemEventArgs 参数的事件处理程序使用。此示例假设已经将此项的 OwnerDraw 属性初始化为 true。

[Visual Basic]
' The DrawItem event handler.
Private Sub MenuItem1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles MenuItem1.DrawItem


Dim MyCaption As String = "Owner Draw Item1"

' Create a Brush and a Font with which to draw the item.
Dim MyBrush As System.Drawing.Brush = System.Drawing.Brushes.AliceBlue
Dim MyFont As New Font(FontFamily.GenericSerif, 14, FontStyle.Underline, GraphicsUnit.Pixel)
Dim MySizeF As SizeF = e.Graphics.MeasureString(MyCaption, MyFont)

' Draw the item, and then draw a Rectangle around it.
e.Graphics.DrawString(MyCaption, MyFont, MyBrush, e.Bounds.X, e.Bounds.Y)
e.Graphics.DrawRectangle(Drawing.Pens.Black, New Rectangle(e.Bounds.X, e.Bounds.Y, MySizeF.Width, MySizeF.Height))

End Sub
benlee 2003-08-25
  • 打赏
  • 举报
回复
我的都带,不过是自己画的
如果你要,告诉我,我帖代码
y1g1y1 2003-08-24
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/TopicView1.asp?id=2093334
ArLi2003 2003-08-24
  • 打赏
  • 举报
回复
ie 到 6.0 还是没有出现图标菜单,何必哩
小工程没必要
csharplove 2003-08-24
  • 打赏
  • 举报
回复
.NET控件不支持,你可以调用API实现,或者使用第三方控件
isage2002 2003-08-24
  • 打赏
  • 举报
回复
没有任何属性,可以直接实现带图标的功能
但是可以通过第三方组件或者编程实现
http://www.syncfusion.com/FAQ/WinForms/FAQ_c49c.asp#q864q

16,553

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧