문제

I have a custom form Names "Form1" that I want to open through propertygrid control.

I want to make it like this enter image description here

Code here

[CategoryAttribute("Extended Properties"),
        EditorAttribute(typeof(System.Windows.Forms.Form1), typeof(System.Drawing.Design.UITypeEditor))]
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public string Path { get; set; }
도움이 되었습니까?

해결책

You need to define a class that inherits from UITypeEditor who's job will be to display Form1. This type is what goes into the EditorAttribute (not Form1). The sample here is more or less what you need to implement. Basically, you override GetEditorStyle to return UITypeEditorEditStyle.Modal and override EditValue to call IWindowsFormsEditorService.ShowDialog on an instance of your form.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top