简体   繁体   English

检查2个无线电时的Picturebox(VB.NET)

[英]Picturebox when 2 radios are checked(VB.NET)

Okay I have a VB.Net project that I have to create on my own for school that has a list of requirements which are too long to list here, so I will get to the point. 好吧,我有一个VB.Net项目,我必须自己在学校创建,有一个要求列表太长,无法在此列出,所以我会明白这一点。 I am trying to make just a quick form where it will display my artwork depending on which radio button is clicked. 我正在尝试制作一个快速表单,根据单击的单选按钮显示我的作品。 I have it figured out if there is only 1 radio button, where it puts the image in the picturebox. 我知道如果只有一个单选按钮,它将图像放在图片框中。 However I would like it to display an image when 2 radios are checked. 但是我想在检查2个无线电时显示图像。 Makes the form look much cleaner and nicer. 使表单看起来更清洁,更好。

So I have 2 groupboxes, first one has the radio buttons of the medium that my artwork is in, the second has radios of the name of the picture. 所以我有2个分组,第一个有我的艺术品所在介质的单选按钮,第二个有图片名称的无线电。 I want it so that the person checks the color pencil radio, then checks the forest path radio my drawing of color pencil forest path in my resources pops up in the picture box, then if they click the charcoal radio the charcoal version of my forest path pops up. 我想要它,以便该人检查彩色铅笔收音机,然后检查森林路径收音机我的资源中的彩色铅笔森林路径绘图弹出图片框,然后如果他们点击木炭收音机我的森林路径的木炭版本弹出。

Is it possible to do this? 是否有可能做到这一点?

  1. Everything is possible. 一切皆有可能。

I'm not going to give you the whole answer but what you want to look for are the On_Event handlers. 我不打算给你完整的答案,但你想要寻找的是On_Event处理程序。

After you create a radio button, go to the properties and click the little "Lightning Bolt" and look for something like On_Check_Changed. 创建单选按钮后,转到属性并单击“Lightning Bolt”并查找类似On_Check_Changed的内容。

After that you just have to set all the conditions: 之后,您只需设置所有条件:

If rdioColorPencil.checked then 
     picturebox's picture = colorpencil.jpg
     picturebox.refresh()
End if

The On_Event handlers are some of the most useful things in .Net. On_Event处理程序是.Net中最有用的东西。 They allow for everything from right clicks to form changes. 它们允许从右键单击到表单更改的所有内容。 Get acquainted to them. 结识他们。

Good Luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM