PDA winform开发。在一个窗体上有一个PictureBox 一个 Label
执行如下代码的时候异常,求高手解释。this.label1.Parent = this.pictureBox1;异常信息:
((System.Windows.Forms.Control)(this.label1)).Parent”引发了“System.ArgumentException”类型的异常 System.Windows.Forms.Control {System.ArgumentException}
执行如下代码的时候异常,求高手解释。this.label1.Parent = this.pictureBox1;异常信息:
((System.Windows.Forms.Control)(this.label1)).Parent”引发了“System.ArgumentException”类型的异常 System.Windows.Forms.Control {System.ArgumentException}
解决方案 »
- DataTable.Select 语法 帮写一个SQL语句
- 关于成员字段赋值的问题
- 想做一个工资系统,我目前的创意跟大家分享一下
- js 获取动态绑定 datalist 下checkbox 值和id
- 如何将手"手"转换成“手”
- jpg图片在xp自带的看图器里看的很清楚,但在Picturebox里就不行,为什么?
- hbxtlhx(下着春雨的天) 请进
- C#可以用Linq来操作xml,那么原来的xml类库还有什么作用么?
- 新手问题!各位大侠帮帮我~~~走过,路过不能错过
- 有没有发现VS.Net的这么个问题——项目文件错链
- ListViewItem与ListViewSubItem
- C#保存到数据库
引发System.ArgumentException”类型的异常
刚去看了一下 PictureBox是Control的namespace System.Windows.Forms
{
// 摘要:
// 表示用于显示图像的 Windows 图片框控件。
public class PictureBox : Control
{
// 摘要:
// 初始化 System.Windows.Forms.PictureBox 类的新实例。
public PictureBox(); // 摘要:
// 获取或设置由 System.Windows.Forms.PictureBox 显示的图像。
//
// 返回结果:
// 要显示的 System.Drawing.Image。
public Image Image { get; set; }
//
// 摘要:
// 指示如何显示图像。
//
// 返回结果:
// System.Windows.Forms.PictureBoxSizeMode 值之一。默认为 System.Windows.Forms.PictureBoxSizeMode.Normal。
//
// 异常:
// System.ComponentModel.InvalidEnumArgumentException:
// 分配的值不是 System.Windows.Forms.PictureBoxSizeMode 值之一。
public PictureBoxSizeMode SizeMode { get; set; } //
// 参数:
// e:
// 包含事件数据的 System.Windows.Forms.PaintEventArgs。
protected override void OnPaint(PaintEventArgs e);
protected override void OnPaintBackground(PaintEventArgs e);
//
// 摘要:
// 引发 System.Windows.Forms.Control.Resize 事件。
//
// 参数:
// e:
// 包含事件数据的 System.EventArgs。
protected override void OnResize(EventArgs eventg);
}
}
this.label1.Parent 是 pictureBox1吗
在windows xp或者 windows7上这句话没有问题的。只不过出来的效果是看不见这个 Label
只不过在windows mobile下就有异常
而xp下为:PictureBox : Control, ISupportInitialize
多继承了一个接口,
public interface ISupportInitialize
{
// 用信号通知对象初始化即将开始。
void BeginInit();
// 用信号通知对象初始化已完成。
void EndInit();
}应该是这个原因了。