【发布时间】:2019-10-22 06:30:41
【问题描述】:
我正在努力改进我正在开发的 Train Conductor 游戏的用户界面。
我正在做的一件事是在弹出菜单中显示车辆列表。我想使用多列而不是单个长列。
单击鼠标右键会弹出菜单的车辆列表。
我不知道如何解决这个问题,我确定答案很简单,但我只是没有看到它。
现在的样子
我希望它看起来如何
以下是将列表附加到菜单的部分的代码sn-p:
Guide::GetTrainList(&TrainList); //this receives the list of the trains
if(TrainList.size() > 0) //this will tell the code to continue if the trains exist (decided by the player which trains to play with)
{
for(int j = 0; j < TrainList.size(); j++)
{
CString FollowTrain = TrainList[j]->GetMenuName();
FollowTrain.Append((m_FollowTrain != NULL && m_FollowTrain == TrainList[j])?L" (Followed)":L"");
GoToTrainMenu.AppendMenu(MF_STRING, Counter++, TrainList[j]->GetMenuName());
FollowTrainMenu.AppendMenu(MF_STRING, Counter++, FollowTrain);
MoveTrainMenu.AppendMenu(MF_STRING, Counter++, TrainList[j]->GetMenuName());
}
PopupMenu.AppendMenu(MF_POPUP, (unsigned int)GoToTrainMenu.Detach(), GetStringFromResource(GOTOTRAIN));
PopupMenu.AppendMenu(MF_POPUP, (unsigned int)FollowTrainMenu.Detach(), GetStringFromResource(FOLLOWTRAIN));
PopupMenu.AppendMenu(MF_POPUP, (unsigned int)MoveTrainMenu.Detach(), GetStringFromResource(MOVETRAIN));
}
【问题讨论】: