Solved

VB.net Paint a Taskpane

Posted on 2012-04-08
2
300 Views
Last Modified: 2012-04-09
Hi. I am trying to paint my TaskPane control. What is the best way to do this? In the code below I tried filling a Panel but how would I change the code to paint the actual TaskBar

    Private Sub TaskPaneControl_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim graphics As Graphics = Panel1.CreateGraphics()
        Dim rectBrush As New Rectangle(0, 0, 400, 200)
        Dim brush As LinearGradientBrush
        brush = New LinearGradientBrush(rectBrush, Color.FromArgb(46, 100, 160), _
                        Color.White, LinearGradientMode.Horizontal)
        graphics.FillRectangle(brush, rectBrush)
        graphics.Dispose()
    End Sub
1
0
Comment
Question by:murbro
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 37822172
Change:

    Dim graphics As Graphics = Panel1.CreateGraphics()

To:

    Dim graphics As Graphics = e.Graphics()

And get rid of the Dispose() call:

    ' graphics.Dispose() <-- get rid of this line
0
 

Author Closing Comment

by:murbro
ID: 37822619
Thanks very much
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now