473,657 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control.Paint and onPaint( ) events gone missing

Consider a UserControl to which you do

userControl.Pai nt += new PaintEventHandl er(paint_method )

If you don't like that way, and prefer to override onPaint( ) then the
problem stated below still exists (I tried both ways).

Imagine you have a Console.WriteLi ne( ) in the paint method so you know
when its getting called. Also there is no place in the code that
userControl.Pai nt is -+ so the event is *never* removed.

At some point, after the first call of paint_method, subsequent calls to
repaint are never fired. So it doesnt matter if i call

userControl.Inv alidate(), userControl.Ref resh() etc

the paint_method/onPaint( ) code is never executed.

My question is, does anyone know why non-user classes would ever remove
the ability to paint a component? Even if i add the userControl.Pai nt
event back in, the paint method fails to get called again. Its like
sometime after the first paint, someone has ticked the 'never repaint
ever ever again' checkbox.

Another thing that is annoying (when debugging this) is that I can't
seem to go

userControl.Pai nt

on the immediate window, or under the debugger explorer to find out its
actual value, so I could keep querying it and notice at what line of
code it goes missing.

In the end I was forced to do:

paintMethod(use rControl, new
PaintEventArgs( userControl.Cre ateGraphics(), new
Rectangle(0,0,u serControl.Widt h, userControl.Hei ght)));

which seemed to get it working. But I'm still curious as to the
aforementioned error. Any thoughts?

Wal
--

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
0 1908

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

Similar topics

11
1801
by: dave | last post by:
I have been using vb.net /asp.net for 2 years. I am slowing switching over to c# and have 2 questions. 1.) Within vb.net I can go into asp.net project properties and I can enter the imports once for the project. Can I do this with a c# asp.net project? (or am i forced to put using on each and every asp.net page?) 2.) Within vs.net with a vb.net project, while editing the code behind file, i have 2 drop downs along the top
2
2247
by: Simon Kravis | last post by:
After adding a TabControl to an Access 2000 form during screen redesign, I found that when cutting and pasting a group of controls (option groups, option buttons, command buttons, MSFlexGrid) into the first page of the tab control, no control events were fired by any of the pasted controls, even though their appearance changed as though events were being triggered. I found that new controls defined in the tab page generated events...
0
997
by: Charles Clarke | last post by:
Hi All Does anyone have an idea on how to do the following? In the editmode template of a datagrid control I have 2 dropdownlist controls The contents of the second depends on the Selection of the first While in edit mode; How do I catch the "SelectedIndexChanged" event of
1
8155
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the first time the control is dynamically loaded, everything works fine. After that, if the control is loaded again from the page button event handler, the user controls events fail to fire on the first click NOTE: I (believe I) am rebuilding all...
0
938
by: Jim Reynolds | last post by:
Hi, Could anyone tell me how I trigger user control events from a web page? Thanks Jim
3
1888
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
I have a form with a bunch (maybe 30) different controls that generate events when changed, clicked, etc. The various event handlers in turn might change some of these controls, thereby causing other events, which is not what I want. So, is there a simple way to turn off all events for a particular form, then turn them all back on? I know I can individually turn them off and on by using -= and += but that seems like a pretty brutal thing...
1
1151
by: James | last post by:
Im new to c# I dont completely understand sender and e in control events for example enter event what is sender and e there properties TIA James
2
2734
by: Michal Valent | last post by:
I would like to fire some custom server control event before Page_Load event like this (from the trace of an aspx page) : Trace Information Category Message From First(s) From Last(s) aspx.page Begin PreInit aspx.page End PreInit 5,38454603734274E-05 0,000054 aspx.page Begin Init 8,96405962016187E-05 0,000036 aspx.page End Init 0,00072941040948794 0,000640 aspx.page Begin InitComplete 0,000772971258380746 0,000044
1
1021
by: Rodrigo Defavari | last post by:
Hello People ! I need to direction all control events of a form to the function that will be responsible for treating them, but I won't this function be added to the handler of each control event. Im trying to save and recovery the events from the database, to manipulate it dynamically!
0
943
by: Just D | last post by:
Could anybody show a quick example of the source code with a simple working User Control? I'd like particularly to learn how to work with the User Control events, how to fire an event catching the event from some control used by the User Control, to let the page using the User Control work with this event. Thanks, D.
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8826
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1955
muto222
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.