Skip to content

How to use SetBackground #406

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

Closed
seghier opened this issue Jun 10, 2023 · 3 comments
Closed

How to use SetBackground #406

seghier opened this issue Jun 10, 2023 · 3 comments
Assignees

Comments

@seghier
Copy link

seghier commented Jun 10, 2023

Hi
Thank you for this useful tool
How to use SetBackground to change the background from transparent to another color?

@ForNeVeR
Copy link
Owner

Could you please clarify: the background of what? Of a particular formula element or of the whole control?

@seghier
Copy link
Author

seghier commented Jun 10, 2023

Thanks, i find a solution to set the background of the image
If you can replace brush with System.Drawing.Color this will be better .....SetBackground(System.Drawing.Color)

var mediaBackClr = System.Windows.Media.Color.FromArgb(backClr.A, backClr.R, backClr.G, backClr.B);
var backsolidbrush = new System.Windows.Media.SolidColorBrush(mediaBackClr);
var backBrush = WpfMath.Rendering.WpfBrush.FromBrush(backsolidbrush);
latexformula.SetBackground(backBrush);

@ForNeVeR
Copy link
Owner

Ok, now I see what you mean.

Unfortunately, I don't think we are going that way.

While not exactly, System.Drawing.Color is mostly associated with Windows Forms and not WPF; as you can see, WPF uses its own color types (while, for simple coloring, they directly correspond to each other).

WPF part of XAML Math is only going to deal with WPF types. Aside from color types, this allows you to apply any WPF brush to select coloring, even a texture brush or whatnot.

We will be developing a separate Windows Forms backend (#378), though, that will allow you to use WinForms Brush instead. And that one is a bit easier to construct from a System.Drawing.Color.

Note that it will never be possible to mix WPF rendering and Windows Forms brushes, though.

@ForNeVeR ForNeVeR closed this as not planned Won't fix, can't repro, duplicate, stale Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants