none
Erzeugte Grafik in ein WordDoc einfügen RRS feed

  • Frage

  • Hallo zusammen habe folgender Grafik programmiert

    Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)
    
    
    
        If SollZeichnen Then
    
          Dim y1 As Integer = 330
          Dim x1 As Integer = +20
          Dim y2 As Double = 330 - (TextBox4_v.Text * 150)
    
          Dim y33 As Double = 330 - (TextBox4_v.Text * 150)
    
    
    
          Dim y3 As Double = y2 + CInt(TextBox4_v.Text * 150)
    
    
    
    
          Dim t As Double
          Dim x5 As Double
          Dim x20 As Double
          Dim x21 As Double
          Dim x22 As Double
    
          Dim y4 As Double = 330 - CInt(TextBox4_v.Text)
    
    
    
          'Dreiecksförmig
    
          If RadioButton2_drei.Checked = True Then
    
            Dim x2 As Double = (TextBox3_t.Text * 10)
    
    
            t = CInt(x2 / 2) 't=x3
            x5 = (t + (x2 / 2))
    
            'y=mx+b
            'm=(y1-y2) / (x1-x2)
            'b=y1-m*x1
    
            Dim m As Double = (y1 - y2) / (x1 - t)
            Dim b As Double = y2 - (m * t)
    
            x1 = +20
    
            'y1 = m * x1 + b
            y2 = m * t + b
            'x2 = 640 - 10
    
            'y3 = X3 + b
    
          End If
    
          'Trapezförmig
    
          If RadioButton1_tra.Checked = True Then
    
            Dim x12 As Double = (TextBox2_ttrap.Text * 10)
            Dim x8 As Double = (TextBox2_ta.Text * 10)
    
    
            x20 = x8 + 20
            x21 = (x12 - (2 * x8) + x8)  '- x8 + 20
            x22 = x12
    
    
            Dim m As Double = (y1 - y2) / (x1 - x20)
            Dim b As Double = y2 - (m * x20)
    
            x1 = +20
    
            'y1 = m * x1 + b
            y2 = m * x20 + b
            'x2 = 640 - 10
    
    
    
          End If
    
          'Graph
    
    
    
          Dim g As Graphics
          Dim p As Pen
          p = New Pen(System.Drawing.Color.Black, 4)
          g = e.Graphics
          With g
    
    
            .DrawLine(p, 0, 330, 640, 330) 'x
            .DrawLine(p, 20, 340, 20, 0) 'y
    
            Dim v1 As Integer = 0
            Dim xa As Integer = 350 / 20
    
            'Dim z2 As Integer = 335 - 325
    
            Dim z1 As Integer = 0
            Dim yb As Integer = xa * 100
    
            For z1 = 20 To yb Step 10
              .DrawLine(New Pen(System.Drawing.Color.Gray, 1), z1, 0, z1, 335)
              v1 += 1
            Next
    
            Dim ya As Integer = 640 / 19.39393939
            Dim z2 As Integer = 0
            Dim x12a As Integer = ya * 10
    
            For z2 = 15 To x12a Step 15
              .DrawLine(New Pen(System.Drawing.Color.Gray, 1), 0, z2, Me.Height, z2)
    
            Next
    
    
            Dim strText As String = "1"
            Dim strText2 As String = "2"
            Dim strText3 As String = "3"
            Dim strText4 As String = "4"
            Dim strText5 As String = "5"
            Dim strText6 As String = "6"
            Dim strText7 As String = "7"
            Dim strText8 As String = "8"
            Dim strText9 As String = "9"
            Dim strText10 As String = "10"
            Dim strText11 As String = "11"
            Dim strText12 As String = "12"
            Dim strText13 As String = "13"
            Dim strText14 As String = "14"
            Dim strText15 As String = "15"
            Dim strText16 As String = "16"
            Dim strText17 As String = "17"
            Dim strText18 As String = "18"
            Dim strText19 As String = "19"
            Dim strText20 As String = "20"
            Dim strText21 As String = "21"
            Dim strText22 As String = "22"
            Dim strText23 As String = "23"
            Dim strText24 As String = "24"
            Dim strText25 As String = "25"
            Dim strText26 As String = "26"
            Dim strText27 As String = "27"
    
    
            Dim ft As New Font("Arial", 6, FontStyle.Bold) 'Or FontStyle.Underline)
            .DrawString(strText, ft, Brushes.Black, New Point(25, 335))
            .DrawString(strText2, ft, Brushes.Black, New Point(35, 335))
            .DrawString(strText3, ft, Brushes.Black, New Point(45, 335))
            .DrawString(strText4, ft, Brushes.Black, New Point(55, 335))
            .DrawString(strText5, ft, Brushes.Black, New Point(65, 335))
            .DrawString(strText6, ft, Brushes.Black, New Point(75, 335))
            .DrawString(strText7, ft, Brushes.Black, New Point(85, 335))
            .DrawString(strText8, ft, Brushes.Black, New Point(95, 335))
            .DrawString(strText9, ft, Brushes.Black, New Point(105, 335))
            .DrawString(strText10, ft, Brushes.Black, New Point(115, 335))
            .DrawString(strText11, ft, Brushes.Black, New Point(125, 335))
            .DrawString(strText12, ft, Brushes.Black, New Point(135, 335))
            .DrawString(strText13, ft, Brushes.Black, New Point(145, 335))
            .DrawString(strText14, ft, Brushes.Black, New Point(155, 335))
            .DrawString(strText15, ft, Brushes.Black, New Point(165, 335))
            .DrawString(strText16, ft, Brushes.Black, New Point(175, 335))
            .DrawString(strText17, ft, Brushes.Black, New Point(185, 335))
            .DrawString(strText18, ft, Brushes.Black, New Point(195, 335))
            .DrawString(strText19, ft, Brushes.Black, New Point(205, 335))
            .DrawString(strText20, ft, Brushes.Black, New Point(215, 335))
            .DrawString(strText21, ft, Brushes.Black, New Point(225, 335))
            .DrawString(strText22, ft, Brushes.Black, New Point(235, 335))
            .DrawString(strText23, ft, Brushes.Black, New Point(245, 335))
            .DrawString(strText24, ft, Brushes.Black, New Point(255, 335))
            .DrawString(strText25, ft, Brushes.Black, New Point(265, 335))
            .DrawString(strText26, ft, Brushes.Black, New Point(275, 335))
    
    
    
    
    
    
            Dim strTexth2 As String = "0,1"
            Dim strTexth3 As String = "0,2"
            Dim strTexth4 As String = "0,3"
            Dim strTexth5 As String = "0,4"
            Dim strTexth6 As String = "0,5"
            Dim strTexth7 As String = "0,6"
            Dim strTexth8 As String = "0,7"
            Dim strTexth9 As String = "0,8"
            Dim strTexth10 As String = "0,9"
            Dim strTexth11 As String = "1,0"
            Dim strTexth12 As String = "1,1"
            Dim strTexth13 As String = "1,2"
            Dim strTexth14 As String = "1,3"
            Dim strTexth15 As String = "1,4"
            Dim strTexth16 As String = "1,5"
            Dim strTexth17 As String = "1,6"
            Dim strTexth18 As String = "1,7"
            Dim strTexth19 As String = "1,8"
            Dim strTexth20 As String = "1,9"
            Dim strTexth21 As String = "2,0"
            Dim strTexth22 As String = "2,1"
            Dim strTexth23 As String = "2,2"
            Dim strTexth24 As String = "2,3"
            Dim strTexth25 As String = "2,4"
            Dim strTexth26 As String = "2,5"
            Dim strTexth27 As String = "2,6"
    
    
            Dim ft1 As New Font("Arial", 6, FontStyle.Bold) 'Or FontStyle.Underline)
    
            .DrawString(strTexth2, ft1, Brushes.Black, New Point(3, 310))
            .DrawString(strTexth3, ft1, Brushes.Black, New Point(3, 295))
            .DrawString(strTexth4, ft1, Brushes.Black, New Point(3, 280))
            .DrawString(strTexth5, ft1, Brushes.Black, New Point(3, 265))
            .DrawString(strTexth6, ft1, Brushes.Black, New Point(3, 250))
            .DrawString(strTexth7, ft1, Brushes.Black, New Point(3, 235))
            .DrawString(strTexth8, ft1, Brushes.Black, New Point(3, 220))
            .DrawString(strTexth9, ft1, Brushes.Black, New Point(3, 205))
            .DrawString(strTexth10, ft1, Brushes.Black, New Point(3, 190))
            .DrawString(strTexth11, ft1, Brushes.Black, New Point(3, 175))
            .DrawString(strTexth12, ft1, Brushes.Black, New Point(3, 160))
            .DrawString(strTexth13, ft1, Brushes.Black, New Point(3, 145))
            .DrawString(strTexth14, ft1, Brushes.Black, New Point(3, 130))
            .DrawString(strTexth15, ft1, Brushes.Black, New Point(3, 115))
            .DrawString(strTexth16, ft1, Brushes.Black, New Point(3, 100))
            .DrawString(strTexth17, ft1, Brushes.Black, New Point(3, 85))
            .DrawString(strTexth18, ft1, Brushes.Black, New Point(3, 70))
            .DrawString(strTexth19, ft1, Brushes.Black, New Point(3, 55))
            .DrawString(strTexth20, ft1, Brushes.Black, New Point(3, 40))
            .DrawString(strTexth21, ft1, Brushes.Black, New Point(3, 25))
            .DrawString(strTexth22, ft1, Brushes.Black, New Point(3, 10))
            '.DrawString(strTexth23, ft1, Brushes.Black, New Point(8, 105))
            '.DrawString(strTexth25, ft1, Brushes.Black, New Point(8, 95))
            '.DrawString(strTexth26, ft1, Brushes.Black, New Point(8, 85))
            '.DrawString(strTexth27, ft1, Brushes.Black, New Point(8, 75))
    
    
    
            Dim x3 As Integer
            x3 = CInt(t) + 20
    
            Dim x4 As Integer
            x4 = CInt(x5) + 20
    
            Dim y5 As Integer
            y5 = CInt(y2)
    
            Dim y6 As Integer
            y6 = CInt(y3) '- 20
    
            Dim y7 As Integer
            y7 = CInt(y4)
    
            'Trapez
    
            Dim x9 As Integer
            x9 = CInt(x20)
    
            Dim x10 As Integer
            x10 = CInt(x21) + 20
    
            Dim x33 As Integer
            x33 = CInt(x22) + 20
    
    
    
            If RadioButton2_drei.Checked = True Then
    
              .DrawLine(New Pen(System.Drawing.Color.Red, 2), x1, y1, x3, y5)
              .DrawLine(New Pen(System.Drawing.Color.Red, 2), x3, y5, x4, y7)
    
    
            End If
    
            If RadioButton1_tra.Checked = True Then
    
              .DrawLine(New Pen(System.Drawing.Color.Red, 2), x1, y1, x9, y5)
    
              .DrawLine(New Pen(System.Drawing.Color.Red, 2), x9, y5, x10, y5)
    
              .DrawLine(New Pen(System.Drawing.Color.Red, 2), x10, y5, x33, y7)
    
    
            End If
    
          End With
        End If
    
      End Sub

    Wie kann ich jetzt diese Grafik, in ein WordDoc einfügen. In dem WordDoc übertrage ich die Werte durch Textmarken.

    Grüße

    Montag, 21. Juni 2010 15:19

Antworten

Alle Antworten