Windows窗体在运行时创建图片框 [英] windows forms create picture box in runtime

查看:81
本文介绍了Windows窗体在运行时创建图片框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在文本框中输入值以创建图片框,单击下一步按钮转到下一个图片框。一次只显示一个图片框..如何逐个显示图片框

Enter a values on textbox based to create picture boxes, to click next button to go to next picture box. At a time only one picture box will be show.. how do I show the picture box one by one

推荐答案

这是如何:

This is how:
Control someParent = //... could be instance of Panel, or Form
                     // TabPage, or something like that
Image someImage = //... suppose you have it
PictureBox pb = new PictureBox();
pb.Image = someImage;
// other properties: BackGroundImage,
// location, Dock, and so on...
pb.Parent = someParent; // otherwise it's not used in the UI





有什么问题吗?



祝你好运。

-SA


您可以在运行应用程序时在表单中添加控件:



You can add Controls in your form when running your application using this:

PictureBox picBox = new PictureBox(); //Creates the control, but it doesn't show in the UI
picBox.BackgroundImage = Properties.Resources.Image_001; //An example, but you can use Image=... too.
picBox.Location = new Point(400, 320); //Defines the position of your control
picBox.Height = 100; //Defines its height
picBox.Width = 100; //Defines its width (you can also use new Size())

this.Controls.Add(picBox); //To add the control to your form.





希望这有帮助 - CCB



Hope this helps - CCB


这篇关于Windows窗体在运行时创建图片框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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