473,612 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2387
I'm not to familiar with VC++'s wizards, but things like KeyDown and
MouseMove aren't handled via messages(usuall y) in .NET, you would override
the appropriate OnXxx method(OnKeyDow n and OnMouseMove respectivly) on your
form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@cons iliumsoft.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
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******** ******@TK2MSFTN GP10.phx.gbl...
I'm not to familiar with VC++'s wizards, but things like KeyDown and
MouseMove aren't handled via messages(usuall y) in .NET, you would override
the appropriate OnXxx method(OnKeyDow n and OnMouseMove respectivly) on your form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@cons iliumsoft.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
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******** ******@TK2MSFTN GP10.phx.gbl...
I'm not to familiar with VC++'s wizards, but things like KeyDown and
MouseMove aren't handled via messages(usuall y) in .NET, you would override
the appropriate OnXxx method(OnKeyDow n and OnMouseMove respectivly) on your form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@cons iliumsoft.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
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*******@cons iliumsoft-nospam.com> wrote in message
news:uJ******** ******@TK2MSFTN GP10.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(Mou seMoveEventArgs e)
{
//do handling for OnMouseMove here
//this should be synonomous with WM_MOUSEMOVE
base.OnMouseMov e(e);
}
public void override OnKeyPress(KeyP ressEventArgs 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.A dd(textBox);
textBox.MouseMo ve+=new MouseEventHandl er(textBox_Mous eMove);
textBox.KeyPres s+=new KeyPressEventHa ndler(textBox_K eyPress);
}

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

private void textBox_KeyPres s(object sender, KeyPressEventAr gs e)
{
//Do what you want with KeyPress
}
}

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

your
form\control instead. Is that what you mean?
"Ralph Krausse" <go*******@cons iliumsoft.com> wrote in message
news:49******** *************** ***@posting.goo gle.com...
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*******@cons iliumsoft-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
2011
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 file as text) :( Anny suggestion ? Best regards
0
1373
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 problems. So I tried to revert back and uninstalled VC - 7 and compiled my workspace in VC - 6. It gave a linker error that "mfc71d.lib" is not found.
11
1903
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
2950
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 these errors?? Anthony
0
1518
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 know how to configure VC++ IDE to do remote debugging. I can install 64bit windbg and do debugging on the local machin, as
1
1447
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
2281
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 "tests". Also, VC++ 2005 beta 1 compiles the tests fine, but here the following tests fail in execution: # semaphore1.pass \ # condvar2.pass \ # condvar2_1.pass \ # mutex8.pass \
15
2009
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 converting the VB 6 project to VC in VS 2005. This seems to be a very different process. Where is a good place to start?
7
8439
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 this installer will install them. But what about the situation where VC runtime has already been installed? In fact it's been installed twice. Although the project was built on a Windows XP system with Visual Studio 2005 SP1 and the results were...
0
8171
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
8114
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
8615
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
8568
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...
0
8422
tracyyun
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...
0
5536
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
4110
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1699
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1414
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.