Results 1 to 4 of 4

Thread: cannot create shapes at runtime. **RESOLVED**

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    cannot create shapes at runtime. **RESOLVED**

    This code originated from a post by toughcoder, I have modified it a little.

    The bit I can't work out is I am getting an error message 'Object variable or with block variable not set.

    Code:
    Option Explicit
    
    Dim blnDrawing As Boolean
    Dim x1 As Single, y1 As Single
    Dim Shape2 As Shape
    
    Private Sub Form_Load()
    '    Shape2.FillStyle = vbFSTransparent
    '    Shape2.FillColor = 0
    '    Shape2.BorderStyle = 1
    '    Shape2.BorderWidth = 1
    End Sub
    
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        x1 = X
        y1 = Y
        Shape2.Left = x1
        Shape2.Top = y1
        blnDrawing = True
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If blnDrawing = True Then
            Shape2.Width = X - x1
            Shape2.Height = Y - y1
    
        End If
    End Sub
    
    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        blnDrawing = False
        Shape2.FillStyle = vbFSSolid
        Shape2.FillColor = vbRed
        Shape2.BorderColor = vbRed
    End Sub
    Any ideas.
    Last edited by davidrobin; Mar 13th, 2003 at 07:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width