|
Is there a way to get the mouse position in a window with C#?
Samuel
|
|
|
|
|
If you're not capturing the mouse move event and storing the position, I think you can get it from Cursor.Position, or something like that. Yes, that is right.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
//e.Y --> y position of your mouse
//e.X --> X position of your mouse
Point p = new Point(e.X, e.Y);
}
|
|
|
|
|
I got it working put with
pos = System.Windows.Forms.Cursor.Position.X;
how do I put the code such that its in an event???? sorry I never really touched C# before and i am an embedded C programmer doing C#
regards
Samuel
|
|
|
|
|
If you want it to fire in an event, use the mousemove event, as several people suggested.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
yupp its working, now I just can't figure out how to update my main dialog box with this new value from the mouse move. What can I have is a label, and on the mousemove event I want to update the new values of the movement to the label. how do I do that? I know these might be solved easily if I read the manual just that I have little time but have good knowledge with C.
Thanks!!!
|
|
|
|
|
I want to activate web service using CLR triggers, using the following code but it s generating the following error message.
Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer. Please see inner exception for more information.
public partial class Triggers
{
[Microsoft.SqlServer.Server.SqlTrigger(Name = "StockTradInsertTrigger", Target = "STOCK_TRADES", Event = "FOR INSERT")]
public static void StockTradInsertTrigger()
{
SqlTriggerContext triggContext = SqlContext.TriggerContext;
if (triggContext.TriggerAction == TriggerAction.Insert)
{
using (SqlConnection connection = new SqlConnection("context connection=true"))
{
connection.Open();
SqlCommand sqlComm = new SqlCommand();
sqlComm.Connection = connection;
sqlComm.CommandText = "(SELECT STOCK_ID from INSERTED)";
try
{
string userType = sqlComm.ExecuteScalar().ToString();
SqlContext.Pipe.Send("This is the IP of Stock Evaluator System = "+userType);
oiStockEvaluatorService service = new oiStockEvaluatorService();
service.Enqueue(Convert.ToInt32(userType));
}
catch (Exception ex)
{
SqlContext.Pipe.Send("exception = " + ex.Message);
}
}
}
SqlContext.Pipe.Send("Trigger FIRED");
}
Can any please help me in this regard.
Thanks,
S.S
-- modified at 2:50 Tuesday 19th June, 2007
|
|
|
|
|
Hi
how to find out global mouse click events from my application?
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
You can capture the mouse, or you can investigate writing a global mouse hook.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have created a sample Windows Service, in which I want to provide a notify icon on the system tray.
I have placed a notify icon and a contextmenustrip on the Service's Designer form, and on the OnStart() method of the Service I have assigned a value to the contextmenustrip property of the notifyicon. The following code snippet is written on the OnStart() event of the service,
contextMenuStrip1.Items.Add("Login");<br />
contextMenuStrip1.Items.Add("ViewRecentDocuments");<br />
<br />
notifyIcon1.ContextMenuStrip = contextMenuStrip1;<br />
notifyIcon1.Text = "Notifier";<br />
notifyIcon1.Visible = true;<br />
After that I have installed the Service in the system, and started the service. The notifyicon get displayed, but while right-clicking on it, contextmenu didnt displayed.
Is my code is correct one, if not what change should I do, to make the contextmenu to be displayed on notifyicon's right-click event..
Anyone knows the solution, please reply me.
Thankfully,
jm
|
|
|
|
|
One Post is enough.
Regards,
Satips.
|
|
|
|
|
Hi,
If you know the answer for my question, pls let me know, else where can i find solution?
I didnt intendly put the question twice, I clicked submit button two times so it posted the same question twice.
Thankfully,
jm
|
|
|
|
|
Hi,
I have created a sample Windows Service, in which I want to provide a notify icon on the system tray.
I have placed a notify icon and a contextmenustrip on the Service's Designer form, and on the OnStart() method of the Service I have assigned a value to the contextmenustrip property of the notifyicon. The following code snippet is written on the OnStart() event of the service,
contextMenuStrip1.Items.Add("Login");<br />
contextMenuStrip1.Items.Add("ViewRecentDocuments");<br />
<br />
notifyIcon1.ContextMenuStrip = contextMenuStrip1;<br />
notifyIcon1.Text = "Notifier";<br />
notifyIcon1.Visible = true;<br />
After that I have installed the Service in the system, and started the service. The notifyicon get displayed, but while right-clicking on it, contextmenu didnt displayed.
Is my code is correct one, if not what change should I do, to make the contextmenu to be displayed on notifyicon's right-click event..
Anyone knows the solution, please reply me.
Thankfully,
jm
|
|
|
|
|
Hi everyone,
I'm pretty new to the programming process. I've never done a complete program until now. How do I create an install file for my program, in order to distribute and install my program to multiple computers? Right now I'm just running it from the debug file...
Thanks for your help
Eric
|
|
|
|
|
|
Web : copy all the files to the server and create a virtual directory.
windows : compile in release mode and install the exe in all the comp.
I think you need to complete the program first before you can do all this
|
|
|
|
|
Thank you, I'll give it a try..
|
|
|
|
|
Just for a follow-up. I think it has worked for now. But I won't know until tomorrow. It didn't create an install file, but an application file. Hopefully this will be sufficient.
Thanks again
|
|
|
|
|
|
Great attitude mate, u sound like a complete MVP
1. The guy has not even completed a single app 1000 comp installation will be a bit less.
2. I think Bill Gates runs to his customers with a floppy disk in his hand (for may be Windows XP).
-- modified at 1:57 Tuesday 19th June, 2007
|
|
|
|
|
Did you notice the quote was yours? It was in response your suggestion, it just got mixed up in the DB.
only two letters away from being an asset
|
|
|
|
|
Yeah I did notice that. May be u did not read what i wrote. Try to solve problems more that making smilies
|
|
|
|
|
Hi guys, I need your help in preventing multiple instances of the same window from opening in an MDI parent child window application ? Its urgent ...thanks ...
|
|
|
|
|
What is the question, where are you stuck?
|
|
|
|
|
My question is simple and straight..I want to prevent multiple instances of the same child window from opening i.e. only one instance of a window should open up when i select a certain menu option from the main menu. I hope i made myself clear this time..!!
|
|
|
|