http://blog.csdn.net/crystal_lz/article/details/9200859
It was written earlier, but now it's rewritten to add some functionality.
Source code: http://download.csdn.net/detail/crystal_lz/9556929
The first run will pop up this window to set the shortcut keys
Run with administrator privileges because you need to modify the registry boot boot
When starting [W,a,s,d] macro Mobile Mouse
Whether to get the visible form only when you press V-auto-Box selection
Whether to get transparent forms by pressing T
Press H - to see if the spy is WebBrowser
Press CTRL while the Auto box is selected and click the left button to eject spytool
Press alt while auto-marquee to set the target form to GIF form
These shortcuts can all be tried by themselves
Above is the effect of the spy on WebBrowser is a cool dog player
It's easier to have multiple monitors than to add multiple displays before
<summary>///get a rectangular area of the entire screen///</summary>///<returns> rectangular area </returns>public static Rectangle Getdesktoprect () { Rectangle rect = new Rectangle (); Rect. X = Win32.getsystemmetrics (win32.sm_xvirtualscreen); Rect. Y = Win32.getsystemmetrics (win32.sm_yvirtualscreen); Rect. Width = Win32.getsystemmetrics (win32.sm_cxvirtualscreen); Rect. Height = Win32.getsystemmetrics (win32.sm_cyvirtualscreen); return rect;
However, it is important to note that the form is in full-screen operation and the mouse's coordinates on the form are the screen coordinates of the mouse, but not necessarily on multiple monitors.
Let's say I'm now on the left side of two monitors, and the resolution is 1920 * 1080. If the monitor on my right is the primary monitor, then the coordinates of the left display are ( -1920,0), so when you write the code, you need to be aware of the coordinates of the form to the screen.
This program adds plugin functionality.
Plug-ins can be written by themselves, but I don't think I usually do it.
namespace iplugins{public interface IFilter {//<summary>/// Get the name of the plugin displayed ///</ Summary> //<returns> plugin name </returns> string Getpluginname (); <summary>/// Get plugin The icon that is displayed on the menu returns null if it is not required//</summary>/// otherwise null </returns> Image Getpluginicon (); <summary>/// for loading plug-ins when initializing calls///</summary>// <param name= "Strstarpath" > Main program startup path </param> void Initplugin (string strstarpath); Resultinfo Execfilter (Image imgsrc);} }
Interface very simple create a DLL project and then introduce my IPlugins.dll file inheritance implementation of the IFilter interface can be
A DLL can write multiple plug-ins, but then loaded into the right-click menu will be a DLL name as a group otherwise there is only one plug-in, there is no sub-menu
For example, the plug-in project I demonstrated above is like this
Gray wrote two plug-ins then the right-click menu will use the name of Gray (Gray.dll) as a grouping and if there is only one plug-in DLL, then you do not have to group
Plug-in return type (the tragic solution forgot to write a comment on this class)
Namespace iplugins{public class Resultinfo:idisposable {private Image _resultimage; <summary>////Get images processed by the plugin///</summary> Public image Resultimage {get {R Eturn _resultimage; }} private bool _ismodified; <summary>///Tell the program if the picture is edited if False ignores the plug-in operation if true remove resultimage as result///</summary> PU blic bool IsModified {get {return _ismodified;} } private bool _isclose; <summary>//If True the form is closed such as writing a picture editor plugin///plug-in to get a picture and want to exclusive editing can show a form in the plugin and then return a resultinfo and set Isclose to true the form will be closed for the rest of the operation can be written in their own editor///</summary> public bool Isclose {get {return _isclose;} } public Resultinfo (Image Imgresult, bool bmodified, bool bclose) {this._resultimage = Imgresult; this._ismodified = bmodified; This._isclose = bclose; public void Dispose () {if (this._resultimage! = null) this._resultimage.dispose (); } }}
Call plug-in private void Item_click (object sender, EventArgs e) { try { var result = (sender as ToolStripMenuItem). Tag as Iplugins.ifilter). Execfilter (M_imglastlayer.clone () as Bitmap); if (result. Isclose) this. Close ();//If the plugin needs to close the form (the plugin can show itself as a form instead of ShowDialog) if (!result. ismodified) return;//Ignore operation M_imgcurrentlayer = result if the picture is not edited . Resultimage; Imagecroppingbox1.invalidate (imagecroppingbox1.selectedrectangle); This. Sethistorylayer (); Imagecroppingbox1.islockselected = true; } catch (Exception ex) { MessageBox.Show (ex. Message);} }
You can organize your own logic.
This is the above binary plug-in pop-up form anyway plug-ins to how to write whatever you can not pop up such as the above black and white processing and anti-color processing will not need to pop-up form to do some parameter settings
This is the code for the plugin above:
namespace gray{public class Pluginbinary:ifilter {public string getpluginname () { return ' binary '; } Public System.Drawing.Image Getpluginicon () { return Properties.Resources.icon_binary; } public void Initplugin (string strstarpath) { } public resultinfo execfilter (System.Drawing.Image imgsrc) { Form1 frm = new Form1 (IMGSRC); if (frm. ShowDialog () = = System.Windows.Forms.DialogResult.OK) { return new Resultinfo (frm. Resultimage, True, false); } return new Resultinfo (null, FALSE, FALSE);}}}
Does it feel simple?
IPlugins.Dll There are some controls that you can write yourself, but there are only a few controls in it that I need to use.
There is also a regular use of the code so the direct also built-in
Select Fill and mosaic mode anyway, just try it yourself.
If you do not check the mosaic, then it is normal to fill in the selected color
But here's a note. If you choose to draw and mosaic patterns you may feel that the drawing has no effect and this is not a bug but a setup.
As long as the mosaic mode is selected, whether the brush or brush is presented in mosaic form.
If the brush size is enlarged, you can see what the effect is.
GIF recording is also often used so it also has built-in functionality
GIF recording has two modes, one of which is the form recording, the other is the selection area recording
Select area Recording is what you see above select an area right-click menu, set to GIF recording area this is good understanding.
The form recording is only started when the auto box is not determined when the area is not identified when you hold down the ALT key and then click the left mouse button will be automatically box out of the form as the recording target and the region recording the only difference is
Zone recording only records the specified area and the form recording tracks the form's location such as the form is moved from the left side of the screen to the right and the form is still recorded and the region recording is not done
GIF recording when the tray icon in the lower right corner will turn green pause recording is red otherwise the normal icon is displayed
Start recording gif Remember you're recording or you forget about the tragedy just wait for the memory to be stained and jump.
Above is the recording effect can choose high quality and low quality can click Copy can directly paste the picture into the QQ chat form to do this I also analyzed the QQ clipboard data
{string[10]} [0]: "Qq_unicode_richedit_format"//memorystream is an XML [1]: "Qq_richedit_format" //memorystream ditto ( And above can be pasted into the chat window) [2]: "DeviceIndependentBitmap" //directly using the image type (for normal pasting) [3]: "FileDrop" //string[] File path (copy file) [4]: "Filenamew" //string[] Ibid. [5]: "FileName" //Ibid. [6]: "HTML Format" [7]: " System.String " [8]:" UnicodeText " [9]:" Text "
This is my code.
private void Btn_copy_click (object sender, EventArgs e) {if (! System.IO.Directory.Exists ("./temp")) System.IO.Directory.CreateDirectory ("./temp"); String strtempfile = "./temp/devcap_"/*developer capture*/+ DateTime.Now.ToString ("Yyyymmdd_hhmmss") + ". gif"; Strtempfile = System.IO.Path.GetFullPath (strtempfile); PictureBox1.Image.Save (Strtempfile); var i = new DataObject (); byte[] Bydata = Encoding.UTF8.GetBytes ("<qqricheditformat><info version=\" 1001\ "></Info>< Editelement type=\ "1\" filepath=\ "" + strtempfile + "\" shortcut=\ "\" ></editelement><editelement type=\ "0\ "><! [cdata[]]></editelement></qqricheditformat> "); I.setdata ("Qq_unicode_richedit_format", New System.IO.MemoryStream (Bydata)); I.setdata ("Qq_richedit_format", New System.IO.MemoryStream (Bydata)); I.setdata ("FileDrop", new string[] {strtempfile}); I.setdata ("Filenamew", new string[] {strtempfile}); I.setdata ("FileName", new string[] { Strtempfile}); I.setdata ("DeviceIndependentBitmap", picturebox1.image); Clipboard.setdataobject (I, true);}
The rest is to look at the code, the key notes are very detailed.
Finally, although the source code is open, I really don't want to see the kind of thing that just changes one title and then re-release it.
Just to say that if you just use or modify the code on this basis, please keep the code some of the original information such as my id:crystal_lz (I would like to write a comment header at the beginning of each class to write the estimate is useless)
The purpose of the open code is to hope that we can communicate and learn by the way, and instead of giving you something, I could choose to open or not open the code, but since I'm open, I hope you don't "take it" and say you wrote it yourself. Even if you do, keep my id and let me keep it.
If there is a bug please remember feedback
A tool that you write yourself