简体   繁体   English

如何设置工具栏按钮的大小

[英]How to set the size of a toolbar button

I am trying to make a toolbar with some radio buttons. 我正在尝试制作带有一些单选按钮的工具栏。 The Problem is that when I add a button in the toolbar, the button is too big,bigger than the height of the toolbar. 问题是,当我在工具栏中添加按钮时,该按钮太大,大于工具栏的高度。 I have already tried to set the size of the bitmap with not any result. 我已经尝试设置位图的大小,没有任何结果。 However there is not any function to set the size of the tool itself. 但是,没有任何功能可以设置工具本身的大小。 Is there any way to make it? 有什么办法吗?

this->m_ToolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT | wxTB_NOICONS);
this->m_ToolBar->AddRadioTool(this->LastToolBarId, Name, wxNullBitmap, wxNullBitmap, toolTip, wxT(""), Data);
this->m_ToolBar->ToggleTool (this->LastToolBarId, true); 
this->m_ToolBar->Realize();

Ok I found it. 好的,我找到了。 I didn't know that there is a white bitmap(16x15) over the text of the tool. 我不知道该工具的文字上方有白色的位图(16x15)。 So the answer is quite simple. 因此答案很简单。 I use SetToolBitmapSize with size (1,1) 我使用SetToolBitmapSize的大小(1,1)

this->m_ToolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT | wxTB_NOICONS);
this->m_ToolBar->SetToolBitmapSize(wxSize(1,1)); 
this->m_ToolBar->AddRadioTool(this->LastToolBarId, Name, wxNullBitmap, wxNullBitmap, toolTip, wxT(""), Data);
this->m_ToolBar->ToggleTool (this->LastToolBarId, true); 
this->m_ToolBar->Realize();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM