Graphics.FromHwndInternal(IntPtr.Zero) [英] Graphics.FromHwndInternal(IntPtr.Zero)

查看:162
本文介绍了Graphics.FromHwndInternal(IntPtr.Zero)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

命令是什么:

graphics = Graphics.FromHwndInternal(IntPtr.Zero);可以吗?

什么是IntPtr.Zero?为什么该命令在对FromHwndInternal的调用中使用该命令?

What does the command:

graphics = Graphics.FromHwndInternal(IntPtr.Zero); do?

What is IntPtr.Zero and why is this command using that in its call to FromHwndInternal?

推荐答案

如果您查看MSDN页面 [
If you look at the MSDN page[^] for the command you will see that it is part of the .Net Framework infrastructure and is not meant for use in user code (as indicated by the Internal part of the method name).

Nevertheless it returns a Graphics instance from a Window accessed by its Handle (the Hwnd part).

I''m not entirely certain which Window has a Handle of Zero but it may be the DeskTop.

Somebody will probably be able to clarify that.


没有窗口的句柄为IntPtr.Zero.实际上,IntPtr.Zero没有句柄.
这是创建NullGraphics的一种方法(一种不好的方法).
只需 google for NullGraphics,您就会了解我在说什么.
No window has a handle of IntPtr.Zero. Actually, nothing has a handle of IntPtr.Zero.
This is a way (a bad way) to create a NullGraphics.
Just google for NullGraphics and you''ll get an idea what I am talking about.


这篇关于Graphics.FromHwndInternal(IntPtr.Zero)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆