PDA

View Full Version : C# Mono - Centering A Window With GTK+?



frychiko
October 10th, 2010, 05:38 PM
Just started C# development with Mono and Monodevelop but the lack of documentation is killing me. How can I center a window?

Monodevelop spits out the following code, and I've got a center code in the middle which I've spotted in a few example apps on the web.


...
MainWindow win = new MainWindow();
win.SetPosition(WindowPosition.Center);
win.Show();
...

This works for the Window type but not for the MainWindow type.. I can manipulate MainWindow in every other way except for position.

pcambraia
September 14th, 2011, 01:54 PM
Instead of "Center" use "CenterAlways", as in:

win.SetPosition(WindowPosition.CenterAlways);