Click here to Skip to main content
15,915,019 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Exploring Windows Pin
hmklakmal19-Jan-06 4:19
hmklakmal19-Jan-06 4:19 
AnswerRe: Exploring Windows Pin
Dave Kreskowiak19-Jan-06 7:06
mveDave Kreskowiak19-Jan-06 7:06 
QuestionLabel Printing Pin
cberam19-Jan-06 0:51
cberam19-Jan-06 0:51 
AnswerRe: Label Printing Pin
Dave Kreskowiak19-Jan-06 6:20
mveDave Kreskowiak19-Jan-06 6:20 
QuestionPleaaaaaaaase help??!! Pin
flashmemory19-Jan-06 0:36
flashmemory19-Jan-06 0:36 
AnswerRe: Pleaaaaaaaase help??!! Pin
Ritesh123419-Jan-06 1:03
Ritesh123419-Jan-06 1:03 
AnswerRe: Pleaaaaaaaase help??!! Pin
Dave Kreskowiak19-Jan-06 6:19
mveDave Kreskowiak19-Jan-06 6:19 
QuestionSerious Problem on Memory Usage Pin
cylix200018-Jan-06 23:24
cylix200018-Jan-06 23:24 
<br />
    Friend Sub renderPicture()<br />
        Dim previewFile, tempPreviewFile As String<br />
        Dim numberOfSelectedItem As Integer<br />
        Dim bitmapSource As Bitmap<br />
        Dim graphicDestination As Graphics<br />
        Dim selectedFileName As String<br />
        Dim scale As Single<br />
<br />
        If Not picPreview.Image Is Nothing Then<br />
            picPreview.Image.Dispose()<br />
        End If<br />
<br />
        If Not bitmapDestination Is Nothing Then<br />
            bitmapDestination.Dispose()<br />
        End If<br />
<br />
        numberOfSelectedItem = lstFiles.SelectedItems.Count<br />
<br />
        If numberOfSelectedItem > 0 Then<br />
            Dim dummy = lstFiles.SelectedItems.Item(numberOfSelectedItem - 1)<br />
            previewFile = UCase(previewCachePath).Replace("SCANNED FILES", "SCANNE~1") & Mid(dummy, 1, Len(dummy) - 4) & "001.png"<br />
            tempPreviewFile = UCase(previewCachePath).Replace("SCANNED FILES", "SCANNE~1") & Mid(dummy, 1, Len(dummy) - 4) & "[t].png"<br />
            If System.IO.File.Exists(previewFile) Then<br />
                If Not System.IO.File.Exists(tempPreviewFile) Then<br />
                    System.IO.File.Copy(previewFile, tempPreviewFile)<br />
                End If<br />
            End If<br />
<br />
            Try<br />
                bitmapSource = New Bitmap(Bitmap.FromFile(tempPreviewFile))<br />
            Catch ex As Exception<br />
                Module1.setErrMsg(ex.Message)<br />
                Exit Sub<br />
            End Try<br />
            Select Case cmbZoom.Text<br />
                Case "150%"<br />
                    scale = CSng(1.5)<br />
                Case "125%"<br />
                    scale = CSng(1.25)<br />
                Case "100%"<br />
                    scale = CSng(1.0)<br />
                Case "75%"<br />
                    scale = CSng(0.75)<br />
                Case "50%"<br />
                    scale = CSng(0.5)<br />
                Case "25%"<br />
                    scale = CSng(0.25)<br />
                Case "Fit Width"<br />
                    scale = CSng((panPreview.Width - 17) / bitmapSource.Width)<br />
                Case Else<br />
                    Module1.setErrMsg("Error on Wrong Zoom Scale")<br />
                    Exit Sub<br />
            End Select<br />
<br />
            'If scale = CSng(9.9) Then<br />
            '    scale = CSng((picPreview.Width) / bitmapSource.Width)<br />
            'End If<br />
            bitmapDestination = New Bitmap(CInt(bitmapSource.Width * scale), CInt(bitmapSource.Height * scale))<br />
            graphicDestination = Graphics.FromImage(bitmapDestination)<br />
            graphicDestination.DrawImage(bitmapSource, 0, 0, bitmapDestination.Width + 1, bitmapDestination.Height + 1)<br />
            picPreview.Width = bitmapDestination.Width<br />
            picPreview.Height = bitmapDestination.Height<br />
            picPreview.Image = bitmapDestination<br />
            bitmapSource.Dispose()<br />
            graphicDestination.Dispose()<br />
        Else<br />
            picPreview.Image = Nothing<br />
        End If<br />
    End Sub<br />


When I go thorugh this function to repeat the same picture Time by time,
The memory accumulate 3MB each time!! Dead | X|
Anyone can help me to see what the problem is??
How can I improve it?
AnswerRe: Serious Problem on Memory Usage Pin
Owner drawn19-Jan-06 0:33
Owner drawn19-Jan-06 0:33 
AnswerRe: Serious Problem on Memory Usage Pin
Dave Kreskowiak19-Jan-06 6:14
mveDave Kreskowiak19-Jan-06 6:14 
GeneralRe: Serious Problem on Memory Usage Pin
cylix200019-Jan-06 13:57
cylix200019-Jan-06 13:57 
GeneralRe: Serious Problem on Memory Usage Pin
Dave Kreskowiak19-Jan-06 15:02
mveDave Kreskowiak19-Jan-06 15:02 
GeneralRe: Serious Problem on Memory Usage Pin
shiroamachi19-Jan-06 15:40
shiroamachi19-Jan-06 15:40 
GeneralRe: Serious Problem on Memory Usage Pin
Steve Pullan19-Jan-06 17:29
Steve Pullan19-Jan-06 17:29 
QuestionForm Screen becomes blank during processing Pin
mayhem_rules18-Jan-06 21:59
mayhem_rules18-Jan-06 21:59 
AnswerRe: Form Screen becomes blank during processing Pin
Owner drawn18-Jan-06 22:18
Owner drawn18-Jan-06 22:18 
GeneralRe: Form Screen becomes blank during processing Pin
mayhem_rules18-Jan-06 22:26
mayhem_rules18-Jan-06 22:26 
GeneralRe: Form Screen becomes blank during processing Pin
Owner drawn18-Jan-06 22:50
Owner drawn18-Jan-06 22:50 
GeneralRe: Form Screen becomes blank during processing Pin
mayhem_rules19-Jan-06 2:05
mayhem_rules19-Jan-06 2:05 
QuestionWhat Object to make image Button ? Pin
cylix200018-Jan-06 21:37
cylix200018-Jan-06 21:37 
AnswerRe: What Object to make image Button ? Pin
Owner drawn18-Jan-06 22:22
Owner drawn18-Jan-06 22:22 
QuestionExport DataGrid Data To Excel Pin
mayhem_rules18-Jan-06 19:27
mayhem_rules18-Jan-06 19:27 
AnswerRe: Export DataGrid Data To Excel Pin
_mubashir18-Jan-06 21:59
_mubashir18-Jan-06 21:59 
GeneralRe: Export DataGrid Data To Excel Pin
mayhem_rules18-Jan-06 22:30
mayhem_rules18-Jan-06 22:30 
AnswerRe: Export DataGrid Data To Excel Pin
abhinish19-Jan-06 1:15
abhinish19-Jan-06 1:15 

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.