473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

PaintEventArgs becoming empty -> black screen

Hi,

To get faster performance of my DataGrid during scrolling I wanted to build
a timer in the Paint-event that waited some milli-seconds to Paint and
cancelled the method in case it received a new Paint (during scrolling).

But it doesn't seem to work :-(

The whole screen becomes empty, and when I look into the PaintEventArgs it
returns several errors (for exemple: ?petmr.Graphics.Clip -> <error: an
exception of type: {System.ArgumentException} occurred>).

Does anybody knows a solution for this?

Thanks a lot in advance!

Pieter

This is my code:
Protected Overrides Sub OnPaint(ByVal pe As
System.Windows.Forms.PaintEventArgs)
'my override
'stop the timer
tmrPaint.Stop()
'store the PaintEventArgs
peTmr = pe
'restart the timer
tmrPaint.Start()
End Sub

Private Sub tmrPaint_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles tmrPaint.Elapsed
'call my paint-method
SubOnPaint(peTmr)
End Sub

Private Sub SubOnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs)
'do all the painting stuff with MyBase.Paint etc etc
End sub


Jul 26 '05 #1
2 1964
DraguVaso wrote:
Hi,

To get faster performance of my DataGrid during scrolling I wanted to build
a timer in the Paint-event that waited some milli-seconds to Paint and
cancelled the method in case it received a new Paint (during scrolling).

But it doesn't seem to work :-(

The whole screen becomes empty, and when I look into the PaintEventArgs it
returns several errors (for exemple: ?petmr.Graphics.Clip -> <error: an
exception of type: {System.ArgumentException} occurred>).

Does anybody knows a solution for this?

Thanks a lot in advance!

Pieter

This is my code:
Protected Overrides Sub OnPaint(ByVal pe As
System.Windows.Forms.PaintEventArgs)
'my override
'stop the timer
tmrPaint.Stop()
'store the PaintEventArgs
peTmr = pe
'restart the timer
tmrPaint.Start()
End Sub

Private Sub tmrPaint_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles tmrPaint.Elapsed
'call my paint-method
SubOnPaint(peTmr)
End Sub

Private Sub SubOnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs)
'do all the painting stuff with MyBase.Paint etc etc
End sub


don't you need to do a mybase.onpaint(...)

chris
Jul 26 '05 #2
Yes it's indeed a MyBase.OnPaint(pe) etc.
But the problem isn't in that part, because everything works fine without
the timer (but just not as fast as I would like to have it).

"Chris" <no@spam.com> wrote in message
news:OY*************@tk2msftngp13.phx.gbl...
DraguVaso wrote:
Hi,

To get faster performance of my DataGrid during scrolling I wanted to build a timer in the Paint-event that waited some milli-seconds to Paint and
cancelled the method in case it received a new Paint (during scrolling).

But it doesn't seem to work :-(

The whole screen becomes empty, and when I look into the PaintEventArgs it returns several errors (for exemple: ?petmr.Graphics.Clip -> <error: an
exception of type: {System.ArgumentException} occurred>).

Does anybody knows a solution for this?

Thanks a lot in advance!

Pieter

This is my code:
Protected Overrides Sub OnPaint(ByVal pe As
System.Windows.Forms.PaintEventArgs)
'my override
'stop the timer
tmrPaint.Stop()
'store the PaintEventArgs
peTmr = pe
'restart the timer
tmrPaint.Start()
End Sub

Private Sub tmrPaint_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles tmrPaint.Elapsed
'call my paint-method
SubOnPaint(peTmr)
End Sub

Private Sub SubOnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs) 'do all the painting stuff with MyBase.Paint etc etc
End sub


don't you need to do a mybase.onpaint(...)

chris

Jul 27 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Arthur | last post by:
Did I hallucinate something about __name__ becoming read-write? Not in alpha2. Can't find the reference to this I thought I read - that it was concluded to be necessary in connection with...
6
by: gong | last post by:
hi i recently looked at alexandrescu's book on c++, and i found it pretty much unintelligible. i have a few points which i wonder about. 1. as a developer, it is important, from a bottom line...
3
by: Laszlo Szijarto | last post by:
Is there any way to stop a form from ever becoming the Active Form in an application? Thank you, Laszlo
3
by: Xarky | last post by:
Hi, I am overriding the method given to draw ellipses on my window, using the following code. My problem is that I have a button that every time it is pressed, a variable is inremented,...
7
by: Jim Michaels | last post by:
This is a simple coding tip I learned to prevent comparisons from becoming assignments (and this becoming a hair-pulling session during debugging): in comparisons, try to put your constants on...
14
by: Erik | last post by:
Hi, i'm trying to do this : #include <stdlib.h> #include <stdio.h> #define FILE "/tmp/myfile" #define USERS_LIST "/tmp/userslist" int main() { //open file
16
by: Singulus | last post by:
Hello all, I've searched for similar threads, I've found some bit of useful info here and there, but nevertheless I want to post my questions...So, how can I (we, in fact the forum can benefit...
28
MMcCarthy
by: MMcCarthy | last post by:
I made this statement in a thread earlier ... "Macros are becoming obsolete as they are very difficult to maintain" JConsulting suggested I create a debate on the subject, so I am :) I made...
3
by: wingsganesh | last post by:
Hi Buddy, see my small example, Public Sub myPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.DrawString(" MichaelAyvazyan", Font, New SolidBrush(Color.Beige), 100, 100) ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.