使用 Win32 API 创建表 [英] Creating a table using Win32 API

查看:66
本文介绍了使用 Win32 API 创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在网上搜索有关 win32 API 的不同信息,但似乎有关它的所有信息都相当稀疏.

I've been searching the net for different things about the win32 API, but it seems all information on it is rather sparse.

我希望创建一个显示项目列表的简单窗口,但是我想以表格样式的格式为每个项目显示不同的数据列,用户可以在其中调整不同列的大小宽度.

I am looking to create a simple window that shows a list of items, however I want to display different columns of data for each item, in a table-style format, where the user could perhaps be allowed to resize the different column widths.

如果可能的话,我还希望能够在代码中更改不同行的背景颜色,在一般的白色、红色、黄色或绿色之间.

If at all possible, I'd like to also be able to change the background colors of different rows, in the code, between just a general white, red, yellow, or green.

并且用户还可以右键单击不同的行,并能够在它们上调用函数,或将数据复制到剪贴板(但那部分是另一回事).

And the user would also be allowed to right click different rows, and be able to call a function on them, or copy the data to the clipboard (but that part is a different story).

现在,我找到了可以放置在窗口、按钮和右键菜单中的列表查看器对象(?)...但我不知道如何使用 Win32 API 制作表格.除了窗口本身,我什至还没有真正阅读过背景颜色.

Now, I've found list-viewer objects(?) that can be placed in the window, buttons, and right-click menus... but I cannot figure out how to do a table, using the Win32 API. I haven't even really read up on background colors for anything other than the window itself, either.

我应该为此使用一个不同的、更好的框架,还是我缺少一些功能或项目?对于这个想法的所有帮助或指导将不胜感激......

Is there a different, better framework I should use for this, or are there some functions or items that I've been missing? All help or guidance on the idea would be appreciated...

我正在使用 MSVC++ 来做……我正在处理的所有事情.

I'm using MSVC++ to do... everything that I'm working on.

推荐答案

Windows 提供了一个相当基本的内置控件集合,列出了 这里.

Windows provides a fairly basic collection of built-in controls, listed here.

如果您想要更复杂的东西,您的选择是:

If you want something more sophisticated your options are:

  • 自己编写代码.您必须自己绘制,处理所有用户交互、滚动等.这是一项艰巨的工作.
  • 查找现有实现.
  • 放弃 VC++ 并使用 WinForms 或 WPF.

如果您不喜欢 VC++,网格控件终极网格是基于 MFC 的.

If you're stuck with VC++, The Grid Control and The Ultimate Grid are MFC-based.

如果您不使用 MFC,则有 BABYGRIDWin32 SDK 数据网格.

If you're not using MFC there's BABYGRID or The Win32 SDK Data Grid.

如果它们都不适合,那么搜索网格"要比搜索表格"更幸运.

If none of them suit, you'll have more luck searching for "grid" than "table".

这篇关于使用 Win32 API 创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆