wxGrid 在右侧显示大的空白边框
默认情况下,wxGrid 在最后一列之后的右侧显示一个小的(10 像素?)空白边框。调用 SetMargins() 对其没有任何影响。
这很烦人,但我可以忍受。
但是,如果我将行标签宽度设置为零,则空白边框会变得更大。如果我只有一列,效果会很糟糕。看起来 wxGrid 正在为不存在的标签留出空间。
myPatGrid = new wxGrid(panel,IDC_PatGrid,wxPoint(10,10),wxSize(150,300) );
myPatGrid->SetRowLabelSize(0);
myPatGrid->CreateGrid(200,1);
myPatGrid->SetColLabelValue(0,L"Patient IDs");
有没有办法去掉这个边框?
请注意,如果我在 wxGrid 构造函数中将 wxgrid 窗口的大小设置为更窄,希望隐藏边框,我现在得到一个水平滚动条,这也很糟糕。
myPatGrid = new wxGrid(panel,IDC_PatGrid,wxPoint(10,10),wxSize(100,300) );
myPatGrid->SetRowLabelSize(0);
myPatGrid->CreateGrid(200,1);
myPatGrid->SetColLabelValue(0,L"Patient IDs");
给我
我刚刚升级到 wxWidgets v2.8.12 - 问题仍然存在。
By default, wxGrid shows a small ( 10 pixels? ) blank border on the right hand side, after the last column. Calling SetMargins() has no effect on it.
It is irritating, but I can live with it.
However, if I set the the row label width to zero then the blank border grows much larger. If I have just one column, the effect is horrible. It looks like wxGrid is leaving room for the non-existent label.
myPatGrid = new wxGrid(panel,IDC_PatGrid,wxPoint(10,10),wxSize(150,300) );
myPatGrid->SetRowLabelSize(0);
myPatGrid->CreateGrid(200,1);
myPatGrid->SetColLabelValue(0,L"Patient IDs");
Is there a way to remove this border?
Note that if I set the size of the wxgrid window to narrower in the wxGrid constructor, hoping to hide the border, I now get a horizontal scroll bar which is horrible too.
myPatGrid = new wxGrid(panel,IDC_PatGrid,wxPoint(10,10),wxSize(100,300) );
myPatGrid->SetRowLabelSize(0);
myPatGrid->CreateGrid(200,1);
myPatGrid->SetColLabelValue(0,L"Patient IDs");
Gives me
I just upgraded to wxWidgets v2.8.12 - problem still exists.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有找到“自动调整大小”功能来适应网格空间中的列。
作为解决方法,如果只有一列将其宽度设置为
其他列,则将其他列的宽度相加并调整最后一列以适应剩余空间(减去滚动条宽度,减去 10)。
编辑:我有一个工作示例,它会生成以下内容:
EDIT2< /strong>:我成功删除了剩余边距:
I didn't find an "autosize" function to fit columns in the grid space.
As a workaround, if you have only one column set its width to
otherwise, sum other column's width and adapt the last one to fit the remaining space (minus scrollbar width, minus 10).
EDIT: I have a working example, which produces this:
EDIT2: I succeded to remove the remaining margin with this:
昨天解决了类似的问题,我想为以下对我有用的工作做出贡献。也许这会对其他人有所帮助:
注意:与 OnSize() 事件链接时效果特别好。
Solving something similar yesterday I would like to contribute with following what does the job for me. Perhaps this is going to help someone else:
Note: This is doing particularly well when linked with OnSize() event.