protected override void OnTermination() { if ((strip != null) && (btn != null)) { if (btn.removeRef() <= 0) { strip.Items.Remove(btn); btn.Dispose(); } strip = null; btn = null; } base.OnTermination(); }
protected override void OnStartUp() { base.OnStartUp(); numPlots = threeBands?18:12; cansee = true; alphas = new double[numPlots]; double per = 5; for (int i = 0; i < numPlots; ++i) { int idx = i / 6; per = bands[idx] + (i % 6) * (bande[idx] - bands[idx]) / 5; alphas[i] = 2.0 / (per + 1.0); //Print(per); if(i%6==5) { Print(" - "); } Plots[i].Pen.Width = (i % 6 == 5)?2:1; Plots[i].Pen.Color = rcolors[idx]; } //Print("-------------------"); System.Windows.Forms.Control[] coll = ChartControl.Controls.Find("tsrTool", false); if (coll.Length > 0) { strip = (System.Windows.Forms.ToolStrip)coll[0]; System.Windows.Forms.ToolStripItem[] slider = strip.Items.Find(TBName, false); if (slider.Length > 0) { btn = (RWT.ZButtonHost)slider[0]; btn.addRef(); btn.Click += new EventHandler(btn1_click); cansee = btn.Text.StartsWith("-"); } else { btn = new RWT.ZButtonHost(TBName, (startsOn?"-G-":"+G+")); cansee = startsOn; btn.addRef(); btn.Click += new EventHandler(btn1_click); strip.Items.Add(btn); } } updatePlots(); }