开发者

Changing properties of the control that calls a Context Menu

I have 10 PictureBox on a windows form (created in Design View) and a context menu strip is attached to each of them. I am trying to set the property of the PictureBox using the context menu.

For eg If the user sele开发者_运维百科cts Red from the context menu a Red picture shows up

I can get the the name of the control that popped the Context Menu strip by

cmStrp1.SourceControl.Name

Is there any way I can use the cmStrp1.SourceControl.Name to get the object/control and set its properties


Just use cmStrp1.SourceControl instead of cmStrp1.SourceControl.Name. You need to cast the control to a PictureBox before using it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜