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

Classwizard in C# like in VC++

Hello all,

New to .NET and was wondering if there is a classwizard to create
code for message like VC++ has now, ie. automatically create code for
KeyDown or MouseMove.

Thanks
Ralph
Nov 15 '05 #1
5 2376
I'm not to familiar with VC++'s wizards, but things like KeyDown and
MouseMove aren't handled via messages(usually) in .NET, you would override
the appropriate OnXxx method(OnKeyDown and OnMouseMove respectivly) on your
form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@consiliumsoft.com> wrote in message
news:49**************************@posting.google.c om...
Hello all,

New to .NET and was wondering if there is a classwizard to create
code for message like VC++ has now, ie. automatically create code for
KeyDown or MouseMove.

Thanks
Ralph

Nov 15 '05 #2
If I wanted to add a mouse move event handler, do I just type in all the
code or is there a wizard that I can tell to add the template code to my
code?
"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
I'm not to familiar with VC++'s wizards, but things like KeyDown and
MouseMove aren't handled via messages(usually) in .NET, you would override
the appropriate OnXxx method(OnKeyDown and OnMouseMove respectivly) on your form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@consiliumsoft.com> wrote in message
news:49**************************@posting.google.c om...
Hello all,

New to .NET and was wondering if there is a classwizard to create
code for message like VC++ has now, ie. automatically create code for
KeyDown or MouseMove.

Thanks
Ralph


Nov 15 '05 #3
Let me make this clear, at least more clear.

I have a text box in a form.

I want to add a method that would allow me to figure out if the mouse moves
over it, ie. WM_MOUSEMOVE
I want to add a method that would tell me when the text box loses focus, ie.
WM_KILLFOCUS
And I want to add a method that tells me when the user types in code,
WM_COMMAND and EM_SELCHANGE.

Do I have just cut and paste other methods and change the code to handle
these or is there a wizard in the IDE that I can say add the WM_MOUSEMOVE
code..

Hope that is better...

thanks
Ralph Krausse
"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
I'm not to familiar with VC++'s wizards, but things like KeyDown and
MouseMove aren't handled via messages(usually) in .NET, you would override
the appropriate OnXxx method(OnKeyDown and OnMouseMove respectivly) on your form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@consiliumsoft.com> wrote in message
news:49**************************@posting.google.c om...
Hello all,

New to .NET and was wondering if there is a classwizard to create
code for message like VC++ has now, ie. automatically create code for
KeyDown or MouseMove.

Thanks
Ralph


Nov 15 '05 #4

"Ralph Krausse" <go*******@consiliumsoft-nospam.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
Let me make this clear, at least more clear.

I have a text box in a form.

I want to add a method that would allow me to figure out if the mouse moves over it, ie. WM_MOUSEMOVE
I want to add a method that would tell me when the text box loses focus, ie. WM_KILLFOCUS
And I want to add a method that tells me when the user types in code,
WM_COMMAND and EM_SELCHANGE.

Do I have just cut and paste other methods and change the code to handle
these or is there a wizard in the IDE that I can say add the WM_MOUSEMOVE
code..

Hope that is better... Well, while you *could* handle the messages nativly, I wouldn't advise it.
Their is no wizard that performs such code insertion. For a standard .NET
form you would us code similar to:
using System;
using System.Windows.Forms;
public class MyForm : Form
{
public void override OnMouseMove(MouseMoveEventArgs e)
{
//do handling for OnMouseMove here
//this should be synonomous with WM_MOUSEMOVE
base.OnMouseMove(e);
}
public void override OnKeyPress(KeyPressEventArgs e)
{
//do handling for OnKeyPress here
//this should be synonomous with
}
}
For code that handles an event on a child control, like your text box you
have to hook up an event handler. In the IDE, on the properties dialog for
the text box, there is a lightning bolt symbol. By pressing that you will be
given a list of events, double clicking on the empty place beside the event
there will generate a handler. This does work for forms as well, but when
you are deriving from a control or a form you should override the
appropriate OnXxx method.
I hope that is clear enough, its hard to explain. Here is a basic example of
a form that hooks up to a handler for a given text box.(you'll have to set
up sizes and such if you want to actually use the code, however).

class Test : Form
{
TextBox textBox = new TextBox();
public Test()
{
this.Controls.Add(textBox);
textBox.MouseMove+=new MouseEventHandler(textBox_MouseMove);
textBox.KeyPress+=new KeyPressEventHandler(textBox_KeyPress);
}

private void textBox_MouseMove(object sender, MouseEventArgs e)
{
//Do what you want with MouseMove
}

private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
//Do what you want with KeyPress
}
}

thanks
Ralph Krausse
"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
I'm not to familiar with VC++'s wizards, but things like KeyDown and
MouseMove aren't handled via messages(usually) in .NET, you would override the appropriate OnXxx method(OnKeyDown and OnMouseMove respectivly) on

your
form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@consiliumsoft.com> wrote in message
news:49**************************@posting.google.c om...
Hello all,

New to .NET and was wondering if there is a classwizard to create
code for message like VC++ has now, ie. automatically create code for
KeyDown or MouseMove.

Thanks
Ralph



Nov 15 '05 #5
On Sun, 18 Jan 2004 15:35:55 -0500, "Ralph Krausse" <go*******@consiliumsoft-nospam.com> wrote:
Let me make this clear, at least more clear.

I have a text box in a form.

I want to add a method that would allow me to figure out if the mouse moves
over it, ie. WM_MOUSEMOVE


Think out of the box.

Right click on the textbox and open properties
Click on the events view (lightning bolt)
double-click on MouseMove event.
done.

bullshark
Nov 15 '05 #6

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

Similar topics

1
by: Martin LECHNER | last post by:
I have on question regarding the VC++ 6 Class wizard. Is there a way to customize cod output? I want to include a doxygen header for each file (cpp + h) I am doing it now per hand (include...
0
by: R Tamilarasan | last post by:
Curiosity made me to install VC - 7 (.net) in my machine which had VC - 6 already installed. I tried to compile my workspace in VC - 7 but failed due to several compile time errors. ok no...
11
by: Tatu Portin | last post by:
Have this kind of struct: typedef struct { char **user_comments; /* ... */ } vorbis_comment; /* prototype */ char * read_vorbis_string ( FILE *sc);
4
by: Anthony Gallagher | last post by:
I have a bunch of libraries compiled using VC++ 6.0, and I am trying to recompile one of our projects using VC++ .NET. I get all kind of linker errors (specially in STL calls). How do I get rid of...
0
by: Vijay Chegu | last post by:
Hi I am using vc++ .net 2003 ide with Feb 2003 platform sdk to build 64bit application. I want to use vc++ to debug the app on 64bit machine. As we do not have 64bit VC++, I would like to...
1
by: jfishburn | last post by:
When I create a Static Text box in Visual Basic 6, the name (IDC_STATIC) is not listed in MFC ClassWizard->Member Variables. It only appears if I change the name.
2
by: um | last post by:
When the POSIX pthreads library for w32 release 2-2-0 (http://sources.redhat.com/pthreads-win32/) is compiled with VC++6 then it compiles and passes all the benchmark tests in the subdirectory...
15
by: Michael Tissington | last post by:
I have a Visual Basic 6.0 ActiveX Control. It seems there is no way with VS 2005 to create a similar control for containers that host ActiverX controls, is this correct ? I'm thinking of...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: 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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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.