public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { editorService = provider.GetService( typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; } if (editorService != null) { GradientEditorControl editorControl = new GradientEditorControl((Gradient)value, editorService); editorService.DropDownControl(editorControl); } return(value); }
private void InitializeComponent() { this.editorControl = new GradientEditorControl(); this.btnOk = new Button(); this.btnCancel = new Button(); this.SuspendLayout(); this.editorControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; this.editorControl.AutoSize = true; this.editorControl.Location = new Point(0, 0); this.editorControl.Name = "editorControl"; this.editorControl.Size = new Size(582, 290); this.editorControl.TabIndex = 0; this.btnOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; this.btnOk.DialogResult = DialogResult.OK; this.btnOk.Location = new Point(412, 301); this.btnOk.Name = "btnOk"; this.btnOk.Size = new Size(75, 23); this.btnOk.TabIndex = 1; this.btnOk.Text = "OK"; this.btnOk.UseVisualStyleBackColor = true; this.btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; this.btnCancel.DialogResult = DialogResult.Cancel; this.btnCancel.Location = new Point(493, 301); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new Size(75, 23); this.btnCancel.TabIndex = 1; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; this.ClientSize = new Size(580, 336); this.Controls.Add((Control)this.btnCancel); this.Controls.Add((Control)this.btnOk); this.Controls.Add((Control)this.editorControl); this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = nameof(RadGradientDialog); this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.CenterScreen; this.ResumeLayout(false); this.PerformLayout(); }