So, I finally got this figured out!
I knew that I was off 5/16" and that my (SystemParameters.FullPrimaryScreenWidth / 96) (to get the width in inches) resulted in a double value with decimals.
I determined the difference between the rounded screen width and the true screen width (with decimals).
I then multiplied that by the number of screen width inches (rounded) to get the total difference.
I finally multipled that by 6 since there are 6 pixels per 1/16".
Here's my code that determined how much was lost in the screen width rounding calculation.
Private Sub SetRulerPositionOffset() |
Dim screenWidthRounding As Double = ScreenWidthRounding() |
|
_rulerCenterXOffset = SystemParameters.FullPrimaryScreenWidth - ScrollViewer.HorizontalOffset - DesignCanvas.Margin.Left + screenWidthRounding |
_rulerCenterYOffset = SystemParameters.FullPrimaryScreenWidth - ScrollViewer.VerticalOffset - DesignCanvas.Margin.Top - screenWidthRounding |
End Sub |
|
Private Function ScreenWidthRounding() As Double |
Dim actualWidthInInches As Double = SystemParameters.FullPrimaryScreenWidth / 96 |
Dim roundedWidthInInches As Double = Math.Round(SystemParameters.FullPrimaryScreenWidth / 96) |
Dim widthDifference As Double = roundedWidthInInches - actualWidthInInches |
Dim widthRounding As Double = widthDifference * roundedWidthInInches * 6 ' 6 pixels per 1/16 of an inch |
Return widthRounding |
End Function |
This doesn't seem a very eloquent solution but it works for me.
If there is another way to tackle this issue I'd sure like to hear about it.
Thanks,
Rita