question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

transparent backgrounds for FormsPlot and WpfPlot

See original GitHub issue

Is it possible to set transparent background on formsPlot control in WinForms?

formsPlot.plt.Style(figBg: Color.Transparent); 
formsPlot.plt.Style(dataBg: Color.Transparent);

This makes blue background as we see in the designer. It seems that bitmap can be generated with transparency, but I need it in WinForms control.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
swhardencommented, Mar 7, 2020

It’s possible to remake FormsPlot control to not use PictureBox. plt.GetBitmap() manualy draw to control canvas in OnPaint method. @swharden can reveal the reasons why PictureBox is used now.

@StendProg I think the reason I did this is because PictureBox has simple and robust support for double buffering. Drawing directly on the control may produce flickering. This is my understanding, but I haven’t explored this topic in a while - if you are aware of a better way let me know!

0reactions
swhardencommented, Mar 7, 2020

For what it’s worth, I added support (and a demo) for the WpfPlot control too.

image

It was hard to track down, but the only change needed was to modify the encoder for bmp.Save:

https://github.com/swharden/ScottPlot/blob/22e7e23e4a6bb8877a0a801ce1a9557e620ceba8/src/ScottPlot.WPF/WpfPlot.xaml.cs#L82-L92

Read more comments on GitHub >

github_iconTop Results From Across the Web

winforms - C# transparent background for window form
Creating a background image, painting the transparent area of it with a specific color and setting it as the form BackgroundImage... then ...
Read more >
ScottPlot Changelog
WpfPlot : Converted the UserControl to a CustomControl to facilitate ... ClearType back to AntiAliased to improve text appearance on transparent backgrounds.
Read more >
How to: Give Your Control a Transparent Background - ...
Windows Forms controls do not support true transparency. The background of a transparent Windows Forms control is painted by its parent.
Read more >
Untitled
Basically, you will need to use the Visual Studio designer or … transparent backgrounds for FormsPlot and WpfPlot #286 … How to make...
Read more >
How to Set Transparent Background for Plotly Plot?
Method 1: Using the "layout" parameter. One simple way to set the background of a Plotly plot to transparent is by using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found