Skip to content

Commit

Permalink
🐛 Force on top after load
Browse files Browse the repository at this point in the history
For some reason, the window loses the topmost flag after being shown
  • Loading branch information
LBognanni committed Dec 8, 2023
1 parent 179b900 commit 2d6e439
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/CodeMade.Clock/frmClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,23 @@ public frmClock(ISettings settings, SkinPackCollection skinpacks, string skinOve
ViewModel.WhenAnyValue(x => x.Image)
.WhereNotNull()
.Subscribe(img => WinAPI.SetFormBackground(this, img));
.Subscribe(UpdateBackground);
});
}

private void UpdateBackground(Bitmap bitmap)
{
WinAPI.SetFormBackground(this, bitmap);
}

protected override void OnLoad(EventArgs e)
{
ControlBox = false;
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.ResizeRedraw, true);
TopMost = true;
base.OnLoad(e);
}

Expand Down

0 comments on commit 2d6e439

Please sign in to comment.