PDA

Click to See Complete Forum and Search --> : Paint Program Questions...


WebKing
Sep 20th, 1999, 08:00 AM
I'm developing a paint program. I'm having a difficulty getting one thing implemented. That's loading an image to the size specified by the user.

Here's what I did...

When the user clicks on mnuNew in the menu or New in the Toolbar, the program loads a New File Properties window, which lets the user type in the image size and background color. Here's the code I put in...

Private Sub cmdOk_Click()
CheckWidth
CheckHeight
ContinueLoading
End Sub

Private Sub CheckWidth()

If txtWidth.Text <= 0 Then
MsgBox "Width must be greater than zero."
End If
End Sub

Private Sub CheckHeight()

If txtHeight.Text <= 0 Then
MsgBox "Height must be greater than zero."
End If
End Sub


Private Sub ContinueLoading()

Unload Me

Static lDocumentCount As Long
Dim frmD As frmDocument
lDocumentCount = lDocumentCount + 1
Set frmD = New frmDocument
frmD.Caption = "Document " & lDocumentCount
frmD.Show
frmMain.HScroll1.Enabled = True

End Sub

Ok, so one problem I have is that I don't know how to make the size of the new picBoard be the size specified by the user (in pixels), and another is that if the user types in a number less or equal to 0, then a message box pops up telling the user that the number must be greater than zero, but the new document still loads after the user clicks ok on that message box.

Please help me out, thx.

-Simon B.

Bob Baddeley
Sep 26th, 1999, 02:51 AM
The solution for the second part is to go back to the part where you ask for the dimensions. Put a line right after the msgbox that goes back to the box for inputing the dimensions. What's wrong now is that is says it's wrong and continues on the code. You have to tell it to go back if there's an error. Can't help you with the other one though.

------------------