惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

博客园 - Jonny Yu

[GCC学习]get the optimized function call graph 界面开发中的那些疯狂的小事 Re:架构设计之性能设计经验 技术资产管理 .Net下进程外COM服务器的实现 Learn from mistake, i.e. 和 e.g. 是不同的 How can I hide a user from the Welcome Screen in Windows XP? About HDC window class, OO about wParam and lParam 就差一点点-微妙的强制类型转换 [GDI+]DrawRectangle和FillRectangle,细节决定成败 Disable the CrossThreadChecking in .Net Framework v2.0 several useful Store Procedures in MSSQL http://cnblogs.com/rickie/archive/2005/07/02/184927.aspx VS2005使用体验 Inventor 的一些快捷键 First day in Hanna. XPath crash course note
控件的鼠标拖动和改变大小实现的思考
Jonny Yu · 2007-05-27 · via 博客园 - Jonny Yu

WinForm应用里经常会使用一些自绘的非标准窗口来改善软件的观感,由于不再使用标准窗口的标题来和边框,那么窗口的Move和Resize的功能就需要自己来实现。在我写这个功能的时候是直接在OnMouseMove中进行Location和Size的改变。这种使用这种方式后发现在Resize和Move的时候CPU占用率有时会到100%,因为MouseMove消息的产生频率非常高,基本上鼠标每移动一个像素位置都会发出一个MouseMove消息,由于我是在MouseMove中进行Resize,那么Resize的频率也会很频繁,这在一些简单的窗口中(控件少,自绘逻辑简单)的窗口中可能问题不大,但是对于一些较复杂的窗口来说,频繁的Repaint和layout的代价是巨大的。

后来尝试在Idle Event中进行Resize这样,经过一些实验发现Idle event的触发频率比MouseMove少40%,而效果却保持不变。更好的是Idle event是根据应用程序是否空闲来决定其发生频率的,这样在系统繁忙的时候,窗口resize的反应慢一点也是可以接受的,这样可以把更多的CPU资源用于需要的计算中。

这只算记个笔记备忘吧,如果有做过自绘窗口的resize功能的欢迎一起交流讨论。:)