Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. text; using system. windows. forms; using system. runtime. interopservices; using system. drawing. imaging; namespace keyboard {public partial class form1: FORM {public form1 () {initializecomponent ();} private void button#click (Object sender, eventargs e) {// Print full screen print. printscreen (); If (clipboard. containsimage () {// function to extract or replace the clipboard image of the Windows clipboard. getimage () ;}} private void button2_click (Object sender, eventargs e) {// print the current window print. altprintscreen (); If (clipboard. containsimage () {// function to extract or replace the clipboard image of the Windows clipboard. getimage () ;}} class print {// bvk, virtual keyboard code // bscan, hardware scan code for this key // dwflags, define a flag set for each aspect of function operations // dwextrainfo, and define the 32-bit value related to the strike key [dllimport ("user32.dll")] static extern void keybd_event (byte bvk, byte bscan, uint dwflags, uintptr dwextrainfo); // This function combines a key-hitting event const int keyeventf_keyup = 0x2; // if this value is specified, the key will be released. If this value is not specified, the key will be pressed public static void keydown (Keys K) {// press keybd_event (byte) K, 0, 0, uintptr. zero);} public static void keyup (Keys K) {// release keybd_event (byte) K, 0, keyeventf_keyup, uintptr. zero);} public static void printscreen () {// simulate printscreen keydown (keys. printscreen); application. doevents (); keyup (keys. printscreen); application. doevents ();} public static void altprintscreen () {// simulate Alt + printscreen keydown (keys. menu); keydown (keys. printscreen); application. doevents (); keyup (keys. printscreen); keyup (keys. menu); application. doevents ();}}}