可以模仿“附加组件|扩展列表”的Delphi控件火狐浏览器?
我的目标是更新应用程序中 GUI 的外观。目前我的 GUI 包含很多列表框,这些列表框用于以老式方式编辑某些对象,即用户双击某个项目,然后显示一个对话框来修改相应的对象。
我认为一个好的现代方法是 Firefox 显示已安装的扩展(下面的快照)。
我的问题是如何在Delphi(win32)中轻松构建这样的GUI?您是否使用任何组件来模仿此类行为,或者我只需要使用面板从 stratch 进行编码? (我想避免一项非常繁琐的工作 - 选择逻辑、调整大小等...)
My aim is to update the look of the GUI in my app. Currently my GUI contains a lot of listboxes which are used to edit some objects in an old fashioned way, that is, user double-clicks an item and a dialog is shown to modify the corresponding object.
I think a good modern approach is how Firefox displays the extensions installed (a snapshot below).
My question is about how to build such a GUI in Delphi(win32) easily? Are there any components you use mimicing such behaviour or will I just need to code this from stratch using panels? (IMO a very cumbersome job I'd like to avoid - the selection logic, resizings, etc...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用标准组件做类似的事情(不完全一样); TDBCtrlGrid、TSpeedButton、...
替代文本 http://img8.imageshack.us/img8/9585/imagen29ox3.png
You can do something similar (not exactly) with standard components; TDBCtrlGrid, TSpeedButton,...
alt text http://img8.imageshack.us/img8/9585/imagen29ox3.png
如果您使用的是 Delphi 2007 或 Delphi 2009,您也许可以使用 TCategoryButtons 执行类似的操作(来自“附加”组件选项板页面)。将其放在表单上并右键单击以显示弹出菜单,然后单击“类别编辑器...”。使用生成的对话框添加一个类别,设置其标题,并可以选择设置它包含的项目。不完全相同,但它可能会满足您的需要。
您还可以使用带有 TTreeView(如果您有对象类别)或 TListView 的对话框来模拟 Delphi 2007 项目 -> 选项对话框。单击 TreeView 或 ListView 中的项目将显示 TPageControl 的正确页面以配置该对象。
If you're using Delphi 2007 or Delphi 2009, you might be able to do something similar using TCategoryButtons (from the 'Additional' component palette page). Drop it on a form and right click to display the popup menu, and then click "Categories Editor...". Add a category with the resulting dialog, set it's caption, and optionally set up Items it contains. Not exactly the same, but it might do what you need.
You could also use a dialog with a TTreeView (if you have categories of objects) or TListView to emulate the Delphi 2007 Projects->Options dialog. Clicking an item in the TreeView or ListView displays the proper page of a TPageControl to configure the object.
我基本上同意 Lars 的观点,但我会为每个项目使用框架而不是面板。这将分离成自己的文件,并且您将获得简单的设计时支持。
I mostly agree with Lars, but I would use a frame for each item instead of a panel. That would separate into its own file, and you would get easy designtime support for it.
对每个列表项使用 TFrame 并将它们全部对齐顶部放在 TScrollBox 上可能会起作用。另请参阅 TDBCtrlGrid,它与数据集结合执行类似的操作。
Using a TFrame for each list item and put them all Aligned Top on a TScrollBox might work. Also see TDBCtrlGrid which does something like that in combination with datasets.
可以使用现有的 Delphi 控件来完成。
例如,在 TCustomListBox 控件中,您可以创建自己的 OnDrawItem 事件来绘制自己的列表项。您还需要创建自己的 OnMeasureItem 来更改项目高度。
在某些情况下,它是非常有限的,所以如果你想要更多的自由,你将需要从头开始。
It can be done with existing Delphi controls.
For instance in the TCustomListBox control you can create your own OnDrawItem event to draw your own list item. You also need to create your own OnMeasureItem to change the item height.
In some cases it is very limited, so if you want more freedom you will need to do it from scratch.