转载自: http://blog.sina.com.cn/s/blog_45d538900101ek81.html
我们给c#动态设置位置时常常按编程常理来设置,如设置的axWindowsMediaPlayer3控件的位置及大小,用经验的方法:
axWindowsMediaPlayer3.Location.X = 0;(左)
axWindowsMediaPlayer3.Location.Y = 300;(右)
axWindowsMediaPlayer3.Size.Width = 400;(宽)
axWindowsMediaPlayer3.Size.Height = 300;(高)
以上是错误的,编辑时就会出现:“System.Windows.Forms.Control.Location”的返回值,因为它不是变量"
“System.Windows.Forms.Control.Size”的返回值,因为它不是变量"
正确的方法是:
axWindowsMediaPlayer3.Location = newSystem.Drawing.Point(0,0);
axWindowsMediaPlayer3.Size = new System.Drawing.Size(400,300);