问题
We are making statistical software. Everywhere we need to put formula such as ax2+bx+c How to make ax2 means x square 2. I want to display 2 on upper side of x. Same with πc I want to display c at suffix.
回答1:
Do you have a fixed list of formulas that users can choose but cannot edit? Then generate an image for each formula, store them in your application, and display them in a PictureBox.
If you expect users to be able to type in arbitrary formulas and render them interactively, you will have to implement a visual formula editor control. These controls take markup such as MathML or TeX and render them as graphics. Several are described in the link I provided, but I do not know of any such .Net controls for WinForms.
回答2:
for the "upper" 2 and 3 there are symbols: a², a³ (even on a german keyboard but you will find them in your symboltable in windows too) - the lower c will be harder - I would consider using pictures for those more complex formulas (if you need dynamic formulas it you might have to create them with Graphics in code)
来源:https://stackoverflow.com/questions/9409695/how-to-write-quadratic-equation-on-label-in-c-sharp-winforms