private void OnPaintClicked(object sender, MouseEventArgs e) { // Deselect other Tool Panel Icons foreach (Control con in AddinManager.Host.ToolPanel.Controls) { conTool c = con as conTool; if (c != null) { c.BackColor = Color.Transparent; c.IsSelected = false; } } if (CurrentLandscape != null) { CurrentLandscape.BrushMode = BrushModes.Paint; } tPaint.IsSelected = true; tPaint.BackColor = Color.Yellow; }
public override void Register(IAddinHost host) { // copy host to local instance Host = host; if (host != null) { Trace.WriteLine(DateTime.Now + " | Landscape Addin Loaded .. "); // Create our control for the brush texture conBrushSettings = new conBrushSettings(Host); conBrushSettings.Enabled = false; // Add our control to the docking manager Host.DockManager.SetDock(conBrushSettings, DockPosition.Default); ToolStripSeparator s = new ToolStripSeparator(); ToolStripButton tsAddLandscape = new ToolStripButton(); tsAddLandscape.Text = "Generate Landscape"; tsAddLandscape.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; tsAddLandscape.Click += OnAddLandscape_Clicked; Host.ToolStrip.Items.Add(tsAddLandscape); // Add a seperator Host.ToolStrip.Items.Add(s); // Create a Label for our Brush Size ToolStripLabel lb1 = new ToolStripLabel("Brush Size : "); lb1.Margin = new Padding(5, 0, 0, 0); Host.ToolStrip.Items.Add(lb1); // Create our Brush Size combo box tsBrushSize = new ToolStripComboBox("tsBrushSize"); tsBrushSize.Text = "4"; tsBrushSize.Items.Add("4"); tsBrushSize.Items.Add("6"); tsBrushSize.Items.Add("8"); tsBrushSize.Items.Add("10"); tsBrushSize.Items.Add("12"); tsBrushSize.Items.Add("14"); tsBrushSize.Items.Add("16"); tsBrushSize.Items.Add("18"); tsBrushSize.Items.Add("20"); tsBrushSize.Items.Add("22"); tsBrushSize.Items.Add("24"); tsBrushSize.Items.Add("26"); tsBrushSize.Items.Add("28"); tsBrushSize.Items.Add("30"); tsBrushSize.Items.Add("32"); tsBrushSize.Items.Add("64"); tsBrushSize.Items.Add("128"); tsBrushSize.Items.Add("256"); tsBrushSize.TextChanged += OnBrushSize_TextChanged; tsBrushSize.Width = 20; Host.ToolStrip.Items.Add(tsBrushSize); // Brush Weight ToolStripLabel lb2 = new ToolStripLabel("Brush Weight : "); lb2.Margin = new Padding(5, 0, 0, 0); Host.ToolStrip.Items.Add(lb2); tbWeight = new ToolStripTextBox("tbBrushWeight"); tbWeight.Text = "2.0"; tbWeight.Width = 30; tbWeight.TextChanged += OnBrushWeight_TextChanged; Host.ToolStrip.Items.Add(tbWeight); // Raise Terrain Tool Panel Button tRaise = new conTool(); tRaise.ButtonImage = Resource1.btnRaise; tRaise.IsSelected = true; tRaise.BackColor = Color.Yellow; tRaise.MouseClick += OnRaiseClicked; Host.ToolPanel.Controls.Add(tRaise); // Lower Terrain Tool Panel Button tLower = new conTool(); tLower.ButtonImage = Resource1.btnLower; tLower.MouseClick += OnLowerClicked; Host.ToolPanel.Controls.Add(tLower); tPaint = new conTool(); tPaint.ButtonImage = Resource1.PaintBrush; tPaint.MouseClick += OnPaintClicked; Host.ToolPanel.Controls.Add(tPaint); LandscapeGenerated += OnLandscapeAdded; } }