diff --git a/src/managed/OpenLiveWriter.CoreServices/DisplayHelper.cs b/src/managed/OpenLiveWriter.CoreServices/DisplayHelper.cs
index 8221c020..dbb58fd6 100644
--- a/src/managed/OpenLiveWriter.CoreServices/DisplayHelper.cs
+++ b/src/managed/OpenLiveWriter.CoreServices/DisplayHelper.cs
@@ -105,15 +105,11 @@ namespace OpenLiveWriter.CoreServices
}
}
- public static float ScaleX(float x)
- {
- return x * ScalingFactorX;
- }
+ public static float ScaleX(float x) => x * ScalingFactorX;
+ public static float ScaleY(float y) => y * ScalingFactorY;
- public static float ScaleY(float y)
- {
- return y * ScalingFactorY;
- }
+ public static int ScaleXCeil(float x) => (int)Math.Ceiling(x * ScalingFactorX);
+ public static int ScaleYCeil(float y) => (int)Math.Ceiling(y * ScalingFactorY);
///
/// Scales a control from 96dpi to the actual screen dpi.
@@ -136,10 +132,7 @@ namespace OpenLiveWriter.CoreServices
///
public static Size ScaleSize(Size original)
{
- return new Size(
- (int)Math.Ceiling(ScaleX(original.Width)),
- (int)Math.Ceiling(ScaleY(original.Height))
- );
+ return new Size(ScaleXCeil(original.Width), ScaleYCeil(original.Height));
}
///
diff --git a/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/ExtendedEntrySplitterElementBehavior.cs b/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/ExtendedEntrySplitterElementBehavior.cs
index 9e4a9b23..9d596a78 100644
--- a/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/ExtendedEntrySplitterElementBehavior.cs
+++ b/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/ExtendedEntrySplitterElementBehavior.cs
@@ -27,11 +27,15 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors
internal class ExtendedEntrySplitterElementBehavior : ElementControlBehavior
{
private SplitterControl _splitter;
- private const int _verticalPadding = 3;
+
+ // _splitterHeight and _verticalPadding measured in 96dpi pixels
+ private const int _splitterHeight = 16;
+ private const int _verticalPadding = 2;
+
public ExtendedEntrySplitterElementBehavior(IHtmlEditorComponentContext editorContext)
: base(editorContext)
{
- _splitter = new SplitterControl();
+ _splitter = new SplitterControl(_splitterHeight);
_splitter.VirtualLocation = new Point(0, _verticalPadding);
Controls.Add(_splitter);
@@ -41,10 +45,14 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors
protected override void OnElementAttached()
{
+ // Padding is applied to both top and bottom, so halve the splitter height
+ int cssVerticalPadding = DisplayHelper.ScaleYCeil(_splitterHeight / 2 + _verticalPadding);
+
IHTMLElement2 e2 = (IHTMLElement2)HTMLElement;
- e2.runtimeStyle.padding = "0px 0px 0px 0px;";
- e2.runtimeStyle.margin = String.Format(CultureInfo.InvariantCulture, "{0}px 0px {0}px 0px;", _verticalPadding);
+ e2.runtimeStyle.padding = $"{cssVerticalPadding}px 0px {cssVerticalPadding}px 0px";
+ e2.runtimeStyle.margin = "0px 0px 0px 0px";
e2.runtimeStyle.lineHeight = "16px";
+
(e2 as IHTMLElement3).contentEditable = "false";
base.OnElementAttached();
@@ -91,8 +99,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors
private void ExtendedEntrySplitterElementBehavior_ElementSizeChanged(object sender, EventArgs e)
{
//synchronized the splitter width with the new element width
- Rectangle elementRect = ElementRectangle;
- _splitter.VirtualSize = new Size(elementRect.Width, elementRect.Height);
+ _splitter.VirtualWidth = ElementRectangle.Width;
}
protected override void OnKeyDown(HtmlEventArgs e)
@@ -175,8 +182,15 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors
private Rectangle _lineRect;
private string _moreText = Res.Get(StringId.SplitterMore);
private Font font = Res.GetFont(FontSize.PostSplitCaption, FontStyle.Regular);
- public SplitterControl()
+
+ ///
+ /// Instansiates a new SplitterControl
+ ///
+ /// The 'virtual height' of the splitter in 96 DPI pixels.
+ /// Subtracting _lineRect.Height from this value yields the height of the 'More' rectangle on the end of the splitter line.
+ public SplitterControl(int virtualHeight96)
{
+ VirtualHeight = DisplayHelper.ScaleYCeil(virtualHeight96);
}
protected override void OnPaint(PaintEventArgs e)
@@ -194,7 +208,8 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors
int morePadding = 0;
int moreRightOffset = 1;
- Size moreRectSize = new Size(Convert.ToInt32(moreTextSize.Width) + morePadding * 2, Convert.ToInt32(moreTextSize.Height) + morePadding * 2);
+ Size moreRectSize = new Size(Convert.ToInt32(moreTextSize.Width) + DisplayHelper.ScaleXCeil(morePadding * 2),
+ VirtualHeight - DisplayHelper.ScaleYCeil(_lineRect.Height));
Point moreRectLocation = new Point(_controlRect.Right - moreRectSize.Width - moreRightOffset, _lineRect.Bottom);
Rectangle moreRect = new Rectangle(moreRectLocation, moreRectSize);
@@ -216,7 +231,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors
protected override void OnLayout(EventArgs e)
{
_controlRect = new Rectangle(VirtualLocation, new Size(VirtualWidth, VirtualHeight));
- _lineRect = new Rectangle(new Point(0, 0), new Size(_controlRect.Width, 2));
+ _lineRect = new Rectangle(new Point(0, 0), new Size(_controlRect.Width, DisplayHelper.ScaleYCeil(2)));
}
}
}
diff --git a/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/Images/ExtendedEntrySeparatorTile.png b/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/Images/ExtendedEntrySeparatorTile.png
index 455681e6..8ca5faec 100644
Binary files a/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/Images/ExtendedEntrySeparatorTile.png and b/src/managed/OpenLiveWriter.PostEditor/PostHtmlEditing/Behaviors/Images/ExtendedEntrySeparatorTile.png differ