void but_Click(object sender, EventArgs e) { if (Host.FPDrawnPolygon != null && Host.FPDrawnPolygon.Points.Count > 2) { Form gridui = new GridUI(this); MissionPlanner.Utilities.ThemeManager.ApplyThemeTo(gridui); gridui.ShowDialog(); } else { CustomMessageBox.Show("Please define a polygon.", "Error"); } }