473,320 Members | 2,004 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,320 software developers and data experts.

.Net CF - working with events in C#

I noticed when trying write an application for PocketPC and deciding to
program in VB or C# that for event handling VB seems to have more options
than C#. Specifically I want to be able to respond to mouse clicks on a
pictureBox control. VB clearly has a _click event for pictureboxes amoung
many other events, However C# only had one event... something like
_parentChanged and that was it. Is there a way I can add event handlers like
_click to a pictureBox (or any other component) in C#? I could just switch
to VB but my experience so far is in C and Java so I feel more at home with
C# than VB.

David A. Mathew
ma******@rose-hulman.edu
Nov 16 '05 #1
3 2948
David,

The Compact Framework PictureBox is not 'clickable' in the traditional
sense.

Handle the mouseup event to respond to a 'click' on a PictureBox.

Example below of converting pixels to latlong for a MapPoint Web Service
map in a picturebox.

// define your event handler
pbMap.MouseUp += new System.Windows.Forms.MouseEventHandler(pbMap_Mouse Up);

// code your event handler
private void pbMap_MouseUp(object sender, MouseEventArgs e)
{
//Define a PixelCoord
PixelCoord point = new PixelCoord();
point.X = e.X;
point.Y = e.Y;

this.ConvertOnClient(point);
}

-Darren

"David A. Mathew" <ma******@rose-hulman.edu> wrote in message
news:e3**************@TK2MSFTNGP10.phx.gbl...
I noticed when trying write an application for PocketPC and deciding to
program in VB or C# that for event handling VB seems to have more options
than C#. Specifically I want to be able to respond to mouse clicks on a
pictureBox control. VB clearly has a _click event for pictureboxes amoung
many other events, However C# only had one event... something like
_parentChanged and that was it. Is there a way I can add event handlers
like _click to a pictureBox (or any other component) in C#? I could just
switch to VB but my experience so far is in C and Java so I feel more at
home with C# than VB.

David A. Mathew
ma******@rose-hulman.edu

Nov 16 '05 #2
The same events are available in VB and C# - they are in effect no different
as far as feature sets go (well C# does have unsafe code, which I love, but
it's not often needed). I can only guess that you're looking at the events
the UI says are available. Mistake. It's usually wrong. It lists some
that aren't available, and often doesn't list those that are.

-Chris
"David A. Mathew" <ma******@rose-hulman.edu> wrote in message
news:e3**************@TK2MSFTNGP10.phx.gbl...
I noticed when trying write an application for PocketPC and deciding to
program in VB or C# that for event handling VB seems to have more options
than C#. Specifically I want to be able to respond to mouse clicks on a
pictureBox control. VB clearly has a _click event for pictureboxes amoung
many other events, However C# only had one event... something like
_parentChanged and that was it. Is there a way I can add event handlers
like
_click to a pictureBox (or any other component) in C#? I could just switch
to VB but my experience so far is in C and Java so I feel more at home
with
C# than VB.

David A. Mathew
ma******@rose-hulman.edu

Nov 16 '05 #3
Hi David,

Yes, the porperty browser doesn't list the click event, but it is there and
is supported by CF for PictureBox.
But because it is not in the property browser you need to hooked in the
code.
All .NET languages use the same framework's assemblies thus, it is not
possible one language to have some event, but other not.
Event section in MSDN doesn't specify explicitly if an event is supported by
CF or not. That can be found if you look at the respective OnXXX method.
OnClick is supported by CF so the Click event.
I run a test on Windows CE .NET and Pocked PC emulators. Yes, it fires click
event.
--
HTH
Stoitcho Goutsev (100) [C# MVP]

"David A. Mathew" <ma******@rose-hulman.edu> wrote in message
news:e3**************@TK2MSFTNGP10.phx.gbl...
I noticed when trying write an application for PocketPC and deciding to
program in VB or C# that for event handling VB seems to have more options
than C#. Specifically I want to be able to respond to mouse clicks on a
pictureBox control. VB clearly has a _click event for pictureboxes amoung
many other events, However C# only had one event... something like
_parentChanged and that was it. Is there a way I can add event handlers
like _click to a pictureBox (or any other component) in C#? I could just
switch to VB but my experience so far is in C and Java so I feel more at
home with C# than VB.

David A. Mathew
ma******@rose-hulman.edu

Nov 16 '05 #4

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

Similar topics

12
by: Epetruk | last post by:
Hi all, I want a page where the contents of a table cell are replaced with an image when the mouse moves over the cell, and the text is restored when the mouse moves out. Here's the html for the...
4
by: Ross | last post by:
I have been using the following script to return a scrollbar to the position it was in before the data was posted. It works in ie but not in firefox. Thanks, R. <script...
0
by: Chandra | last post by:
Hi, I tried the following: >>> from win32com.client import DispatchWithEvents >>> class BackupEvent: .... def OnPercentComplete(self, sMessage, nPercent): .... print sMessage,...
4
by: rich | last post by:
Hi, Been trying to work through a simple drag and drop interface using either IMG, SPAN or DIV tags. That way I can define blocks of text and/or graphics as draggable and be able to drop them on...
2
by: Sam Marrocco | last post by:
Is it normal activity for the keypress events of a form to stop working when button controls are on the form? I have a situation where a form that behaves normally, is capable of sending KeyPress,...
2
by: hepsibasushmap | last post by:
Hi all, I had downloaded the Xerces C++ DOMLibrary and had also prepared a parser which reads a file which is similar to our Menu. Now in the similarway iam trying to prepare a parser for one...
4
by: ThunderMusic | last post by:
Hi, I'm developping a form that renders differently when hovered and trigger some processing when not hovered (leaved). The thing is, when I leave my form and another form from my application is...
1
by: =?Utf-8?B?RGlnaXRhbERpYW1vbmQ=?= | last post by:
I'm fairly new to dotNet but I've set up a web site and SQL database, with Health monitoring on which works fine localy on my development machine. However when ever upload the web site to our web...
1
by: kigoobe | last post by:
Hi friends, I'm having three queries that works perfectly ... SELECT ib.id as id, ib.titre as title, ib.date_expire as date_fin, ib.created_at as date_creation, eb.content as content, '' FROM...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.