2008 November 10th Monday (十一月 十日 月曜日)

 For all mapping modes, Windows translates window (logical) coordinates to viewport (device) coordinates by
the use of two formulas,

  xViewport = (xWindow - xWinOrg) * (xViewExt / xWinExt) + xViewOrg
  yViewport = (yWindow - yWinOrg) * (yViewExt / yWinExt) + yViewOrg

where (xWindow, yWindow) is a logical point to be translated and (xViewport, yViewport) is the translated point
in device coordinates, most likely client-area coordinates.  These formulas use two points that specify an "origin"
of the window and the viewport. The point (xWinOrg, yWinOrg) is the window origin in logical coordinates; the point
(xViewOrg, yViewOrg) is the viewport origin in device coordinates. By default, these two points are set to (0, 0),
but you can change them. The formulas imply that the logical point (xWinOrg, yWinOrg) is always mapped to the device
point (xViewOrg, yViewOrg).

  The formulas also include two points that specify "extents": the point (xWinExt, yWinExt) is the window extent in
logical coordinates; (xViewExt, yViewExt) is the viewport extent in device coordinates. In most mapping modes, the
extents are implied by the mapping mode and cannot be changed. Each extent means nothing by itself, but the ratio of
the viewport extent to the window extent is a scaling factor for converting logical units to device units.

  Windows can also translate from viewport (device) coordinates to window (logical) coordinates:

  xWindow = (xViewport - xViewOrg) * (xWinExt / xViewExt) + xWinOrg
  yWindow = (yViewport - yViewOrg) * (yWinExt / yViewExt) + yWinOrg

Queues and Synchronization

  As the user presses and releases keys on the keyboard, Windows and the keyboard device driver translate the hardware
scan codes into formatted messages. However, these messages are not placed in an application's message queue right away.
Instead, Windows stores these messages in something called the system message queue. The system message queue is a single
message queue maintained by Windows specifically for the preliminary storage of user input from the keyboard and the mouse.
Windows will take the next message from the system message queue and place it in an application's message queue only when
a Windows application has finished processing a previous user input message.

  The reasons for this two-step process-storing messages first in the system message queue and then passing them to the
application message queue-involves synchronization. As we just learned, the window that is supposed to receive keyboard input
is the window with the input focus. A user can be typing faster than an application can handle the keystrokes, and a particular
keystroke might have the effect of switching focus from one window to another. Subsequent keystrokes should then go to another
window. But they won't if the subsequent keystrokes have already been addressed with a destination window and placed in an
application message queue.

  A program can determine if it has the input focus by processing the WM_SETFOCUS and WM_KILLFOCUS messages. As the names
imply, a window procedure receives a WM_SETFOCUS message when it receives the input focus and a WM_KILLFOCUS message when
it loses the input focus. These messages occur in pairs: A window procedure will always receive a WM_SETFOCUS message before
it receives a WM_KILLFOCUS message, and it always receives an equal number of WM_SETFOCUS and WM_KILLFOCUS messages over
the course of the window's lifetime.

  The main rule for using the caret is simple: a window procedure calls CreateCaret during the WM_SETFOCUS message and
DestroyWindow during the WM_KILLFOCUS message.

  There are a few other rules: The caret is created hidden. After calling CreateCaret, the window procedure must call
ShowCaret for the caret to be visible. In addition, the window procedure must hide the caret by calling HideCaret whenever
it draws something on its window during a message other than WM_PAINT. After it finishes drawing on the window, the program
calls ShowCaret to display the caret again. The effect of HideCaret is additive: if you call HideCaret several times without
calling ShowCaret, you must call ShowCaret the same number of times before the caret becomes visible again.

Python网络爬虫与推荐算法新闻推荐平台:网络爬虫:通过Python实现新浪新闻的爬取,可爬取新闻页面上的标题、文本、图片、视频链接(保留排版) 推荐算法:权重衰减+标签推荐+区域推荐+热点推荐.zip项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值