4 Replies - 327 Views - Last Post: 20 August 2012 - 10:38 PM Rate Topic: -----

#1 k3nnt0ter0  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 181
  • Joined: 16-January 10

Keeping Record of Pen Size and Color

Posted 20 August 2012 - 02:55 AM

How do I keep a record of my Pen Size and Color so that my previous drawing won't change. Every time I change its size, what I wrote previously changes its size too.

Module GlobalDeclaration
    Public myAlpha As Integer = 255
    Public myUserColor As New Color()
    Public myPenWidth As Single = 1
End Module


Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public Class frmPaint

    Inherits System.Windows.Forms.Form
    Dim mousePath As New System.Drawing.Drawing2D.GraphicsPath() 

    Private Sub pbOmni_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pbOmni.MouseDown
        If e.Button = MouseButtons.Left Then
            mousePath.StartFigure()
        End If
    End Sub

    Private Sub pbOmni_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pbOmni.MouseMove
        If e.Button = MouseButtons.Left Then
            Try
                mousePath.AddLine(e.X, e.Y, e.X, e.Y)
            Catch
                MsgBox("Mouse Error")
            End Try
        End If
        pbOmni.Invalidate()
    End Sub

    Private Sub pbPaint_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles pbPaint.Paint
        Try
            myUserColor = (System.Drawing.Color.Black)
            Dim CurrentPen = New Pen(Color.FromArgb(myAlpha, myUserColor), myPenWidth)
            e.Graphics.DrawPath(CurrentPen, mousePath)
        Catch
        End Try
    End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: Keeping Record of Pen Size and Color

#2 AdamSpeight2008  Icon User is online

  • MrCupOfT
  • member icon


Reputation: 1951
  • View blog
  • Posts: 8,680
  • Joined: 29-May 08

Re: Keeping Record of Pen Size and Color

Posted 20 August 2012 - 07:16 AM

Quote

How do I keep a record of my Pen Size and Color so that my previous drawing won't change.


You considered a creating your own specific class, that encapsulates what you are trying capture and collect? Then have a some form of collection of them?
Was This Post Helpful? 0
  • +
  • -

#3 k3nnt0ter0  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 181
  • Joined: 16-January 10

Re: Keeping Record of Pen Size and Color

Posted 20 August 2012 - 07:28 AM

I wasn't trying to collect it. I just want the Size and color of the Line drawn in the Picturebox to stay still and won't change if I change again its size and color because every time I change its size, the previously drawn line changes also.
Was This Post Helpful? 0
  • +
  • -

#4 k3nnt0ter0  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 181
  • Joined: 16-January 10

Re: Keeping Record of Pen Size and Color

Posted 20 August 2012 - 10:23 PM

Anyone? Kindly guide me about this matter.
Was This Post Helpful? 0
  • +
  • -

#5 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 957
  • View blog
  • Posts: 3,680
  • Joined: 02-July 08

Re: Keeping Record of Pen Size and Color

Posted 20 August 2012 - 10:38 PM

Database, xmlSerializer, come to mind. Storage is storage, you decide what you want then work it out. The xmlSerializer could be used with Adams suggestion.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1