是不是后面只能跟属性,不能跟方法?

解决方案 »

  1.   

    同意楼上说的
    with 一般是用来简化代码用的
      

  2.   

    With用在对象前面,这样在With..End With块中就可以使用点号来引用对象的属性和方法了。
    例子:
    Dim rst as Adodb.Recordset
    With rst
         Msgbox .field("ID")
         .addnew
         .Field("Name")="uu"
         .Update
    End With
      

  3.   

    但是这个就不成
    With Picture1
        .PSet (0, 0)
    End With
      

  4.   

    用 With 可以加快访问对象属性和方法的速度。
      

  5.   

    如果这样不成
    With Picture1
        .PSet (0, 0)
    End With
    那么这样也应该不成 Picture1.PSet(0,0)吧
      

  6.   

    with 用来提高代码的 可读性,让代码看上去更漂亮:-)
      

  7.   

    我试过了
    Picture1.PSet(0,0)
    可以但
    With Picture1
        .PSet (0, 0)
    End With
    回报告"语法错误"
      

  8.   

    执行 PSet 时,CurrentX 和 CurrentY 属性被设置为参数指定的点。想用 PSet 方法清除单一像素,规定该像素的坐标,并用 BackColor 属性设置作为 color 参数。这个方法不能用在 With匛nd With 语句块中。
      

  9.   

    Circle 执行时,CurrentX 和 CurrentY 属性被参数设置为中心点。这个方法不能用在 With匛nd With 语句块中。