/// <summary> /// Get image by resource key. /// </summary> PixelFarm.Drawing.Image TryLoadResourceImage(string src) { System.Drawing.Bitmap image; if (!_imageCache.TryGetValue(src, out image)) { switch (src.ToLower()) { case "htmlicon": image = HtmlRenderer.Demo.Resource.html32; break; case "staricon": image = HtmlRenderer.Demo.Resource.favorites32; break; case "fonticon": image = HtmlRenderer.Demo.Resource.font32; break; case "commenticon": image = HtmlRenderer.Demo.Resource.comment16; break; case "imageicon": image = HtmlRenderer.Demo.Resource.image32; break; case "methodicon": image = HtmlRenderer.Demo.Resource.method16; break; case "propertyicon": image = HtmlRenderer.Demo.Resource.property16; break; case "eventicon": image = HtmlRenderer.Demo.Resource.Event16; break; } //---------------------------------- if (image != null) { //cache _imageCache[src] = image; } else { //load local image ? string fullImageFileName = this.htmlRootFolder + "\\" + src; if (File.Exists(fullImageFileName)) { image = new Bitmap(fullImageFileName); //cache _imageCache[src] = image; } } //---------------------------------- } return(DemoBase.LoadBitmap(image)); }
void lstDemoList_DoubleClick(object sender, EventArgs e) { var demoInfo = lstDemoList.SelectedItem as DemoInfo; if (demoInfo != null) { DemoBase demoInstance = (DemoBase)Activator.CreateInstance(demoInfo.DemoType); if (demoInstance != null) { DemoForm demoForm = new DemoForm(); demoForm.Show(); demoForm.Activate(); demoForm.LoadDemo(demoInstance); } } }
public void LoadDemo(DemoBase demoBase) { demoBase.StartDemo(this._htmlPanel); }