Browse Source

reintroduce fix for scaling problems on Windows Vista and higher

formsdesignerappdomain
Siegfried Pammer 14 years ago
parent
commit
ca341b4853
  1. 12
      src/AddIns/DisplayBindings/FormsDesigner/FormsDesigner.AddIn/FormsDesignerViewContent.cs
  2. 10
      src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesignerAppDomainHost.cs

12
src/AddIns/DisplayBindings/FormsDesigner/FormsDesigner.AddIn/FormsDesignerViewContent.cs

@ -268,9 +268,10 @@ namespace ICSharpCode.FormsDesigner @@ -268,9 +268,10 @@ namespace ICSharpCode.FormsDesigner
}
}
CustomWindowsFormsHost WrapInCustomHost(Control control)
CustomWindowsFormsHost WrapInCustomHost(Control control, bool enableFontInheritance = true)
{
var host = new CustomWindowsFormsHost(appDomain);
host.EnableFontInheritance = enableFontInheritance;
host.Child = control;
return host;
}
@ -594,13 +595,12 @@ namespace ICSharpCode.FormsDesigner @@ -594,13 +595,12 @@ namespace ICSharpCode.FormsDesigner
if (e.HasSucceeded) {
// Display the designer on the view content
bool savedIsDirty = this.DesignerCodeFile.IsDirty;
CustomWindowsFormsHost designView = WrapInCustomHost(appDomainHost.DesignSurfaceView);
// designView.BackColor = Color.White;
// designView.RightToLeft = RightToLeft.No;
// Make sure auto-scaling is based on the correct font.
// enableFontInheritance: Make sure auto-scaling is based on the correct font.
// This is required on Vista, I don't know why it works correctly in XP
// designView.Font = System.Windows.Forms.Control.DefaultFont;
CustomWindowsFormsHost designView = WrapInCustomHost(appDomainHost.DesignSurfaceView, enableFontInheritance: false);
this.UserContent = designView;
LoggingService.Debug("FormsDesigner loaded, setting ActiveDesignSurface to " + appDomainHost.DesignSurfaceName);

10
src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesignerAppDomainHost.cs

@ -375,9 +375,17 @@ namespace ICSharpCode.FormsDesigner @@ -375,9 +375,17 @@ namespace ICSharpCode.FormsDesigner
designSurface.Flush();
}
bool isDesignSurfaceViewInitialized = false;
public Control DesignSurfaceView {
get {
return (Control)designSurface.View;
var designView = (Control)designSurface.View;
if (!isDesignSurfaceViewInitialized) {
designView.BackColor = Color.White;
designView.RightToLeft = RightToLeft.No;
isDesignSurfaceViewInitialized = true;
}
return designView;
}
}

Loading…
Cancel
Save