Hi all,
I do some drawing in a form's paint event handler and I have a button on
that form. Whenever the mouse enters or leaves the button Form's paint event
occurs. Isn't that a strange behavior? Is it possible to prevent that?
Thanks. 4 4900
Hi,
Are you doing something in the Enter/Leave events?
The mouse cursor itself does not trigger paint events as Windows keeps
track of whatever the cursor covers and paints it back when the cursor
moves.
On Mon, 11 Sep 2006 13:59:18 +0200, Kürşat <ku***********@ hotmail.com>
wrote:
Hi all,
I do some drawing in a form's paint event handler and I have a button on
that form. Whenever the mouse enters or leaves the button Form's paint
event
occurs. Isn't that a strange behavior? Is it possible to prevent that?
Thanks.
--
Happy Coding!
Morten Wennevik [C# MVP]
Hi,
No, Enter/Leave events aren't handled. Button itself triggers paint event.
Tested on different systems. Strange but true! (Button is XP style)
"Morten Wennevik" <Mo************ @hotmail.comwro te in message
news:op.tfpue7b uklbvpo@tr024.. .
Hi,
Are you doing something in the Enter/Leave events?
The mouse cursor itself does not trigger paint events as Windows keeps
track of whatever the cursor covers and paints it back when the cursor
moves.
On Mon, 11 Sep 2006 13:59:18 +0200, Kürşat <ku***********@ hotmail.com>
wrote:
>Hi all,
I do some drawing in a form's paint event handler and I have a button on that form. Whenever the mouse enters or leaves the button Form's paint event occurs. Isn't that a strange behavior? Is it possible to prevent that?
Thanks.
--
Happy Coding!
Morten Wennevik [C# MVP]
Ah, the Button's Paint event.
I think because the Button can change characteristics based when a cursor
moves over it, it receives a Paint when the mouse enters/leaves.
You can prevent this by created your own button and disable the default
OnMouseEnter and OnMouseLeave events
public class MyButton : Button
{
protected override void OnMouseEnter(Ev entArgs e)
{
//base.OnMouseEnt er(e);
}
protected override void OnMouseLeave(Ev entArgs e)
{
//base.OnMouseLea ve(e);
}
}
On Mon, 11 Sep 2006 15:48:24 +0200, Kürsat <ku***********@ hotmail.com>
wrote:
Hi,
No, Enter/Leave events aren't handled. Button itself triggers paint
event.
Tested on different systems. Strange but true! (Button is XP style)
"Morten Wennevik" <Mo************ @hotmail.comwro te in message
news:op.tfpue7b uklbvpo@tr024.. .
>Hi,
Are you doing something in the Enter/Leave events?
The mouse cursor itself does not trigger paint events as Windows keeps track of whatever the cursor covers and paints it back when the cursor moves.
On Mon, 11 Sep 2006 13:59:18 +0200, Kürşat <ku***********@ hotmail.com> wrote:
>>Hi all,
I do some drawing in a form's paint event handler and I have a button on that form. Whenever the mouse enters or leaves the button Form's paint event occurs. Isn't that a strange behavior? Is it possible to prevent that?
Thanks.
-- Happy Coding! Morten Wennevik [C# MVP]
--
Happy Coding!
Morten Wennevik [C# MVP]
Morten,
The paint event is treiggered by a WM_PRINTCLIENT messages receieved by the
form.
I believe this has something to do with VisualStyles, but the interesting
part is that this message is send only by the push button. Check boxes for
example doesn't have this effect. Sop what I did is to handle that message
in the WndProc. Doing this I managed to suppress the strange paint event and
everything with the XP styles looks fine. However I think this is send by
the button for a reason and I cannot guarantee that there won't be any
problems beside the fact that the control won't respond to the
WM_PRINTCLIENT message correctly :).
Override the form's WndProc method and add the following code
const int WM_PRINTCLIENT = 0x0318;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PRINTCLIENT)
{
return;
}
base.WndProc(re f m);
}
}
--
HTH
Stoitcho Goutsev (100)
"Kürsat" <ku***********@ hotmail.comwrot e in message
news:eo******** ******@TK2MSFTN GP06.phx.gbl...
Hi,
No, Enter/Leave events aren't handled. Button itself triggers paint event.
Tested on different systems. Strange but true! (Button is XP style)
"Morten Wennevik" <Mo************ @hotmail.comwro te in message
news:op.tfpue7b uklbvpo@tr024.. .
>Hi,
Are you doing something in the Enter/Leave events?
The mouse cursor itself does not trigger paint events as Windows keeps track of whatever the cursor covers and paints it back when the cursor moves.
On Mon, 11 Sep 2006 13:59:18 +0200, Kürşat <ku***********@ hotmail.com> wrote:
>>Hi all,
I do some drawing in a form's paint event handler and I have a button on that form. Whenever the mouse enters or leaves the button Form's paint event occurs. Isn't that a strange behavior? Is it possible to prevent that?
Thanks.
-- Happy Coding! Morten Wennevik [C# MVP]
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tamir Khason |
last post by:
How I can paint something onClick event?
I need PaintEventArgs event in order to paint and raise Graphics, but
onClick I have only EventArgs Event...
Thanx
|
by: Tamir Khason |
last post by:
Why when I lost focus (go to back) on form all GDI+ paints disappears.....
BUG or I do something wrong????
TNX
|
by: Rene |
last post by:
Currently, the paint even will only acknowledge painting going on inside of
the ClipRectangle, any of the drawing that is outside of the ClipRectangle
is ignored.
How can I get the paint event to redraw Everything?
|
by: WStoreyII |
last post by:
i am using this code to try to paint a line on my form and it wont work i
get an object not set to a reference error
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics As System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawLine(myPen, 0, 0, 200, 200)
|
by: jcrouse |
last post by:
I am rotating some text is some label controls. In the one place I use it it
works fine. In the other place I use it I can't figure out the syntax. I
don't really understand the event. Where it works fine, it seems to fire
when the form changes visibility. Here is the code.
Private Sub lblP1JoyUp_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles lblP1JoyUp.Paint
If lblP1JoyUp.Visible = True Then
Dim...
| |
by: Sam |
last post by:
Hai,
I use a paintbox paint event to draw some images in a paintbox. I call
the paint event by refreshing the paintbox using paintboxname.refresh()
or paintboxname.update().
Problem with this kind of paint event is that the event is not raised
when the application is run in a minimized state. So, my question is:
How can you make sure that the paint event is called even when the
application is running in the minimized state.
|
by: Kool-Aide |
last post by:
Alright, here goes...When I put a menu strip on the windows form I can
double click the exit button to go to the source page and it takes me to the
on click exit blah blah blah and you would put Application.Exit(); Alright
well what would I put for the print preview and the print and Save and
saveas and open and new? I can't find anything for these. I am new at this
and I am sure I am not going in the correct order to learn this stuff but I...
|
by: Rotsey |
last post by:
Hi,
I have a interface that I use for a form so I can pass the form
to another object.
How do I add the Paint event to the interface and subsequently
handle the paint event in my other object.?
I am not sure of the syntax required to do this?
|
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= |
last post by:
Hi,
On a usercontrol I've put a set of radiobuttons within a groupbox. These
radiobuttons have visual style enables, i.e. they turn orange when hovering
over them and green when pushed.
Normally I put my updation of data shown in the controls on the usercontrol
in the Paint event handler of the usercontrol. When it comes to the
radiobuttons, a paint event for the usercontrol is fired whenever hovering
over the radiobuttons, making...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |