Solved

VB.net Paint a Taskpane

Posted on 2012-04-08
2
307 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

837 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