Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions src/DiffEngineViewer.Windows/FooterButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/// <summary>
/// A footer button whose label stays readable while it is disabled. In dark mode WinForms draws
/// a disabled Standard button's text near black whatever the button's colours are, which on
/// <see cref="Palette.Background" /> could not be seen at all. Its border and face are right, so
/// they are left to WinForms and only the label is drawn again, over a face that is a plain fill.
/// </summary>
[DesignerCategory("")]
sealed class FooterButton : FormsButton
{
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (Enabled)
{
return;
}

var graphics = e.Graphics;
var inside = ClientRectangle;
// Inside the rounded border, which WinForms draws one pixel in from the edge
inside.Inflate(-2, -2);
using (var face = new SolidBrush(BackColor))
{
graphics.FillRectangle(face, inside);
}

TextRenderer.DrawText(
graphics,
Text,
Font,
ClientRectangle,
Palette.Dim,
TextFormatFlags.HorizontalCenter |
TextFormatFlags.VerticalCenter |
TextFormatFlags.SingleLine |
TextFormatFlags.NoPrefix);
}
}
4 changes: 2 additions & 2 deletions src/DiffEngineViewer.Windows/ViewerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sealed class ViewerForm : HeadForm
UseMnemonic = false
};

readonly List<FormsButton> pool = [];
readonly List<FooterButton> pool = [];

/// <summary>
/// One bar, not two: both panes are sliced from the same ScrollTop, so they scroll together.
Expand Down Expand Up @@ -484,7 +484,7 @@ void ApplyButtons(Screen screen)
while (pool.Count < screen.Buttons.Count)
{
var index = pool.Count;
var button = new FormsButton
var button = new FooterButton
{
AutoSize = true,
// Sized to the label it has now. The pool relabels its buttons as the screen
Expand Down
Loading