2013年9月11日星期三

Find a cut full code, but will not use, who saved about newcomers ?

public static Bitmap CopyPrimaryScreen ()
{
Screen s = Screen.PrimaryScreen;
Rectangle r = s.Bounds;
int w = r.Width;
int h = r.Height;
Bitmap bmp = new Bitmap (w, h);
Graphics g = Graphics.FromImage (bmp);
g.CopyFromScreen
(
new Point (0, 0),
new Point (0, 0),
new Size (w, h)
);
return bmp;
}


============================================== ============
create buttons click to use the above code , save it to the C drive A.BMP. Not engage , who teach about , thank you
------ Solution ----------------------------- ---------------
reference: http://www.cnblogs.com/zhili/p/CaptureTool.html
------ Solution ---------------------------------------- ----

btnClick:
    Bitmap bitmap=CopyPrimaryScreen();
    bitmap.Save("C:\\A.bmp");
    bitmap.Dispose();

------ Solution ------------------------------ --------------

public static Bitmap CopyPrimaryScreen()
{
    Screen s = Screen.PrimaryScreen;
    Rectangle r = s.Bounds;
    int w = r.Width;
    int h = r.Height;
    Bitmap bmp = new Bitmap(w, h,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    Graphics g = Graphics.FromImage(bmp);
    g.CopyFromScreen
    (
       new Point(0, 0),
       new Point(0, 0),
       new Size(w, h)
    );
    return bmp;
}


btnClick:
    Bitmap bitmap=CopyPrimaryScreen();
    bitmap.Save("C:\\A.bmp",System.Drawing.Imaging.ImageFormat.Png);
    bitmap.Dispose();

------ For reference only ----------------------------------- ----
first to write one way out .
------ For reference only ---------------------------------------
3 Floor positive solution .
------ For reference only ---------------------------------------
upstairs positive solutions ~ ~
mark.
------ For reference only -------------------------------- -------
you are right. Here's brother, that modify the input you only support 24 chart . This code is to catch the 32 figure . Do not want to configure the display color every time you want to 24 -digit bar.
------ For reference only -------------------------------------- -
hwenycocodq520 Thank you very much . is entirely possible. Haha , do not set the monitor screen .

checkout . Thank you .

没有评论:

发表评论