Click here to Skip to main content
15,897,032 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: rubber banding and tracking linked image boxes linked by rubber bands Pin
Dave Kreskowiak3-Feb-06 8:33
mveDave Kreskowiak3-Feb-06 8:33 
Questionerror user defined type not defined Pin
raj kumar reddy2-Feb-06 17:41
raj kumar reddy2-Feb-06 17:41 
AnswerRe: error user defined type not defined Pin
Rana Muhammad Javed Khan2-Feb-06 17:47
Rana Muhammad Javed Khan2-Feb-06 17:47 
GeneralRe: error user defined type not defined Pin
raj kumar reddy2-Feb-06 17:55
raj kumar reddy2-Feb-06 17:55 
GeneralRe: error user defined type not defined Pin
Rana Muhammad Javed Khan2-Feb-06 18:01
Rana Muhammad Javed Khan2-Feb-06 18:01 
GeneralRe: error user defined type not defined Pin
raj kumar reddy2-Feb-06 18:10
raj kumar reddy2-Feb-06 18:10 
GeneralRe: error user defined type not defined Pin
Rana Muhammad Javed Khan2-Feb-06 18:14
Rana Muhammad Javed Khan2-Feb-06 18:14 
QuestionRam is getting eaten Pin
j_jd2-Feb-06 16:54
j_jd2-Feb-06 16:54 
My ram is getting eaten. The garbage fills up and then empties once my RAM fills. What is wrong with my code?

Imports System.Drawing

    Dim startX As Int16
    Dim endX As Int16
    Dim startY As Int16
    Dim endY As Int16
    Dim m_Drawing As Boolean
    Dim EraserOn As Boolean
    Dim MyPen As New Pen(Color.Black)
    Dim m_Drawn As Bitmap

    Dim pic1 As Bitmap
    Dim m_Graphics As Graphics
    Dim m_Graphics2 As Graphics

    Private Sub lblPaint_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles lblPaint.Paint
        RenderIt()
    End Sub

    Private Sub lblPaint_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPaint.MouseDown
        m_Drawing = True
        startX = e.X
        startY = e.Y
    End Sub

    Private Sub lblPaint_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPaint.MouseUp
        endX = e.X
        endY = e.Y
        If m_Drawing = False Then
            lblPaint.Refresh()
        End If
        m_Drawing = False
    End Sub

    Private Sub lblPaint_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPaint.MouseMove
        If m_Drawing Then
            m_Graphics.DrawLine(MyPen, startX, startY, e.X, e.Y)
            startX = e.X
            startY = e.Y
            m_Graphics2.DrawImage(m_Drawn, 0, 0)
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        pic1 = Win32Util.Win32Window.DesktopAsBitmap
        lblPaint.Image = pic1

        m_Drawn = New Bitmap(pic1.Width, pic1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        m_Graphics = Graphics.FromImage(m_Drawn)

        m_Graphics2 = lblPaint.CreateGraphics()

        EraserOn = False
        MyPen.Width = 4
    End Sub

    Private Sub RenderIt()
        'Render Image then place Drawing on top
        m_Graphics2.DrawImage(pic1, 0, 0)
        m_Graphics2.DrawImage(m_Drawn, 0, 0)

    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        pic1 = Win32Util.Win32Window.DesktopAsBitmap
        RenderIt()
    End Sub


This code takes a screenshot and allows me to draw on the label (lblPaint) while the screenshot refreshes.
AnswerRe: Ram is getting eaten Pin
Dave Kreskowiak2-Feb-06 17:25
mveDave Kreskowiak2-Feb-06 17:25 
GeneralRe: Ram is getting eaten Pin
j_jd2-Feb-06 17:46
j_jd2-Feb-06 17:46 
GeneralRe: Ram is getting eaten Pin
Steve Pullan2-Feb-06 23:59
Steve Pullan2-Feb-06 23:59 
GeneralRe: Ram is getting eaten Pin
Dave Kreskowiak3-Feb-06 1:24
mveDave Kreskowiak3-Feb-06 1:24 
AnswerRe: Ram is getting eaten Pin
Steve Pullan2-Feb-06 17:40
Steve Pullan2-Feb-06 17:40 
QuestionFormatting Datagrid Pin
mayhem_rules2-Feb-06 16:49
mayhem_rules2-Feb-06 16:49 
Questionhow to find location of a file - VB Pin
Joy Anne2-Feb-06 16:42
Joy Anne2-Feb-06 16:42 
AnswerRe: how to find location of a file - VB Pin
Dave Kreskowiak2-Feb-06 17:19
mveDave Kreskowiak2-Feb-06 17:19 
GeneralRe: how to find location of a file - VB Pin
Joy Anne2-Feb-06 19:12
Joy Anne2-Feb-06 19:12 
GeneralRe: how to find location of a file - VB Pin
Dave Kreskowiak3-Feb-06 1:18
mveDave Kreskowiak3-Feb-06 1:18 
Questionsearching the database Pin
pandapatin2-Feb-06 16:18
pandapatin2-Feb-06 16:18 
QuestionLimit RAM usage Pin
gr8coaster3292-Feb-06 15:50
gr8coaster3292-Feb-06 15:50 
AnswerRe: Limit RAM usage Pin
Dave Kreskowiak2-Feb-06 16:00
mveDave Kreskowiak2-Feb-06 16:00 
QuestionCompletly close program Pin
Luke_Nava2-Feb-06 15:26
Luke_Nava2-Feb-06 15:26 
AnswerRe: Completly close program Pin
gr8coaster3292-Feb-06 15:48
gr8coaster3292-Feb-06 15:48 
AnswerRe: Completly close program Pin
Dave Kreskowiak2-Feb-06 15:56
mveDave Kreskowiak2-Feb-06 15:56 
GeneralRe: Completly close program Pin
alien viper2-Feb-06 16:45
alien viper2-Feb-06 16:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.