🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: free.it.visual-basic
Article #111

vb.net problema di accumulo di memoria su custom control

#111
From: DeskDeck
Date: Mon, 19 Oct 2009 21:17
85 lines
4039 bytes
alve..ho un problema per quanto riguarda un controllo personalizzato
che sto cercando di creare..
Quato problema riguarda un accumulo di memoria del controllo...
Uso Visual Basic .net
Vi spiego il problema:
Ho creato un controllo personalizzato..che devo usare come pulsante..!!!
Ho inserito un Timer e
Ho inserito un ImageList e ho inserito all'interno 5 immagini 
indicizzate...(che serve per creare un aminazione sull'oggetto
background del controllo stesso quando ci passo sopra con il mouse
con l'evento MouseEnter tramite il Timer).
**********************************************
ecco il codice:
**********************************************
Public Class Pulsante
'----------
Dim Conta As Integer = 0
Private UscitaAnt As Boolean
'----------
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Timer1.Tick
         '------------
         Timer1.Interval = 20
         '------------
                 If Conta = 4 Then
                     '----
                     Timer1.Enabled = False
                     Conta = 0
                     '************
                     If UscitaAnt = True Then
                         '---
                         Me.BackgroundImage = ImageList1.Images(0)
                         UscitaAnt = False
                         '---
                     Else
                         '---
                         Me.BackgroundImage = ImageList1.Images(4)
                         '---
                     End If
                     '************
                 Else
                     Conta = Conta + 1
                     Me.BackgroundImage = ImageList1.Images(Conta)
                 End If
        '--------

     End Sub
'----------
     Private Sub Pulsante_MouseEnter(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles Me.MouseEnter
         '---------
         UscitaAnt = False
         Timer1.Enabled = True
         Me.BackColor = Color.LightCyan
         '------------
     End Sub

     Private Sub Pulsante_MouseLeave(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles Me.MouseLeave
         '-----------
         UscitaAnt = True
         Me.BackgroundImage =  ImageList1.Images(0)
         Me.BackColor = Color.White
         '------------
     End Sub
'-----------
End Class

**********************************
Adesso il mio problema e il seguente:
quando lo avvio vedo che ogni volta eseguo l'evento MouseEnter
la memoria che usa il controllo si incremente sempre...
e come se accumulasse la memoria ogni volta che cambio
l'immagine nell'oggetto me.backgound..
*******************************
ho notato che se invece dell imagelist uso
l'oggetto resouce la memoria si incremente sempre
ma e di meno...

*----
Adesso qualche d'uno mi puo dare qualche soluzione
per non far incrementare la memoria del Controllo ?


Grazie...
Technical Details
Message-ID: <4adcd787$0$1104$4fafbaef@reader1.news.tin.it>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder.news-service.com!news2.euro.net!newsfeed.freenet.de!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.news.tin.it!spool.news.tin.it!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 3de4ef2fba,41679a284c6621ac,start
X-Google-Attributes: gid3de4ef2fba,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ITALIAN,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder.news-service.com!news2.euro.net!newsfeed.freenet.de!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.news.tin.it!spool.news.tin.it!not-for-mail
Date: Mon, 19 Oct 2009 23:17:59 +0200
From: DeskDeck <mecdeck@alice.it>
Reply-To: mecdeck@alice.it
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
Newsgroups: free.it.visual-basic
Subject: vb.net problema di accumulo di memoria su custom control
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 85
Message-ID: <4adcd787$0$1104$4fafbaef@reader1.news.tin.it>
Organization: TIN.IT (http://www.tin.it)
X-Comments: Please send technical notifications to newsmaster@tin.it
NNTP-Posting-Host: 82.57.29.202
X-Trace: 1255987080 reader1.news.tin.it 1104 82.57.29.202:9446
X-Complaints-To: Please send abuse reports to abuse@retail.telecomitalia.it