CodePudding user response:
http://www.cnblogs.com/guwei4037/p/3504706.htmlCodePudding user response:
@ minimalist I think output within the local area network (LAN) all lander user name, IP, operation content, operation time and operation status, how to change the code? Per click a function button should be the content will record a log so you need to add the appropriate output in the button code, how to add? And just now I tried it on your code, don't know how to save to the database in the winform! Please forgive me for the beginner rookieCodePudding user response:
Can I reply?CodePudding user response:
1. The user to enter any form to give him a binding the mouse click event (keyboard events) and an optional///& lt; Summary>
///bind mouse click events
///& lt;/summary>
///& lt; Param name="items" & gt;
Public static void updateMouseClickEvent Form (col)
{
List
List=GetAllControls (col);
If (list. Count==0) return;
Foreach (Control con in the list)
(con) (Control). MouseClick +=new MouseEventHandler (MainWindow_MouseClick);
}
///& lt; Summary>
///access controls all of the subspace
///& lt;/summary>
///& lt; Param name="control" & gt;
///& lt; Returns>
Public static List
{
Var list=new List
Foreach (Control con in Control. Controls)
{
List. The Add (con);
If (con. Controls. Count & gt; 0)
{
List. AddRange (GetAllControls (con));
}
}
Return the list;
}
///& lt; Summary>
///the form click event
///& lt;/summary>
///& lt; Param name="sender" & gt;
///& lt; Param name="e" & gt;
Private static void MainWindow_MouseClick (object sender, MouseEventArgs e)
{
The Control FM=(Control) sender;
If (FM is DataGridView) * * *;
If (FM is MenuStrip) * * *;
GoodsInfoAPI. Constant. LastTime=DateTime. Now;
Try
{
The Control FM=(Control) sender;
If (FM is DataGridView) return;
If (FM is MenuStrip) return;
App. LogWrite (FM) Name) the ToString () + ": the Text - & gt; : "+ FM. Text +" -- -- -- & gt; Click ");
}
The catch (Exception ee)
{
App. LogWrite (sender. ToString () + "-- -- -- & gt; Click ");
App. LogWrite (" Comvert To form the Error: "+ ee. Message);
}
}
Is there a little inspiration?
In form the Load add
UpdateMouseClickEvent (this);