wxWidgets双栏视图

[复制链接]
作者: willsonlincake 发表于 2022-4-9 17:23:19
617 2 开启右栏
累计签到:57 天
连续签到:1 天

981

主题

461

回帖

8037

积分

版主

Rank: 7Rank: 7Rank: 7

积分
8037

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

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

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);
}
累计签到:46 天
连续签到:10 天

67

主题

1071

回帖

6111

积分

版主

Rank: 7Rank: 7Rank: 7

积分
6111
发表于 2022-4-9 17:58:26| 字数 9 |显示全部楼层
这个好像是C++.
累计签到:57 天
连续签到:1 天

981

主题

461

回帖

8037

积分

版主

Rank: 7Rank: 7Rank: 7

积分
8037
 楼主| 发表于 2022-4-9 18:01:05| 字数 34 来自手机 |显示全部楼层
Starrry 发表于 2022-4-9 17:58
这个好像是C++.

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

本版积分规则

Archiver|手机版|小黑屋|免责及版权声明|关于|美丽心灵公益论坛