Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LabeledProgressBar work on Mono #4255

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

HebaruSan
Copy link
Member

Problem

The new LabeledProgressBars from #4249 don't display correctly on Mono; the underlying progress bar graphic is never rendered, and changing the text doesn't erase previous iterations of it, so they end up all piled up on top of one another over a plain background. It's unreadable and unusable.

Cause

The strategy of adding a Label to ProgressBar.Controls was appealing because it allowed us to let text rendering be handled by code that's already an expert in it, but turning a Label transparent seems to rely too heavily on quirks of the specific Win32 graphics subsystems. Mono just does things a bit differently.

Changes

  • Now TransparentLabel.cs is deleted
  • Now LabeledProgressBar uses TextRenderer.DrawText to draw its own Text property in OnPaint rather than delegating this duty to a contained Label. This is a bit simpler and makes it work on Mono.
  • Now double buffering is enabled in the LabeledProgressBar to further reduce any remaining flickering

@HebaruSan HebaruSan added Bug Something is not working as intended Easy This is easy to fix GUI Issues affecting the interactive GUI Mono Issues specific for Mono labels Nov 10, 2024
@HebaruSan HebaruSan merged commit b8726a9 into KSP-CKAN:master Nov 10, 2024
3 checks passed
@HebaruSan HebaruSan deleted the fix/mono-progressbars branch November 10, 2024 19:12
@HebaruSan HebaruSan mentioned this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Easy This is easy to fix GUI Issues affecting the interactive GUI Mono Issues specific for Mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant