2010-08-20 51 views
0

我试图使用方法:长度属性的PictureBox不工作

PictureBox1.Length 

,但我得到了以下错误:

Error 3 'System.Windows.Forms.PictureBox' does not contain a definition for 'Length' and no extension method 'Length' accepting a first argument of type 'System.Windows.Forms.PictureBox' could be found (are you missing a using directive or an assembly reference?)

+0

长度是一维对象的属性。 PB有两个。 – 2010-08-20 16:17:21

回答

4

使用.Height.Width性能。

2

PictureBox控件没有Length属性。 HerePictureBox的全部属性列表。你想做什么?

你可能想看看HeightWidth

+0

好吧..我猜。宽度将工作.. 不我有一个问题..我初始化和对象的数组,我需要这样的事情: Greyhound [1] .StartingPosition = pictureBox1.Location; Greyhound [2] .StartingPosition = pictureBox2.Location; 等.. 但我需要通过环 ,使之成为(.........) { 灰狗[I] .StartingPosition = ????????? //这里应该怎么走? } – 2010-08-20 18:40:57

+0

你的目标是?灰狗形式的?控制? – SwDevMan81 2010-08-20 19:11:36

+0

你可以责怪Head First C#。它告诉你在这个特定练习中使用PictureBox的Length属性。 – Carlos 2012-03-24 21:15:12