473,796 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create ( not handle) a mouse/keyboard event ?

Hi All,

We can process the mouse/keyboard events by handling, however, how to
create a event on a target form ( ex: webbrowser ) ?

Thanks!

Best regards,
Boki.

Jun 28 '07 #1
2 2846
"Boki" <bo******@ms21. hinet.netwrote in message
news:11******** *************@o 11g2000prd.goog legroups.com...
We can process the mouse/keyboard events by handling, however, how to
create a event on a target form ( ex: webbrowser ) ?
You create an event inside any class, which includes a form if that is
what you wish. Any consumer referencing your class can then handle the
events that are fired by your class.

Creating the event in C# is a two-step process: You create a delegate
with the type of the event and then you create the event itself:

public delegate void MyEventHandler( object sender, EventArgs e);
public event MyEventHandler MyEvent;

Now you have to decide under which conditions you want to raise that
event. When those conditions are met in your class you raise the event by
calling it:

if (mycondition)
{
if (MyEvent!=null) MyEvent(this, EventArgs.Empty );
}

Notice the check for a null condition. This is to avoid an error in case
no one has subscribed to the event.
Notice also that we included two arguments, 'sender' and 'e'. This
follows the pattern that Microsoft established for all the events in the
Framework, but it is not a requirement for the event to work. You can define
events with any combination of arguments.

Jun 28 '07 #2
Did you look at http://msdn2.microsoft.com/en-us/library/ms171548.aspx
?
"Boki" <bo******@ms21. hinet.netwrote in message
news:11******** *************@o 11g2000prd.goog legroups.com...
Hi All,

We can process the mouse/keyboard events by handling, however, how to
create a event on a target form ( ex: webbrowser ) ?

Thanks!

Best regards,
Boki.


Jun 28 '07 #3

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

Similar topics

1
12246
by: Michael J Whitmore | last post by:
Greetings, I have a very simple question. How do you simulate a user input to turn off a screen saver in Windows (either a mouse movement, mouse click, or keyboard input)? I promise I searched the newsgroup before asking :) I have written the following program that loads all my Webshots files into the Webshots photo manager, or so I thought. When you load the first it starts the screen saver. All other subsequent ones are not
2
2885
by: Carl Gilbert | last post by:
Hi I have a basic page for which I have included some of the code for at the end of this message. It may not run correctly as I have cropped out a lot of code. I am trying to handle the click event for a cell. From the code you should be able to see that I am handling the mouse over event and would like to link to another page via the cell click.
3
13063
by: Lachlan Hunt | last post by:
Hi, I've been looking up lots of documentation and trying to work out a cross-platform method of capturing a keyboard event and working out which key was pressed. From what I can find, there doesn't appear to be any standardised keyboard event interface other than this DOM 3 Events W3C Working Group Note . However, it is only a note and doesn't appear to be implemented in any browser. Is there another standard that I've missed? The...
4
2734
by: ML | last post by:
I am trying to use the mouse wheel event on a numeric input box to allow the use to scroll to inc/dec the value by 1. The issue I am having is that the delta value returned seems to be off. From my understanding the delta is the number of detents the mouse has moved. The standard detent is supposedly 120 for one notch of the wheel, however when I turn the wheel 1 click I get 240. Is there someway to determine the actual detent setting...
1
5462
by: MrNobody | last post by:
What kind of wizardry do I have to pull off so I can capture a mouse click event or a key press event from OUTSIDE my form? Ideally, with either case I also consume the event so that it does not reach whatever app besides mine is currently in focus... but it's not totally necessary if it's too much work.
0
1005
by: skip | last post by:
Sorry to bomb this list with an off-topic post, however... Ages ago I wrote a mouse/keyboard watcher in Python+Tk: http://sf.net/projects/watch. It's been idle for a long while though, isn't terribly portable and doesn't work properly with tools like Synergy (http://sf.net/projects/synergy2). Someone, I thought from this list or maybe python-dev, told me about a newer open source application in the same space which is more portable and...
1
1680
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I want to do something similar to what some macro tools do, where they perform mouse/keyboard events on the user's machine , while intercepting the user's current keyboard/mouse events so that it does not interfere (unless they press a certain hotkey to deactivate it). How would I go about doing this?
3
2644
by: pfm721 | last post by:
I know the control tip text will display information about a text box. However I was wondering if there is a way to change it based on the value of the text box. Is it possible to create a mouse move event that will do the same thing? i.e. value of txtStatus If = A then "good" If = B then "bad" something to that effect. I don't really know if it is possible or how to code it. Any help would be greatly appreciated. Thanks,
4
2581
by: shariquekhan | last post by:
Hi, I am using windows forms. I have a problem in handling mouse events. In my application there is menu bar on top. In menu bar I have several toolstripmenu items. I want that when toolstripmenu item is highlighted, it shows some description in label. I am totally confused. What event I used to handle this problem. I used mouse enter, mouse move & mouse leave event but when mouse enters in the area of any menu item, its alright. The label shows...
0
9673
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, 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...
0
9524
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
10449
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
10217
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
10168
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,...
1
7546
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 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...
0
5440
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
4114
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
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.