msdn:什么时候画窗口

http://msdn.microsoft.com/en-us/library/dd145199(VS.85).aspx

下面是翻译:
        
An application draws in a window at a variety of times: when first creating a window, when changing the size of the window, when moving the window from behind another window, when minimizing or maximizing the window, when displaying data from an opened file, and when scrolling, changing, or selecting a portion of the displayed data.
   一个应用程序在很多时间点,在窗口中进行绘制:当第一次创建窗口,当改变窗口的大小,当从别的窗口后面移动窗口,当最小化或者最大化窗口,当显示一个打开的文件中的数据,当滚动,改变,或者选择显示数据的一部分。

The system manages actions such as moving and sizing a window. If an action affects the content of the window, the system marks the affected portion of the window as ready for updating and, at the next opportunity, sends a WM_PAINT message to the window procedure of the window. The message is a signal to the application to determine what must be updated and to carry out the necessary drawing.

      系统管理像移动和改变大小的行为。如果一个行为影响了窗口的内容,系统记录受影响的部分来为更新做准备,在下一个机会中,发送一个WM_PAINT消息给窗口过程.这个消息是一个发给应用程序的信号,这个信号决定了什么需要更新,并且执行必要的绘制。

Some actions are managed by the application, such as displaying open files and selecting displayed data. For these actions, an application can mark for updating the portion of the window affected by the action, causing a WM_PAINT message to be sent at the next opportunity. If an action requires immediate feedback, the application can draw while the action takes place, without waiting for WM_PAINT. For example, a typical application highlights the area the user selects rather than waiting for the next WM_PAINT message to update the area.

        有些行为被应用程序管理。例如显示打开的文件和选择显示的数据。对于这些行为,窗口的部分区域会被他们影响,然后,一个应用程序能够为这些区域做标记,致使在下一个机会中发送WM_PAINT消息。如果一个行为需要立即反馈,应用程序可以在行为发生的时候立即绘制,而不是等待WM_PAINT消息。一个典型的应用程序可以高亮用户的选择而不是等待WM_PAINT消息来更新区域。

        In all cases, an application can draw in a window as soon as it is created. To draw in the window, the application must first retrieve a handle to a display device context for the window. Ideally, an application carries out most of its drawing operations during the processing of WM_PAINT messages. In this case, the application retrieves a display device context by calling the BeginPaint function. If an application draws at any other time, such as from within WinMain or during the processing of keyboard or mouse messages, it calls the GetDC or GetDCEx function to retrieve the display DC.

       无论如何,一旦窗口被创建,就可以在窗口中绘制。为了在窗口中绘制,应用程序必须首先获取一个窗口的显示设备上下文。在理想情况下,一个应用程序在处理wm_paint消息的时候执行它的大部分绘制。在这种情况下,应用程序通过BeginPaint函数获取一个设备上下文。如果一个应用程序在别的时间进行绘制,例如WINMAIN中,或者在鼠标,键盘消息中绘制,它调用GetDC或者GetDCEx函数去获取显示设备上下文。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值