[Mono-winforms-list] Toolstrip

Baltasar García Perez-Schofield baltasarq at gmail.com
Wed Jan 29 09:30:11 UTC 2014


	Hi, there!

	I'm building an application with WinForms. The problem comes with the Toolbar. With a legacy or classic toolbar, everything runs fine.

	The problem comes with the toolstrip toolbar, nothing is shown (I'm using the "only images" style). Is this a known issue?

==
var tbZero = new ToolStripButton( "Zero",
		this.zeroIconBmp, (o, e) => this.DoReset(),
		"Zero" );
var tbRandom = new ToolStripButton( "Random",
		this.randIconBmp, (o, e) => this.DoReset		( MemoryManager.ResetType.Random ),
		"Random" );

tbZero.DisplayStyle = tbRandom.DisplayStyle = ToolStripItemDisplayStyle.Image;

this.tbIconBar = new ToolStrip( new ToolStripItem[]
{
	new ToolStripDropDownButton( "Reset", this.resetIconBmp,
		new ToolStripButton[] { tbZero, tbRandom } ),
	new ToolStripButton( "Open", this.openIconBmp, (o, e) => this.DoOpen(), "Open" ),
	new ToolStripButton( "Save", this.saveIconBmp, (o, e) => this.DoSave(), "Save" ),
	new ToolStripButton( "Hex", this.hexIconBmp, (o, e) => this.DoDisplayInHex(), "Hex" ),
	new ToolStripButton( "Dec", this.decIconBmp, (o, e) => this.DoDisplayInDec(), "Dec"  ),
	new ToolStripButton( "Zoom In", this.zoomInIconBmp, (o, e) => this.DoIncreaseFont(), "ZoomIn" ),
	new ToolStripButton( "Zoom out", this.zoomOutIconBmp, (o, e) => this.DoDecreaseFont(), "ZoomOut"  ),
	new ToolStripButton( "Memory", this.memoryIconBmp, (o, e) => this.DoSwitchToMemory(), "Memory" ),
	new ToolStripButton( "Visual", this.diagramIconBmp, (o, e) => this.DoSwitchToDrawing(), "Visual"  ),
	new ToolStripButton( "Help", this.helpIconBmp, (o, e) => this.DoHelp(), "Help" ),
	new ToolStripButton( "About", this.aboutIconBmp, (o, e) => this.DoAbout(), "About" ),
} );

// Remove the appearance of text from all of the buttons
foreach (ToolStripItem bt in this.tbIconBar.Items) {
	bt.DisplayStyle = ToolStripItemDisplayStyle.Image;
}

this.tbIconBar.Dock = DockStyle.Top;
this.tbIconBar.GripStyle = ToolStripGripStyle.Hidden;
this.tbIconBar.AutoSize = false;
this.tbIconBar.Height = 32;
this.tbIconBar.ImageScalingSize = new Size( 32, 32 );
this.Controls.Add( this.tbIconBar );
==

	I'm sure the icons are correctly loaded, since I have the code for the classical toolbar running alongside the ToolStrip. And also it works on Windows, but not in Linux.

	Is this a known issue?
	Is there an easy solution (apart from using the classic toolbar)?
-- 
Baltasar (baltasarq at gmail.com  http://baltasarq.info/)


More information about the Mono-winforms-list mailing list