• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

SCREEN FLICKERING WHEN I ADDED ICON IN WINFORM USING DRAWING IN VB.NET

my problem is
when i added icon inside
win form
using graphics

it is added successfully
but when
I run the program
the project
as well as the desktop
sceen starts to
flicker

what is the problem and how to eradicate this
please solve

i have attached the code
Private Sub frm_List_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
     
        PaintObj(e)

    End Sub
 Private Sub PaintObj(ByVal e As PaintEventArgs)
      

        Me.Icon = New System.Drawing.Icon("D:\new\Calculate\Calculate\Resources\setup.ico")
        Dim graphics As Graphics = e.Graphics

        Dim pen As New Pen(Color.Chocolate)

        graphics.DrawRectangle(pen, 10, 10, 200, 100)
        graphics.DrawLine(pen, 0, 40, 10, 100)
        graphics.DrawIcon(Icon, 30, 100)





    End Sub

Open in new window

0
code_me
Asked:
code_me
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Try like this:
Public Class frm_List_Paint

    Private Sub frm_List_Paint_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Icon = New System.Drawing.Icon("D:\new\Calculate\Calculate\Resources\setup.ico")
    End Sub

    Private Sub frm_List_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        PaintObj(e)
    End Sub

    Private Sub PaintObj(ByVal e As PaintEventArgs)
        Dim G As Graphics = e.Graphics
        G.DrawRectangle(Pens.Chocolate, 10, 10, 200, 100)
        G.DrawLine(Pens.Chocolate, 0, 40, 10, 100)
        G.DrawIcon(Me.Icon, 30, 100)
    End Sub

End Class

Open in new window

0
 
code_meAuthor Commented:
thanKs
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now