
with no properties set, this will render // "Display Visio Control" // in a box on the page Writer.RenderBeginTag(HtmlTextWriterTag.Div) Protected override void RenderContents(HtmlTextWriter To complete this step, create a “Rendering” region and within this region, override the RenderContents sub with the following code: The control will not work if the tilde is left in place as it will not be able to locate the file.Īt this point, the only thing left to do is to define how the control will be rendered. Notice also that the set side of the property strips the tilde character from the beginning of any file path sent to the property if the value does not contain a tilde, the property is set to contain the path as it is sent. Properties set in this manner will be persisted within the control user’s project. If the user clicks on the button, the IDE will open the URL editor and will permit the user to use that editor to navigate to the SWF file and set the File Path property through that editor’s dialog. Adding this attribute to the control specifies to the IDE how the property is to be edited in this instance, when the control user sets the File Path property for the control, the property grid will display a button with an ellipsis in it at the right hand side of the text box.
#Vsd viewer 2007 download code
Note that, in the attributes section, the code specifies an editor and further that the editor specified is defined as the URL Editor. Navigate back to the ShowVisio.cs file and, at the top of the file, add in the import statement highlighted below: Select this library and click on the “OK” button.įigure 1: Visual Studio 2005 New Project Dialogįigure 2: Add New Item Dialog Code: Show Vision Control NET tab, and search down the list until you find the “ System.Design” reference. When the “Add Reference” dialog opens, select the. To add this reference, right click on the references folder in the solution explorer and then click on the “Add Reference” menu option. One last step prior to writing the code for this project will be to add in one needed reference. You may now delete the default web control that was created when the project was originally initialized from the template.Īt this point, we should have an open web control library project with a single web control named “ ShowVisio.cs” in that project. When the “Add New Item” dialog appears (Figure 2), select the “Web Custom Control” template, after selecting the template, key ShowVisio.cs into the name field and then click “Add” to close the dialog. Once the project has opened right click on the solution and click on the “Add” menu option, and then select “New Item”. Key in a name for the project and then click “OK”.


From the new project dialog (Figure 1), under project types, select the “Windows” node from beneath “C#”, then select the “Web Control Library” template in the right hand pane. In order to get started, open up the Visual Studio 2005 IDE and start a new project. Also, if the Visio diagram is converted to an image, the image will not have the control options available (e.g., scrolling, panning, etc.) when viewing the diagram in the control. The only advantage to using a custom control is that it allows the developer to build a page and add the Visio file to that page as content rather than to merely open the diagram as a standalone page. Of course Visio files may also be converted to a web page or image format and displayed as images added to a web page. It is entirely possible to code the page to display a Visio diagram without using a custom control, having the control handy simplifies the process to the point where someone using it need only drop it onto the page and set a file path property within the IDE (or at runtime) to bring the Visio diagram into the page.įurther, it is possible to open a Visio file directly into Microsoft Internet Explorer to do this, one need only create hyperlink and set it to navigate directly to the Visio file. This article describes a quick and simple approach to creating a custom web control used to display Microsoft Visio files within an ASP.NET page using Internet Explorer.
