ABEO Posted June 13, 2003 Posted June 13, 2003 Ok this is a simple scribble pad, when you run it you can... scribble First of all create a module.In the Module put:Option ExplicitPublic bNowDraw As BooleanNow on the main form put 4 command buttons.Call them:Command1 - cmdExitCommand2 - cmdClearCommand3 - cmdSaveCommand4 - cmdLoadMake 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 = YEnd SubPrivate 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 IfEnd SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) bNowDraw = FalseEnd SubPrivate Sub cmdExit_Click() Unload MeEnd SubPrivate 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 IfEnd SubPrivate Sub cmdLoad_Click() Form1.Picture = LoadPicture("c:\picture.bmp")End SubPrivate Sub cmdSave_Click() SavePicture Form1.Image, "c:\picture.bmp" MsgBox "Picture Saved", vbOKOnly + vbInformation, "Saved..."End SubThat should be about it 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 ) Have fun, more will come soon
ABEO Posted June 14, 2003 Author Posted June 14, 2003 btw to change the back of the form colour you need:Form1.BackColor = vbBlackfor example.And for the colour you are drawing in you would need:Form1.ForeColor = vbGreenThought that might be useful for all you silly n00bs who wanna try and make ur scribble pad a bit better
Doggie Posted June 14, 2003 Posted June 14, 2003 also if u want to make changing colors easily.. add the common dialog controland use the following on a button label something like change colorcommondialog1.showcolorform1.forecolor = commondialog1.color
Recommended Posts