Zdravim,mam tu opet nejaky problem,tentokrat jde o program,do ktereho zadam 3 hodnoty - polomer nebo prumer kruznice (v px),a jeji vzdalenost od osy x a y ,a pak vykresli kruznici. Jde o to,ze nevim,jak primo zavolat proceduru,ci jak proste prekreslit cely formular,aby se zde kruznice objevila,to s tim IFem mam jen jako docasne reseni v procedure Form1_Paint - tedy vim,ze muze nastat pripad,ze bude vzdalena 0px (Program nemuze prekonvertovat prazdny textbox na typ integer)
Public Class Form1
Dim osa_x As Integer = CInt(0)
Dim osa_y As Integer = CInt(0)
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
TextBox1.Enabled = True
TextBox2.Enabled = False
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
TextBox1.Enabled = False
TextBox2.Enabled = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
osa_x = TextBox3.Text
osa_y = TextBox4.Text
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
If osa_x And osa_y <> 0 Then
Dim p As New Pen(Color.Indigo, 60)
If RadioButton1.Checked = True Then
Dim prumer As Integer = CInt(TextBox1.Text)
osa_x = osa_x - (prumer / 2)
osa_y = osa_y - (prumer / 2)
e.Graphics.DrawEllipse(p, osa_x, osa_y, prumer, prumer)
End If
If RadioButton2.Checked = True Then
Dim polomer As Integer = CInt(TextBox2.Text)
osa_x = osa_x - polomer
osa_y = osa_y - polomer
e.Graphics.DrawEllipse(p, osa_x, osa_y, (polomer * 2), (polomer * 2))
End If
End If
End Sub
End Class
Dekuji predem za pomoc
|