如何使用 C# 在 WPF 中开发 Google Chrome 浏览器等应用程序

发布于 2024-10-01 06:49:26 字数 354 浏览 6 评论 0原文

I am trying to develop an windows application like Google chrome Browser in WPF

使用 C#。我在制作自己的自定义窗口并将选项卡放置在该窗口的标题位置时遇到问题。 请建议我如何去做,有什么工具可以做到这一点吗?

请指导我......

更新:

嗨,朋友们,感谢您的积极回应,我也按照您提供的链接和您告诉的方式进行了操作,但我仍然对开发应用程序有疑问,请给我更多信息我可以使用类似 Google Chrome 的控件来开发此应用程序的想法。我想给我的应用程序提供类似 Google Chrome 的外观和感觉......

I am trying to develop an windows application like Google chrome Browser in WPF

using C#.I am facing problem in making my own Custom Window and Placing Tabs at the Place of the Title Position of that window.
Please suggest me how to go for it, is there any tool for this ?

Guide me please..........

Updated:

Hi Friends Thanks for your active responses and I also followed the links you gave and the way you told, but still I have doubts in developing the application please give me some more ideas where I can develop this application by using Google Chrome like controls. I want to give my application Google Chrome like look and feel.....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夏天碎花小短裙 2024-10-08 06:49:26

谷歌浏览器本质上是自定义绘制其窗口的非客户区域,以删除它认为多余的东西,例如标题栏。这就是它如何让选项卡取代窗口的标题栏,就像 Microsoft Office 如何将其“珍珠”和快速访问工具栏放置在文档窗口的标题区域中一样。

要在 WPF 中执行类似的操作,您可能会发现本文很有用:链接

请记住,每当您重新实现标准 Windows chrome 时,您都会处理 Windows 通常对您透明的一系列操作,例如调整窗口大小、最小化、最大化、移动和关闭窗口。

值得考虑的是,Google Chrome 和 Microsoft Office 应用程序(以及其他应用程序)的行为有所不同,具体取决于 Aero Glass 和桌面窗口管理器 (DWM) 是否存在/启用。当这些东西丢失时,您必须确保您的应用程序能够正常降级。我建议您在投入所有时间和精力在应用程序中执行此类操作之前,确保您确实能够提出令人信服的理由来证明必要性和对用户的好处。

Google Chrome essentially custom-draws the non-client area of its window to remove things that it considers superfluous like the title bar. That's how it gets the tabs to replace the title bar of the window, just like how Microsoft Office places its "pearl" and quick access toolbar in the title area of document windows.

To do something similar in WPF, you may find this article useful: Link

Remember that any time you re-implement the standard windows chrome, you're going to have to handle a bunch of stuff that Windows normally makes transparent to you, like resizing, minimizing, maximizing, moving, and closing a window.

It is worth considering that both Google Chrome and Microsoft Office applications (among others) behave differently depending on whether Aero Glass and the Desktop Window Manager (DWM) are present/enabled. You're going to have to make sure that your application degrades gracefully when these things are missing. I would advise being sure that you can really make a convincing case for the necessity and benefit to the users before you invest all the time and energy it takes to do things like this in your application.

温柔一刀 2024-10-08 06:49:26

我刚刚完成了一个类似 Google Chrome 的 WPF 选项卡控件。您可以在 https://github.com/realistschuckle/wpfchrometabs 找到该项目,并在

希望有帮助!

I just finished a Google Chrome-like Tab Control for WPF. You can find the project at https://github.com/realistschuckle/wpfchrometabs and blog posts describing it at

Hope that helps!

冷情妓 2024-10-08 06:49:26

Chrome 似乎将其选项卡绘制在标题栏区域的有限区域内。当打开足够多的选项卡时,现有选项卡控件的宽度会减小,以便为新选项卡腾出空间。

我建议您采用类似的策略,在大小合适的矩形中绘制选项卡,该矩形不与标题按钮(最小化、最大化关闭)相交,并在区域变满时减少现有选项卡标题的宽度

[更新1]

虽然我还没有看到你的代码,但我建议发生这种情况,因为选项卡标题(标题栏区域中显示的部分)和选项卡页(覆盖大部分屏幕的部分)是一部分属于同一控件并作为一个单元绘制,因此当您尝试在该区域中绘制标题时,选项卡内容也会被重新绘制。

如果是这种情况,那么您需要将选项卡标题和内容页绘制为单独的控件,并在选项卡中维护某种状态,以指示选择选项卡时哪个选项卡页应变为可见。

It appears that Chrome draws its tabs within a limited region of the title bar area. When enough tabs are open, the width of existing tab controls is reduced to make room for a new tab.

I would suggest that you adopt a similar strategy by drawing your tabs in a suitably sized Rectangle which does not intersect with the caption buttons (Minimize, Maximize Close) and reducing the width of existing tab headers when the region becomes full

[Update 1]

While I haven't seen your code, I would suggest this happens because the tab header (the part displayed in the title bar area) and the tab page (the part covering most of the screen) are a part of the same control and are drawn as a unit, so when you try and draw the header in the region the tab content is redrawn too.

If this is the case, then you need to draw the tab header and the content page as separate controls and maintain some state in the tab that indicates which tab page should become visible when the tab is selected.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文