public ImageList AddImageList() { IDesignerHost designerHost = (IDesignerHost)this.GetService(typeof(IDesignerHost)); ImageList imageList = (ImageList)designerHost.CreateComponent(typeof(ImageList)); PlotToolBarStandard plotToolBarStandard = this.Control as PlotToolBarStandard; plotToolBarStandard.ImageList = imageList; return(imageList); }
private void OnAddToolBarStandard(object sender, EventArgs e) { IDesignerHost designerHost = (IDesignerHost)this.GetService(typeof(IDesignerHost)); PlotToolBarStandard plotToolBarStandard = (PlotToolBarStandard)designerHost.CreateComponent(typeof(PlotToolBarStandard)); ImageList imageList = (ImageList)designerHost.CreateComponent(typeof(ImageList)); plotToolBarStandard.Plot = (this.Control as Plot); plotToolBarStandard.ImageList = imageList; PlotToolBarStandardDesigner.LoadImages(imageList, new Size(16, 16)); this.Control.Parent.Controls.Add(plotToolBarStandard); ((ISetDesignerDefaults)plotToolBarStandard).DoDefaults(designerHost); }