Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

[VB] Scribble Pad

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
ABEO

ABEO

    Member

  • Member
  • PipPip
  • 284 posts
  • Joined 02-June 03
Ok this is a simple scribble pad, when you run it you can... scribble :rolleyes:

First of all create a module.
In the Module put:
Option Explicit
Public bNowDraw As Boolean

Now on the main form put 4 command buttons.
Call them:
Command1 - cmdExit
Command2 - cmdClear
Command3 - cmdSave
Command4 - cmdLoad
Make the buttons quite small and put them at the top of the form.


Now put this in the form code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    bNowDraw = True
    CurrentX = X
    CurrentY = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If bNowDraw = True Then
        Line -(X, Y)
    Else
        Exit Sub
    End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    bNowDraw = False
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdClear_Click()
    If MsgBox("Do you wish to save first?", vbYesNo + vbQuestion, "Save...") = vbYes Then
        SavePicture Form1.Image, "c:\picture.bmp"
        Form1.Cls
    Else
        Form1.Cls
    End If
End Sub

Private Sub cmdLoad_Click()
    Form1.Picture = LoadPicture("c:\picture.bmp")
End Sub

Private Sub cmdSave_Click()
    SavePicture Form1.Image, "c:\picture.bmp"
    MsgBox "Picture Saved", vbOKOnly + vbInformation, "Saved..."
End Sub

That should be about it :D

You can add whatever features you like, when I had the basic program working I added colours to it so you can draw in better colours(black gets boring :D) :)

Have fun, more will come soon :D
Americans on average eat 18 acres of pizza every day


How to remove advertisement from MSFN

#2
ABEO

ABEO

    Member

  • Member
  • PipPip
  • 284 posts
  • Joined 02-June 03
btw to change the back of the form colour you need:
Form1.BackColor = vbBlack

for example.
And for the colour you are drawing in you would need:
Form1.ForeColor = vbGreen

Thought that might be useful for all you silly n00bs who wanna try and make ur scribble pad a bit better :)
Americans on average eat 18 acres of pizza every day

#3
Doggie

Doggie

    I'm very inactive :(

  • Patrons
  • 2,560 posts
  • Joined 13-October 02
also if u want to make changing colors easily..
add the common dialog control

and use the following on a button label something like change color

commondialog1.showcolor
form1.forecolor = commondialog1.color