473,480 Members | 2,230 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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


Nov 21 '05 #1
2 1086
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
Nov 21 '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

Nov 21 '05 #3

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

Similar topics

19
1780
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
2223
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
1198
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
9453
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
1384
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
1811
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
5859
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
3727
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
5263
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
7049
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6912
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
565
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.