alexa-tracking

[ASK]Cara mengubah grafik ke Image

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/54099cf6128b4639508b456d/askcara-mengubah-grafik-ke-image
[ASK]Cara mengubah grafik ke Image
gan, ada yang tau cara mengubah grafik ke image di dalam picture box pake Visual Basic gak

Mohon bantuannya ya agan-agan sekalian

emoticon-Toast emoticon-Toast emoticon-Toast emoticon-Toast
maksudnya gimana gan
Ane buat grafik pake VB
misalnya segitiga, segiempat pake parameter paint
trus ane tampilkan di dalam picture box

Nah, kendalanya waktu di save pake print screen
gambarnya gak kesimpan karena masih bentuk grafik
Agan tau gimana caranya ngubah menjadi image?
Quote:


Tau, Kodingan nya mana gan..
Private Sub BtnTriangulasi_Click(sender As Object, e As EventArgs) Handles BtnTriangulasi.Click
If ComboBox1.SelectedIndex < 0 And ComboBox2.SelectedIndex < 0 Then
MessageBox.Show("Pilih Spanning Edge!!!")
Else
PBtriangulasi.Controls.Clear()
DGVtriangulasi.Rows.Clear()
ListBox1.Items.Clear()
Dim canvas As New ShapeContainer
canvas.Parent = PBtriangulasi

Dim c As Integer = DGVttksudut.RowCount - 1

For a As Integer = 0 To c
ReDim Preserve ax(a)
ReDim Preserve ay(a)
ax(a) = DGVttksudut.Item(0, a).Value
ay(a) = DGVttksudut.Item(1, a).Value
Next

'PBtriangulasi.Image = PBsobel.Image

Dim x1, y1, x2, y2 As Integer

x1 = CInt(Split(ComboBox1.SelectedItem, ",")(0))
y1 = CInt(Split(ComboBox1.SelectedItem, ",")(1))
x2 = CInt(Split(ComboBox2.SelectedItem, ",")(0))
y2 = CInt(Split(ComboBox2.SelectedItem, ",")(1))

For i As Integer = 0 To c Step

If (ax(i) <> x1 And ay(i) <> y1) And (ax(i) <> x2 And ay(i) <> y2) Then
Dim ce As New LineShape
ce.Parent = canvas
ce.BorderColor = Color.Black
ce.StartPoint = New System.Drawing.Point(x1, y1)
ce.EndPoint = New System.Drawing.Point(x2, y2)
Dim cde As New LineShape
cde.Parent = canvas
cde.BorderColor = Color.Black
cde.StartPoint = New System.Drawing.Point(x1, y1)
cde.EndPoint = New System.Drawing.Point(ax(i), ay(i))
Dim cd As New LineShape
cd.Parent = canvas
cd.BorderColor = Color.Black
cd.StartPoint = New System.Drawing.Point(x2, y2)
cd.EndPoint = New System.Drawing.Point(ax(i), ay(i))

With DGVtriangulasi()
.Rows.Add()
.Item(0, DGVtriangulasi.RowCount - 1).Value = x1
.Item(1, DGVtriangulasi.RowCount - 1).Value = y1
.Item(2, DGVtriangulasi.RowCount - 1).Value = x2
.Item(3, DGVtriangulasi.RowCount - 1).Value = y2
.Item(4, DGVtriangulasi.RowCount - 1).Value = ax(i)
.Item(5, DGVtriangulasi.RowCount - 1).Value = ay(i)
End With
MessageBox.Show("Pause")
End If
Next
MessageBox.Show("Proses Triangulasi Selesai")
End If

'hitung luas segitiga yg dibentuk
Dim luas As Integer
For a As Integer = 0 To DGVtriangulasi.RowCount - 1
Dim x1, x2, x3, y1, y2, y3 As Integer
x1 = DGVtriangulasi.Rows(a).Cells(0).Value
y1 = DGVtriangulasi.Rows(a).Cells(1).Value
x2 = DGVtriangulasi.Rows(a).Cells(2).Value
y2 = DGVtriangulasi.Rows(a).Cells(3).Value
x3 = DGVtriangulasi.Rows(a).Cells(4).Value
y3 = DGVtriangulasi.Rows(a).Cells(5).Value

luas = Val(Math.Abs(x1 - x3) + Math.Abs(x2 - x3) + Math.Abs(y1 - y3) + Math.Abs(y2 - y3))
Dim temp As Integer, Dataluas() As String, data() As Integer, index() As Integer
ReDim Preserve data(a)
ReDim Preserve index(a)
ReDim Preserve Dataluas(a)
Dataluas(a) = luas & " - " & a
data(a) = CInt(Split(Dataluas(a), "-")(0))
index(a) = CInt(Split(Dataluas(a), "-")(1))
If a = DGVtriangulasi.RowCount - 1 Then
For i = 0 To a
For j = i + 1 To a
If data(i) > data(j) Then
temp = data(i)
data(i) = data(j)
data(j) = temp
End If
Next
Next
For i = 0 To a
ListBox1.Items.Add(data(i) & " Segitiga ke-" & index(i))
Next
End If
Next

End Sub


Ngerti gan? Boleh ditanya kalo kurang ngerti
Intinya setelah buat gambar grafik lalu masuk ke picture box

Lalu mau print screen malah gak ada gambarnya gan
Quote:


itu nanti gambar nya masuk kesini ?
>> 'PBtriangulasi.Image = PBsobel.Image
knpa dikasih tanda '

----
kodingan yg masuk ke picturebox nya yg mana
Ohh yang itu dikasi comment.

Gambarnya masuk ke PBTriangulasi gan

Setiap kita gambar, dia ke PBTriangulasi

Cuman masalahnya karena dia masih berbentuk grafik, ketika di printscreen
gak muncul gambarnya

Jadi harus ubah ke image supaya gambarnya muncul

Ane udah ke gugel pun tetap juga gitu
Abis di printscreen lalu mau di taruh dimana?