Drawing Outside a Window's Client Area

本文探讨了在Windows环境中应用程序绘图超出其窗口客户区的问题。通常情况下,使用BeginPaint或GetDC函数获取设备上下文时,绘图会被限制在客户区内。然而,通过GetWindowDC或CreateDC函数,应用程序可以绘制到非客户区甚至整个显示区域。
INFO: Drawing Outside a Window's Client Area


SUMMARY
When an application uses the BeginPaint or GetDC function to obtain a device context (DC) for its client window and draws into this DC, Windows clips the output to the edge of the client window. While this is usually the desired effect, there are circumstances where an application draws outside the client area of its window.

MORE INFORMATION
The GetWindowDC function provides a DC that allows an application to draw anywhere within its window, including the nonclient area.

In the Windows environment, the display is a scarce resource that is shared by all applications running in the system. Most of the time, an application should restrict its output to the area of the screen it has been assigned by the user. However, an application can use the CreateDC function to obtain a DC for the entire display, as follows:    hDC = CreateDC("DISPLAY", NULL, NULL, NULL);

Device contexts are another scarce resource in the Windows environment. When an application creates a DC in response to a WM_PAINT message, it must call the DeleteDC function to free the DC before it completes processing of the message.

Painting in the nonclient area of a window is not recommended. If an application changes the nonclient area of its window, the user can become confused because the familiar Windows controls change appearance or are not available. An application should not corrupt other windows on the display.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值