vb编程 急求~第1题:单击窗体,在窗体上画出一个当前窗体中所能容纳的最大的红色实心椭圆(即椭圆的上下左右分别与窗体的上

1个回答

  • 第1题:

    Private Sub Form_Click()

    Dim A As Long, B As Long

    Dim X As Long, Y As Long

    A = Me.ScaleWidth / 2

    B = Me.ScaleHeight / 2

    Me.Cls

    Me.FillColor = vbRed

    Me.FillStyle = 0

    Me.Circle (A, B), IIf(A > B, A, B), vbRed, , , B / A

    End Sub

    第2题:

    Private Sub Form_Click()

    Dim X As Single, Y As Single

    Me.ScaleMode = 3

    Me.Width = 300 * Screen.TwipsPerPixelX + Me.Width - Me.ScaleWidth * Screen.TwipsPerPixelX

    Me.Height = 300 * Screen.TwipsPerPixelY + Me.Height - Me.ScaleHeight * Screen.TwipsPerPixelY

    Me.Line (0, 150)-(300, 150), vbBlue

    Me.Line (150, 0)-(150, 300), vbBlue

    For X = -10 To 10 Step 0.01

    Y = X * X - 2 * X + 6

    Me.PSet (X + 150, 150 - Y), vbRed

    Next

    End Su