C# 如何删除FontEditor标题栏
调出ColorEditor需要实现IwinowsFormsEditor服务和IServiceProvider。“颜色”对话框具有很大的灵活性,可以集成到下拉列表中。但FontEditor窗口已经内置了关闭按钮和标题栏。为什么MS在对话框中实现如此不同的东西?如何摆脱关闭按钮和标题栏?调出FontEditor是否必须使用IwinDownFormsEditor服务和IServiceProviderC# 如何删除FontEditor标题栏,c#,colors,font-editor,C#,Colors,Font Editor,调出ColorEditor需要实现IwinowsFormsEditor服务和IServiceProvider。“颜色”对话框具有很大的灵活性,可以集成到下拉列表中。但FontEditor窗口已经内置了关闭按钮和标题栏。为什么MS在对话框中实现如此不同的东西?如何摆脱关闭按钮和标题栏?调出FontEditor是否必须使用IwinDownFormsEditor服务和IServiceProvider 为什么MS在对话框中实现如此不同的东西 我还没有检查反射的代码。我对它不感兴趣。我 就像抱怨一样 如
private void btnFont_Click(object sender, EventArgs e)
{
Point location = base.PointToScreen(new Point(btnFont.Bounds.Location.X, btnFont.Bounds.Location.Y + btnFont.Bounds.Height));
DropDownManager myFontDialog = new DropDownManager(btnFont, new Rectangle(location, new Size(0, 0)), false, false, "Please choose...");
object objectValue = new FontEditor().EditValue(myFontDialog, previousChoosenFont);
if (objectValue != null)
{
previousChoosenFont = (Font)objectValue;
}
btnFont.Font = previousChoosenFont;
}
internal class DropDownManager : IWindowsFormsEditorService, IServiceProvider, IDisposable
{
///......
void IWindowsFormsEditorService.CloseDropDown()
{
throw new NotSupportedException();
}
void IWindowsFormsEditorService.DropDownControl(Control dropDownControl)
{
throw new NotSupportedException();
}
DialogResult IWindowsFormsEditorService.ShowDialog(Form dialog)
{
throw new NotSupportedException();
}
object IServiceProvider.GetService(Type serviceType)
{
object result = null;
if (serviceType.Equals(typeof(IWindowsFormsEditorService)))
{
result = this;
}
return result;
}
///.....
}