Pregunta: | 23129 - IMPRIMIR EL CONTENIDO DE UN MSFLEXGRID |
Autor: | Alejandro Nolazco Guerrero |
Quiero imprimir el contenido de un msflexgrid como si imprimiera un RichTextBox pero solo me imprime la primera celda.
Quiero saber la forma de imprimir el contenido de un msflexgrid. |
Respuesta: | Oswaldo Monagas |
Con el siguiente codigo tienes:
Purpose Print a FlexGrid control Method For each row, loop through the row's columns printing the control's values. Private Sub PrintFlexGrid(ByVal ptr As Object, ByVal flx As MSFlexGrid, ByVal xmin As Single, ByVal ymin As Single) Const GAP = 60 Dim xmax As Single Dim ymax As Single Dim X As Single Dim c As Integer Dim r As Integer With flxData ' See how wide the whole thing is. xmax = xmin + GAP For c = 0 To .Cols - 1 xmax = xmax + .ColWidth(c) + 2 * GAP Next c ' Print each row. ptr.CurrentY = ymin For r = 0 To .Rows - 1 ' Draw a line above this row. If r > 0 Then ptr.Line (xmin, ptr.CurrentY)-(xmax, ptr.CurrentY) ptr.CurrentY = ptr.CurrentY + GAP ' Print the entries on this row. X = xmin + GAP For c = 0 To .Cols - 1 ptr.CurrentX = X ptr.Print BoundedText(.TextMatrix(r, c), .ColWidth(c)); X = X + .ColWidth(c) + 2 * GAP Next c ptr.CurrentY = ptr.CurrentY + GAP ' Move to the next line. ptr.Print Next r ymax = ptr.CurrentY ' Draw a box around everything. ptr.Line (xmin, ymin)-(xmax, ymax), , B ' Draw lines between the columns. X = xmin For c = 0 To .Cols - 2 X = X + .ColWidth(c) + 2 * GAP ptr.Line (X, ymin)-(X, ymax) Next c End With End Sub Oswaldo Monagas |