Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有wx.Frame一个wx.GridSizer。这个网格包含几个自定义wx.Panel的 . 我需要交换网格中两个单元格的内容。Detach我使用、GetItem和方法尝试了几种解决方案,Insert但均未成功。
wx.Frame
wx.GridSizer
wx.Panel
Detach
GetItem
Insert
例如,假设我有一个 3x3 网格,其中包含从 0 到 7 的 8 个元素(我的自定义面板)。在这种情况下,网格的最后一个单元格是空的。我想移动最后一个单元格(grid[8])中的最后一项(grid[7])。
我能怎么做?如果最后一个单元格不为空,有什么区别?
下面的“panelInGrid7”是您的面板实例,它位于网格 [7] 中,在 gridBagSizer 位置中,它将位于 (2, 1)
sizer.Detach(panelInGrid7) sizer.Add(panelInGrid7, (2,3))
如果 (2, 3) 不为空,您还需要分离该项目,然后将其添加到您想要的位置。