Buena
Buena

Reputation: 2491

ToolStripButton.Left property is missing

I need to set a panel.Left property equal to a ToolStripButton.Left value:

pan1.Left = btn1.Left;  

but there is no such property for ToolStripButton. Is there a solution, please.

If there is no - how to place the panel on the center of a Form.

Upvotes: 1

Views: 251

Answers (2)

Buena
Buena

Reputation: 2491

this works:

pan1.Location = new Point(btn1.Bounds.X,pan1.Location.Y);  

Upvotes: 1

Agnius Vasiliauskas
Agnius Vasiliauskas

Reputation: 11277

You don't need any kind of control to infer center, but form itself:

panel1.Left = this.ClientSize.Width / 2 - panel1.Width / 2;

Upvotes: 1

Related Questions