开发者

display the image using button in .net?

how can开发者_C百科 i display the image beside the button in visual basic express 2008??


You have to edit the Image property of the button. (Go to the tab "properties")


If you mean you just want a nice picture, that does not change, displayed beside a button:

Add a button and picture box from the toolbox, under common Controls, and place them wherever you want them on your Form1.vb [Design] tab. Click the Picture box and select Properties Window from the command bar at the top of the screen listed under View. From the Properties window that appears, Scroll down to “Image”, under Appearance and click on it once to highlight it. When you click on Image, you should see an ellipsis button appear beside it […] In the pop-up that follows, select the “Project resource file” radio button and click import. Once you have selected the image that you want, click the OK button to add the image to the picture box on your form.

If your intent is to have a button that selects an image to display:

Add a button and picture box from the toolbox, under common Controls, and place them wherever you want them on your Form1.vb [Design] tab. Next, add an “OpenFileDialog”, found under Dialogs, from your toolbox to the form. Now, Double click the button you added to your form and enter the following code:

OpenFileDialog1.ShowDialog()

Next, Go back to the Design tab and double click OpenFileDialog1 and enter the following code:

path = New Bitmap(OpenFileDialog1.FileName)
PictureBox1.Image = path

Stay in the same tab you just entered the above code, place your cursor on line 2, and enter the following code:

Private path As Bitmap

Finally, go to the form design tab and physically adjust your picture box as large as you want it. Now, click once on the picture box. Go to the properties window and change the Size Mode to Zoom. Start Debugging..

If this is not what your looking for then please be more specific in what your looking for. What are you looking for as an end result?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜