自定义上下文菜单 [英] Customising context menu

查看:115
本文介绍了自定义上下文菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我想为我的应用程序自定义上下文菜单,即,我想将图片框添加到上下文菜单项中.

HI all,
I want to customise the context menu for my application,(i.e) I want to add the picture box to the context menu item. how can i do this?

推荐答案

通常,您不向菜单添加图片框控件.您的所有者绘制菜单并适当绘制所需的图像.

请参见
Usually, you don''t add a picturebox control to the menu. You owner draw the menu and draw the image you want appropriately.

See this list[^] of articles.


我认为您应该覆盖绘画方法.

i think you should override Paint method.

Private Sub ToolStripMenuItem1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles ToolStripMenuItem1.Paint
  DirectCast(sender, ToolStripMenuItem).DisplayStyle = ToolStripItemDisplayStyle.None
  e.Graphics.DrawImage(My.Resources.attach, 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height)
End Sub


这篇关于自定义上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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