below is the solution:
create two form one is main form and one is child form to paint on child form. in child form create a picturebox
frmMain.vb:
Public Class frmMain
Private Sub NewToolStripMenuItem_Click(sender As
Object, e As EventArgs) Handles NewToolStripMenuItem.Click
frmPaint.Show()
End Sub
Private Sub
ExitToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub
End Class
frmPain.vb:
Public Class frmPaint
Private oldx, oldy As Integer 'variable for x
and y axis cursor move
Private setBool As Boolean = False
Private Sub frmPaint_Load(sender As Object, e As
EventArgs) Handles MyBase.Load
Cursor = Cursors.Hand
'set the cursor as hand
Me.PictureBox1.BorderStyle = BorderStyle.FixedSingle 'set the
picture box border style with line
End Sub
Private Sub Event_MouseDown(sender As Object,
e As System.Windows.Forms.MouseEventArgs) Handles
PictureBox1.MouseDown
If e.Button =
Windows.Forms.MouseButtons.Left Then 'if mouse left
setBool = True 'set the bool value to true when mouse pressed
oldx = e.X
oldy = e.Y
End If
End Sub
Private Sub MouseEvent_MouseMove(sender As
Object, e As System.Windows.Forms.MouseEventArgs) Handles
PictureBox1.MouseMove
Dim g As Graphics =
Me.PictureBox1.CreateGraphics 'create a graphics object
If setBool Then 'check
if the bool value is true
g.DrawLine(Pens.Black, oldx, oldy, e.X, e.Y)
oldx = e.X
oldy = e.Y
End If
End Sub
Private Sub MouseEvent_MouseUp(sender As
Object, e As MouseEventArgs) Handles PictureBox1.MouseUp
setBool = False 'set the
bool value to false when mouse release
End Sub
End Class
output:
First look at Exercise 14.7. Then implement same thing in a MDI application. You should have...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...