• Viernes 1 de Noviembre de 2024, 17:27

Autor Tema:  Codigo Facilito Con Error  (Leído 999 veces)

Fran25

  • Nuevo Miembro
  • *
  • Mensajes: 5
    • Ver Perfil
Codigo Facilito Con Error
« en: Martes 12 de Febrero de 2008, 21:03 »
0
Hola a todos, tengo un problema con este trozo  código que me da error , lo he sacado de la pagina www.c-sharpcorner.com/UploadFile/mgold/ ... otNet.aspx
y me da el error de ¿falta una directiva using o una referencia de ensamblado?
El error esta en la linea que pongo en negrita

public void DrawSampleShapeConnection()
{

// get the current draw page
Visio.Page currentPage = axDrawingControl1.Document.Pages[1];

// Load the stencil we want
Visio.Document currentStencil = axDrawingControl1.Document.Application.Documents.OpenEx("Basic_U.vss", (short)Visio.VisOpenSaveArgs.visOpenDocked);

// show the stencil window
Visio.Window stencilWindow = currentPage.Document.OpenStencilWindow();

// this gives a count of all the stencils on the status bar
int countStencils = currentStencil.Masters.Count;

toolStripStatusLabel1.Text = string.Format("Number of Stencils in {0} = {1}", currentStencil.Title, countStencils);
statusStrip1.Refresh();

// create a triangle shape from the stencil master collection
Visio.Shape shape1 = currentPage.Drop(currentStencil.Masters["Triangle"], 1.50, 1.50);

// create a square shape from the stencil master collection
Visio.Shape shape2 = currentPage.Drop(currentStencil.Masters["Square"], 10, 7.50);

// create a dynamic connector from the stencil master collection
Visio.Shape connector = currentPage.Drop(currentStencil.Masters["Dynamic connector"], 4.50, 4.50);

// currentPage.Layout();

// connect the shapes together through the dynamic connector
ConnectShapes(shape1, shape2, connector);

}




private static void ConnectShapes(Visio.Shape shape1, Visio.Shape shape2, Visio.Shape connector)

{

// get the cell from the source side of the connector

Cell beginXCell = connector.get_CellsSRC(

(short)VisSectionIndices.visSectionObject,

(short)VisRowIndices.visRowXForm1D,

(short)VisCellIndices.vis1DBeginX);

// glue the source side of the connector to the first shape

beginXCell.GlueTo(shape1.get_CellsSRC(

(short)VisSectionIndices.visSectionObject,

(short)VisRowIndices.visRowXFormOut,

(short)VisCellIndices.visXFormPinX));

// get the cell from the destination side of the connector

Cell endXCell = connector.get_CellsSRC(

(short)VisSectionIndices.visSectionObject,

(short)VisRowIndices.visRowXForm1D,

(short)VisCellIndices.vis1DEndX);

// glue the destination side of the connector to the second shape

endXCell.GlueTo(shape2.get_CellsSRC(

(short)VisSectionIndices.visSectionObject,

(short)VisRowIndices.visRowXFormOut,

(short)VisCellIndices.visXFormPinX));

}