'############### '## Copyright (C) ## '## EaK2k 2008 ## '## All rights ## '## Reserved ## '############# Public Class Form1 Dim xStart, yStart, xEnd, yEnd As Integer Dim Drawbitmap As Bitmap Dim Drawgraphics As Graphics Dim myPen As New Pen(Color.BlueViolet, 3) Dim myColor As Color = Color.Blue Dim myBrush As New Drawing.SolidBrush(Color.Red) Dim myBrushWidth As Integer Dim ContinuousFlag As Boolean Private Sub drawMyline() PictureBox1.Image = Drawbitmap Drawgraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality Drawgraphics.DrawLine(myPen, xStart, yStart, xEnd, yEnd) End Sub Private Sub savebutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) SaveFileDialog1.ShowDialog() If SaveFileDialog1.FileName <> "" Then FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output) FileClose(1) End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Drawbitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height) Drawgraphics = Graphics.FromImage(Drawbitmap) PictureBox1.Image = Drawbitmap Drawgraphics.Clear(Color.White) myBrushWidth = 4 End Sub Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown xStart = Control.MousePosition.X - (Me.Left + PictureBox1.Left + 4) yStart = Control.MousePosition.Y - (Me.Top + PictureBox1.Top + 31) 'to do continuous drawing, enable this line 'drawMyline() If RadioButton1.Checked = True Then ContinuousFlag = True End If End Sub Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove If ContinuousFlag Then Drawgraphics.SmoothingMode = Drawing2D.SmoothingMode.None Drawgraphics.FillEllipse(myBrush, e.X, e.Y, myBrushWidth, myBrushWidth) PictureBox1.Image = Drawbitmap End If End Sub Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp xEnd = Control.MousePosition.X - (Me.Left + PictureBox1.Left + 4) yEnd = Control.MousePosition.Y - (Me.Top + PictureBox1.Top + 31) If RadioButton1.Checked Then ContinuousFlag = False Else drawMyline() End If End Sub
part of my code, rest of my code is the colors and clear the image area!
Now the question:
How can I make a OPEN DIALOG when the save dialog look like this:
Dim Savefiledialog1 As New SaveFileDialog() Savefiledialog1.Filter = "Bitmap Image (*.bmp)|*.bmp |All Files |*.*" If Savefiledialog1.ShowDialog() = DialogResult.OK Then PictureBox1.Image.Save(Savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp) End If
Next, can I make a color dialog?
Also, when I tried the program, the painting don't goes "smooth" its like dotted.
How can I fix that?
Probably more questions is coming

Reply





MultiQuote




|