wxWidgets双栏视图

电脑技术 电脑技术 252 人阅读 | 2 人回复 | 2022-04-09

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include "WxListView2Frame.h"
#include <wx/panel.h>
#include <wx/listctrl.h>
#include <wx/sizer.h>

WxListView2Frame::WxListView2Frame(const wxString& title)
    : wxFrame(NULL, wxID_ANY, title)
{
    // Create a top-level panel to hold all the contents of the frame
    wxPanel* panel = new wxPanel(this, wxID_ANY);

    // Create a wxListView control with one column.
    // The default style is wxLC_REPORT so columns need
    // to be added explicitly.
    wxListView* listView = new wxListView(panel, wxID_ANY,
        wxDefaultPosition, wxSize(250, 200));
    listView->AppendColumn("Column 1");
    listView->AppendColumn("Column 2");

    // Add three items to the list
    listView->InsertItem(0, "Item 1");
    listView->SetItem(0, 1, "Amber");
    listView->InsertItem(1, "Item 2");
    listView->SetItem(1, 1, "Blue");
    listView->InsertItem(2, "Item 3");
    listView->SetItem(2, 1, "Cyan");

    // Set up the sizer for the panel
    wxBoxSizer* panelSizer = new wxBoxSizer(wxHORIZONTAL);
    panelSizer->Add(listView, 1, wxEXPAND);
    panel->SetSizer(panelSizer);

    // Set up the sizer for the frame and resize the frame
    // according to its contents
    wxBoxSizer* topSizer = new wxBoxSizer(wxHORIZONTAL);
    topSizer->Add(panel, 1, wxEXPAND);
    SetSizerAndFit(topSizer);
}

回答|共 2 个

Starrry 发表于 2022-4-9 17:58:26| 字数 9 | 显示全部楼层

这个好像是C++.

willsonlincake 发表于 2022-4-9 18:01:05| 字数 34 来自手机 | 显示全部楼层

Starrry 发表于 2022-4-9 17:58
这个好像是C++.

就是
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

热门推荐