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

问题描述

dim array as new list(of picturebox)
dim pic as new picturebox
me.controls.add(pic)
array.add(pic)



我使用此代码在运行时创建图片框.现在,我想在pictureboxes数组中添加contextmenu.因此,我采用delete(index-0),create(index-1)&创建有5个子菜单.因此请使用此代码.



i used this code to create picturebox at runtime .now i want to add contextmenu in array of pictureboxes.so i take contextmenustrip in the form with delete(index-0),create(index-1) & create has 5 sub menu.so iused this code.

pic.ContextMenuStrip = ContextMenuStrip1



然后我在me.remove.controls(pic)的"Deletecontextmenustrip_click"中键入代码以删除图片框,但出现错误.
我用contextmenustrip&尝试了addhandler被称为过程,但也无法正常工作.



then i typed code to remove picturebox in "Deletecontextmenustrip_click", me.remove.controls(pic) but i got error.
i tried addhandler with contextmenustrip & called procedure but not working too.


AddHandler pic.ContextMenuStrip.Items(0).Click, AddressOf DeleteToolStripMenuItem_Click



在该过程中,我使用了me.controls.remove(sender)



In the procedure i used me.controls.remove(sender)

推荐答案


这篇关于带有图片数组的上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 21:39