Home   Artículos   Recursos   Foros   
Artíclos recientes publicados en Latindevelopers:

Visual C++: NSDoubleEdit: Un control para el manejo de números decimales en Visual C++.
Visual C++: Implementando una Calculadora en Visual C++
Visual C++: CCommandLine: Una clase para el uso de la linea de comando
Visual C++: Una clase para el manejo del Registro


TROZO DE CODIGO FACILITO

Foro sobre el nuevo lenguaje C# conocido tambien como CSharp o C Numeral

Moderador: Bestprogramado

TROZO DE CODIGO FACILITO

Notapor Fran25 el Mar Feb 12, 2008 3:06 pm

Hola a todos, tengo un problema con este trozo código que me da error , lo he sacado de la pagina http://www.c-sharpcorner.com/UploadFile ... 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));

}
Fran25
Usuario Activo
Usuario Activo
 
Mensajes: 20
Registrado: Jue Feb 07, 2008 11:35 am

Re: TROZO DE CODIGO FACILITO

Notapor ivancp el Mar Feb 12, 2008 5:25 pm

Cual es el codigo/mensaje/texto del error?
ivancp
Programador Experimentado
Programador Experimentado
 
Mensajes: 301
Registrado: Jue Sep 06, 2007 12:57 pm

Re: TROZO DE CODIGO FACILITO

Notapor Fran25 el Mar Feb 12, 2008 5:39 pm

Lo que me da son tres errores en la linea que indico en el anterior mensaje, que esta en negrita, ahi tambien explico el tipo de error que me sale, me sale el mismo error tres veces porque es por la palabra visio, que en esa linea se repite tres veces, me la subraya en rojo y me da el error comentado en el anterior mensaje.Gracias.
Fran25
Usuario Activo
Usuario Activo
 
Mensajes: 20
Registrado: Jue Feb 07, 2008 11:35 am

Re: TROZO DE CODIGO FACILITO

Notapor ivancp el Mar Feb 12, 2008 5:55 pm

Salta esos errores por que no tienes disponible la librería activex de visio activa.

Sigue los pasos para importar/instalar el control de Visio.

Para instalar el Control Visio ActiveX en la barra de herramientas, simplemente haga click derecho en la barra y selecione la opcion "Choose Items" (Elegir Items). Entonces dirijase a la pestaña COM como se muestra en la figura siguiente:

Imagen

Tutorial Completo:
http://www.c-sharpcorner.com/UploadFile ... otNet.aspx
ivancp
Programador Experimentado
Programador Experimentado
 
Mensajes: 301
Registrado: Jue Sep 06, 2007 12:57 pm

Re: TROZO DE CODIGO FACILITO

Notapor Fran25 el Mar Feb 12, 2008 5:56 pm

Si que la tengo instalada, es lo primero que hice, yo creo que es como un error de codigo.
Fran25
Usuario Activo
Usuario Activo
 
Mensajes: 20
Registrado: Jue Feb 07, 2008 11:35 am

Re: TROZO DE CODIGO FACILITO

Notapor ivancp el Mar Feb 12, 2008 6:13 pm

Intenta agregando la linea siguiente al principio de la pagina:

Código: Seleccionar todo
using Visio = Microsoft.Office.Interop.Visio;


PD. Aun no veo el mensaje de error que dices que esta especificado, solo veo el codigo marcado con negrita. Posiblemente este por alguna parte que no se donde es.
ivancp
Programador Experimentado
Programador Experimentado
 
Mensajes: 301
Registrado: Jue Sep 06, 2007 12:57 pm

Re: TROZO DE CODIGO FACILITO

Notapor Fran25 el Mié Feb 13, 2008 4:49 am

Gracias Ivan.Esa referencia using ya la tenia metida.Haber, me da tres errores en esa linea, en la palabra visio, y los tres errores son iguales, ¿falta directiva using o una referencia de ensamblado? Si te fijas mas arriba en el codigo, utilizo la palabra visio en las mismas condiciones y no me dice nada, yo creo que es un error al recibir esos parámetros o algo de eso.
Fran25
Usuario Activo
Usuario Activo
 
Mensajes: 20
Registrado: Jue Feb 07, 2008 11:35 am


Volver a C# (CSharp)

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados