Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Math graphics library

I want to create a small math solver application in wpf or silverlight that shows working. Something similiar to what Microsoft Math can do. How do I get those graphics such as the brackets with the ability to stretch vertically based on how many rows are in the equation?

Are there any library that contain these graphics and displaying the steps for .net?

like image 894
Shawn Mclean Avatar asked Nov 26 '10 23:11

Shawn Mclean


1 Answers

Based on @duffymo's answer, you could load a webbrowser WPF Webbrowser and inject the MathJAX library

For reference:

<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
  <WebBrowser x:Name="Browser" />
</Grid>

You can interact with the JavaScript API using this code:

public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();
        Browser.LoadCompleted += BrowserOnLoadCompleted;
        Browser.Navigate(new Uri("http://example.com"));
    }

    private void BrowserOnLoadCompleted(object sender, NavigationEventArgs navigationEventArgs)
    {
        var doc = (HTMLDocument)Browser.Document;
        var head = doc.getElementsByTagName("head").Cast<HTMLHeadElement>().First();
        var script = (IHTMLScriptElement)doc.createElement("script");
        script.text = "alert('hi');";
        head.appendChild((IHTMLDOMNode)script);
        script.text = "alert('bye');";
    }
}
like image 190
Sebastian Avatar answered Sep 29 '22 21:09

Sebastian