有谁知道?怎末画.两种方法,1,api.2,用vb自身的功能。

解决方案 »

  1.   

    Option ExplicitPrivate Declare Function Arc Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As LongPrivate Sub Command1_Click()
        Arc Picture1.hdc, 0, 0, 80, 80, 0, 50, 70, 70
       
       Dim CX, CY, Radius, Limit   ' Declare variable.
       ScaleMode = 3   ' Set scale to pixels.
       CX = ScaleWidth / 2   ' Set X position.
       CY = ScaleHeight / 2   ' Set Y position.
       If CX > CY Then Limit = CY Else Limit = CX
       For Radius = 0 To Limit   ' Set radius.
          Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
       Next Radius
    End Sub
      

  2.   

    刚才用vb函数画的是圆,下面的画圆弧:
       Dim CX, CY, Radius, Limit   ' Declare variable.
       ScaleMode = 3   ' Set scale to pixels.
       CX = ScaleWidth / 2   ' Set X position.
       CY = ScaleHeight / 2   ' Set Y position.
       If CX > CY Then Limit = CY Else Limit = CX
       For Radius = 0 To Limit   ' Set radius.
          Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255), 0, 2
       Next Radius
      

  3.   

    唉... 5星出现在偶楼上了偶就补充一下用 API 画的圆弧吧
    ===========================
    Private Declare Function Arc Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long
    Private Sub Form_Load()
        'Set graphical mode to persistent
        Me.AutoRedraw = True
        'Draw to arcs
        Arc Me.hdc, 0, 0, 100, 100, 100, 50, 50, 100
        Arc Me.hdc, 49, 49, 149, 149, 49, 99, 99, 49
    End Sub
      

  4.   

    Const AD_CLOCKWISE = 2
    Const AD_COUNTERCLOCKWISE = 1
    Private Declare Function ArcTo Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long
    Private Declare Function SetArcDirection Lib "gdi32" (ByVal hdc As Long, ByVal ArcDirection As Long) As Long
    Private Declare Function GetArcDirection Lib "gdi32" (ByVal hdc As Long) As Long
    Private Sub Form_Paint()
        If GetArcDirection(Me.hdc) = AD_CLOCKWISE Then
            SetArcDirection Me.hdc, AD_COUNTERCLOCKWISE
        End If
        ArcTo Me.hdc, 20, 20, 50, 60, 50, 60, 20, 60
    End Sub
      

  5.   

    比较楼上2个例子,可以知道, ArcTo 函数会将当前画笔位置置为弧的终点,而 Arc 函数则不会