/// <summary> /// Get RendererProvider for specified control type /// </summary> /// <param name="controlType">Control type</param> /// <returns>RendererProvider object</returns> public static BaseRendererProvider GetRendererProvider(Type controlType) { configurationFilePath = Path.Combine(Application.StartupPath, "DWMRendererProvider.config"); // verify if configuration file exits if (!File.Exists(configurationFilePath)) { //throw new FileNotFoundException("Configuration File not found !", configurationFilePath); return(null); } //System.Diagnostics.Debug.Assert(controlType == typeof(System.Windows.Forms.Label)); BaseRendererProvider provider = null; RendererProviderConfig dataset = new RendererProviderConfig(); dataset.ReadXml(configurationFilePath); RendererProviderConfig.ProvidersRow row = dataset.Providers.FindByAssociatedType(controlType.Name); if (row != null) { string assembly = row.Assembly; string type = row.Type; provider = GetRendererProvider(type, assembly); } return(provider); }
public DWMAdapterNativeWindow(Control c) { this.properties = new Dictionary <string, object>(); this.attachedControl = c; this.AssignHandle(c.Handle); rendererProvider = RendererProviderFactory.GetRendererProvider(c.GetType()); if (rendererProvider != null) { rendererProvider.NativeWindow = this; rendererProvider.AttachedControl = c; } }