开发者

How to take screenshot from Panel in mono C#?

开发者 https://www.devze.com 2023-02-15 21:37 出处:网络
How to take all screensh开发者_JS百科ot from Panel in mono C# ? I need not used winAPI. My panel can not be fully visible.Your question is not exactly clear but in case you meant taking a screenshot

How to take all screensh开发者_JS百科ot from Panel in mono C# ? I need not used winAPI.

My panel can not be fully visible.


Your question is not exactly clear but in case you meant taking a screenshot of the desktop: below is a small example of how you could do this using gtk:

using Gtk;

...

Gdk.Window window = Gdk.Global.DefaultRootWindow;
if (window!=null)
{           
    Gdk.Pixbuf pixBuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, 
                                   window.Screen.Width, window.Screen.Height);          
    pixBuf.GetFromDrawable(window, Gdk.Colormap.System, 0, 0, 0, 0, 
                           window.Screen.Width, window.Screen.Height);          
    pixBuf.ScaleSimple(400, 300, Gdk.InterpType.Bilinear);
    pixBuf.Save("screenshot0.jpeg", "jpeg");
}

hope this helps, regards

0

精彩评论

暂无评论...
验证码 换一张
取 消