| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB Builder NE |
| Contents | Index |
| Learn more about MATLAB Builder NE |
| On this page… |
|---|
Using Quick Start, both the WebFigure service and the page that has the WebFigure embedded on it reside on a single server. This configuration enables you to quickly drag and drop the WebFigureControl on a Web page.

To implement WebFigures for MATLAB Builder NE using the Quick Start approach, do the following. For more information about the Quick Start option, see About the WebFigures Feature.
Start Microsoft Visual Studio.
Select File > New > Web Site to open.
Select one of the template options and click OK.
Add WebFigureControl to the Microsoft Visual Studio toolbar
by dragging the file InstallRoot\toolbox\dotnetbuilder\bin\arch\v2.0\
WebFiguresService.dll, (where InstallRoot is
the location of the installed MCR for machines with an installed MCR
and matlabroot on a MATLAB Builder NE
development machine without the MCR installed), on to the Microsoft Visual Studio Toolbox toolbar
as follows:
Note If you are running on a system with 64-bit architecture, use the information in Advanced Configuration of a WebFigure to work with WebFigures unless you are deploying a Web site which is 32-bit only and you have a 32-bit MCR installed. |
Expand the General section of the Toolbox toolbar.
Using your mouse, drag the DLL file to the expanded section, as shown by the arrow:

If you added the control correctly, you will see the following WebFigureControl in the General section of the Microsoft Visual Studio toolbar:

Drag the WebFigureControl from the toolbar to your Web page. After dragging, the Web page displays the following default figure.

You can resize the control as you would any other .NET Web control.
Switch to the Design view in Microsoft Visual Studio by selecting View > Designer.
Test the Web page by "playing" it in Microsoft Visual Studio. Select Debug > Start Debugging. The page should appear as follows.

Interact with the default figure on the page using your mouse. Click one of the three control icons at the top of the figure to activate the desired control, select the desired region of the figure you want to manipulate, then click and drag as appropriate. For example, to zoom in on the figure, click the magnifying glass icon, then hover over the figure.
Close the page as you would any other window, automatically exiting debug or "play" mode.
The WebFigureService you created has been verified as functioning properly and you can attach a custom WebFigure to the Web page:
To enable return of the webfigure and to bind it to the webfigure control, add a reference to MWArray to your project and a reference to the deployed component you created earlier (in Assumptions About the Examples). See Using Components Created by the MATLAB Builder NE Product for more information.
In Microsoft Visual Studio, access the code for the Web page by selecting View > Code.
In Microsoft Visual Studio, go to the Page_Load method, and add this code, depending on if you are using the C# or Visual Basic language. Adding code to the Page_Load method ensures it executes every time the Web page loads.
C#:
using MyComponent;
using MathWorks.MATLAB.NET.WebFigures;
public class
{
protected void Page_Load(object sender, EventArgs e)
{
MyComponentclass myDeployedComponent =
new MyComponentclass();
WebFigureControl1.WebFigure =
new WebFigure(myDeployedComponent.getKnot());
}
}Visual Basic:
Imports MyComponent
Imports MathWorks.MATLAB.NET.WebFigures
Class
Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs)
Handles Me.Load
Dim myDeployedComponent As _
New MyComponentclass()
WebFigureControl1.WebFigure = _
New WebFigure(myDeployedComponent.getKnot())
End Sub
End ClassTip This code causes the deployed component to be reinitialized upon each refresh of the page. A better implementation would involve initializing the myDeployedComponent variable when the server starts up using a Global.asax file, and then using that variable to get the WebFigure object. For more information on Global.asax, see Using Global Application Class (Global.asax) to Create WebFigures at Server Start-Up. |
Note WebFigureControl stores the WebFigure object in the IIS session cache for each individual user. If this is not the desired configuration, see Advanced Configuration of a WebFigure for information on creating a custom configuration. |
Replay the Web page in Microsoft Visual Studio to confirm your WebFigure appears as desired. It should look like this.

![]() | Before You Use WebFigures | Advanced Configuration of a WebFigure | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |