A community member has associated this post with a similar question:
Private Member Code generation and Resize issue with DesignSurface Design Mode C# .NET7

Only moderators can edit this content.

Missing System.Windows.Forms.Design.TableLayoutPanelDesigner in System.Design dll .NET 7

ravi poddar 11 Reputation points
2023-03-11T11:50:28.7633333+00:00

Hi ,

I face Designsurface related issue regarding table layout panel. I found the reason for that is Missing System.Windows.Forms.Design.TableLayoutPanelDesigner in System.Deisgn DLL

Please provide the solution..

Table Layout panel Issue also mentioned in : https://learn.microsoft.com/en-us/answers/questions/1187787/private-member-code-generation-and-resize-issue-wi


 public class MyDesignSurface : DesignSurface
    {
        public MyDesignSurface(Type rootComponentType) 
        {
            this.ServiceContainer.RemoveService(typeof(ITypeDescriptorFilterService)); 
            this.ServiceContainer.AddService(typeof(ITypeDescriptorFilterService), new TypeDescriptorFilterService());
            this.BeginLoad(rootComponentType);


        }
        
        protected override IDesigner CreateDesigner(IComponent component, bool rootDesigner)
        {
            var item = base.CreateDesigner(component, rootDesigner);

            if (item == null)
            {
                Type type = null;
                var attributs = TypeDescriptor.GetAttributes(component);
                for (int i = 0; i < attributs.Count; i++)
                {
                    if (attributs[i] is DesignerAttribute designerAttribute)
                    {
                        Type? type2 = Type.GetType(designerAttribute.DesignerBaseTypeName);
                        ISite? site = component.Site;
                        bool flag = false;
                        ITypeResolutionService? typeResolutionService = (ITypeResolutionService?)site?.GetService(typeof(ITypeResolutionService));
                        if (typeResolutionService != null)
                        {
                            flag = true;
                            type = typeResolutionService.GetType(designerAttribute.DesignerTypeName);
                        }
                        if (!flag)
                        {

                            type = Type.GetType(designerAttribute.DesignerTypeName);

                            
                        }
                        if (type != null)
                        {
                            break;
                        }
                    }
                }
            }
             
            //item = TypeDescriptor.CreateDesigner(component, typeof(IDesigner));
            return item;
        }
    }

User's image

User's image

Developer technologies Windows Forms
Developer technologies .NET Other
Developer technologies C#
{count} votes