(挑战性问题)请教高手:如何在标题栏上放置一个文本编辑框,就像google-Chrome的地址栏一样(100分)

  • 主题发起人 bootdelay
  • 开始时间
B

bootdelay

Unregistered / Unconfirmed
GUEST, unregistred user!
请教高手:如何在标题栏上放置一个文本编辑框,就像google-Chrome的地址栏一样
 
你可以设置窗体不显示标题栏,最上面放一个PANCEL,做出类似的效果
 
楼上的请先分析一下Chrome,去掉题栏、放PANEL是一种最低级的做法,要做就要精益求精...
 
那就自己画了,自己写个UIEDIT,要花点时间的!~
 
TO:Dstorm<br>是有这个打算,自已写一个不带句柄的文本编辑框也不难,但看到Chrome是有句柄的文档编辑框,所以想搞清楚,它是怎么弄的
 
to李翔鹏,<br>我到认为这不是什么低级的做法,只不过是常用也是最简单的方法.<br>把pannel做成很像的效果,也要有相当的技术.<br>自己画的很难做到精益求精
 
"就像google-Chrome的地址栏一样" 我没看到google-Chrome有标题拦哦!~<br>google-Chrome,大部分也是画的!~
 
To:Dstorm<br>Chrome的主窗体确实是画出来的<br><br>Chrome的WebBrowse(客户区)上面的部分就是标题栏,至少对于窗口来说那一大块区域和标题栏的行为是一样的。Chrome通过WM_NCCALCSIZE消息来改变客户区大小,以下代码是计算客户区之外的大小:<br>void VistaFrame::ResetDWMFrame() {<br>&nbsp; if (IsTabStripVisible()) {<br>&nbsp; &nbsp; // Note: we don't use DwmEnableBlurBehindWindow because any region not<br>&nbsp; &nbsp; // included in the glass region is composited source over. This means<br>&nbsp; &nbsp; // that anything drawn directly with GDI appears fully transparent.<br>&nbsp; &nbsp; //<br>&nbsp; &nbsp; // We want this region to extend past our content border images, as they<br>&nbsp; &nbsp; // may be partially-transparent.<br>&nbsp; &nbsp; MARGINS margins = {kDwmBorderSize +<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;g_bitmaps[CT_TOP_LEFT_CORNER]-&gt;width(),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kDwmBorderSize +<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;g_bitmaps[CT_TOP_RIGHT_CORNER]-&gt;width(),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kDwmBorderSize +<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IsToolBarVisible() ?<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;browser_view_-&gt;GetY() + kToolbarOverlapVertOffset :<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tabstrip_-&gt;GetHeight(),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kDwmBorderSize +<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;g_bitmaps[CT_BOTTOM_CENTER]-&gt;height()};<br><br>&nbsp; &nbsp; DwmExtendFrameIntoClientArea(*this, &amp;margins);<br>&nbsp; }<br>}<br><br>而地址栏是放在客户区外,也就相当于放在标题栏上。
 
好像在VC中比较容易实现,在delphi中李翔鹏说的方法可以考虑一下,比较简单。
 
to:xingxin00<br>VC和Delphi在Win32方面好像没有什么区别吧?
 
既然有楼主要精益求精。chrome的代码都放那里了,乖乖研究去吧。
 
不了解chrome如何实现,但据我所知DwmExtendFrameIntoClientArea是vista中加入的。不知xp如何使用
 
不要把通过简单方法就能实现的东西非要用最难的技术去实现,这不是体现你的技术的深度和解决问题的手段,而是体现了你处理问题的呆板。不管是从任何一个角度,能用简单的办法解决的问题,你非要去绕圈子,走很大的弯路,能算是精益求精吗?最简单的方法,解决问题,达到预期的效果,那就是精益求精。
 
TO:cqwty<br>前面已经说了,我只是想搞清楚“控件如何放到非客户区”技术上的如何实现,并没有要在产品或平台中使用...唉,。。你这大道理讲的。。七老八十似的
 
控件是不能放到非客户区的,这都不知道,还好意思说.<br>不过可以用api来实现(不是控件)<br>HWND CreateWindow(<br><br>&nbsp; &nbsp; LPCTSTR lpClassName, // pointer to registered class name<br>&nbsp; &nbsp; LPCTSTR lpWindowName, // pointer to window name<br>&nbsp; &nbsp; DWORD dwStyle, // window style<br>&nbsp; &nbsp; int x, // horizontal position of window<br>&nbsp; &nbsp; int y, // vertical position of window<br>&nbsp; &nbsp; int nWidth, // window width<br>&nbsp; &nbsp; int nHeight, // window height<br>&nbsp; &nbsp; HWND hWndParent, // handle to parent or owner window<br>&nbsp; &nbsp; HMENU hMenu, // handle to menu or child-window identifier<br>&nbsp; &nbsp; HANDLE hInstance, // handle to application instance<br>&nbsp; &nbsp; LPVOID lpParam // pointer to window-creation data<br>&nbsp; &nbsp;); <br>&nbsp;通过 x,y 参数 控制在什么地方显示 y := 0;的话 就出现在标题栏.
 
SuiPack的SuiForm就是自画标题栏的。<br>这样的例子挺多,但做的完善的不多。
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部