I have another problem, but it doesn't always happen. This is with the latest 4.0 code from Github.
Sometimes I start the program and the time ends up too far to the right, with part of it off the right side of the screen. Or left of where I want it.
Or sometimes it will start in the position I want, but when the time changes it jumps over to a position to the right, or to the left. It usually happens while I'm not looking or it's under another window.
Here's an example of my setup file. You can probably use "Arial" instead of "Crewniverse" and still get the problem. Note also that I'm using a bog standard 1920x1080 monitor, so the positioning may not be the same as on your screen.
{
"Format": "t",
"CountdownFormat": "",
"CountdownTo": "0001-01-01T00:00:00",
"TimeZone": "",
"FontFamily": "Crewniverse",
"TextColor": "#FFFE97B5",
"OuterColor": "#FFFFFFFF",
"BackgroundEnabled": false,
"BackgroundOpacity": 0.0,
"BackgroundCornerRadius": 0.9,
"OutlineThickness": 2.0,
"Topmost": false,
"ShowInTaskbar": false,
"Height": 130,
"RunOnStartup": true,
"DragToMove": true,
"RightAligned": true,
"TipsShown": 0,
"Placement": {
"Length": 44,
"Flags": 0,
"ShowCommand": 1,
"MinimizedPosition": {
"X": -1,
"Y": -1
},
"MaximizedPosition": {
"X": -1,
"Y": -1
},
"NormalBounds": {
"Left": 1467,
"Top": 814,
"Right": 1915,
"Bottom": 944
}
}
}
I have a theory about what is happening. When the digits of the time change, the resultant graphical representation of the time changes. It remains the same height, but with a large font (and an even larger outline) the width can change by quite a bit. Think of the difference in width of a zero vs a one, or going from "9:59" to "10:00".
Note also that I have set
I assume that this is supposed to position the time so that it is right justified. I want it to be close to the right side of the screen. What I suspect is that somewhere in the code the values of "Left" and "Right" are being re-calculated assuming that the time is to be left justified, ignoring this flag. Which would explain the right-left movement I'm getting. If the time is supposed to be right justified, the value of "Right" should never change, just "Left". And of course when it's left justified, "Left" should never change, just "Right".
That seems to be what the code in "Window_SizeChanged()" is trying to do.
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (_hasInitiallyChangedSize && e.WidthChanged && Settings.Default.RightAligned)
{
var previousRight = Left + e.PreviousSize.Width;
Left = previousRight - ActualWidth;
}
// Use this to ignore the change when the window is loaded at the beginning.
_hasInitiallyChangedSize = true;
}
But maybe one of the flags you are checking is set wrong? Or shouldn't be checked?
Another theory: It might be calling this code more than once?
I tried messing around with the logic a little but it only made it worse. Just grasping at straws here.
Am I interpreting this correctly? Does this make sense?