فکر کنم ی خاصیت خود فرم داشت که وقتی کم و زیاد می شد ، سایز پیکسل(نقطه) هم کم و زیاد می شد.
در واقع چنین چیزی طبیعی هست ، چون خط از کنار هم قرار گرفتن چند تا نقطه تشکیل شده ، حالا باید این نقطه ها انقد کوچیک باشن تا به شکل یک خط دیده بشن ، بزارید ببینم می تونم پیداش کنم اینو.
من اینو پیدا نکردم ولی این کد رو ببینید:
کد:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton7 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton6 As System.Windows.Forms.RadioButton
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton8 As System.Windows.Forms.RadioButton
Friend WithEvents Draw1 As System.Windows.Forms.Button
Friend WithEvents Exit1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.RadioButton4 = New System.Windows.Forms.RadioButton()
Me.RadioButton3 = New System.Windows.Forms.RadioButton()
Me.RadioButton2 = New System.Windows.Forms.RadioButton()
Me.RadioButton1 = New System.Windows.Forms.RadioButton()
Me.RadioButton5 = New System.Windows.Forms.RadioButton()
Me.RadioButton7 = New System.Windows.Forms.RadioButton()
Me.RadioButton6 = New System.Windows.Forms.RadioButton()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.RadioButton8 = New System.Windows.Forms.RadioButton()
Me.Draw1 = New System.Windows.Forms.Button()
Me.Exit1 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.RadioButton4)
Me.GroupBox1.Controls.Add(Me.RadioButton3)
Me.GroupBox1.Controls.Add(Me.RadioButton2)
Me.GroupBox1.Controls.Add(Me.RadioButton1)
Me.GroupBox1.Controls.Add(Me.RadioButton5)
Me.GroupBox1.Location = New System.Drawing.Point(196, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(177, 151)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "GroupBox1"
'
'RadioButton4
'
Me.RadioButton4.Location = New System.Drawing.Point(13, 89)
Me.RadioButton4.Name = "RadioButton4"
Me.RadioButton4.Size = New System.Drawing.Size(139, 24)
Me.RadioButton4.TabIndex = 3
Me.RadioButton4.Text = "RadioButton4"
'
'RadioButton3
'
Me.RadioButton3.Location = New System.Drawing.Point(13, 68)
Me.RadioButton3.Name = "RadioButton3"
Me.RadioButton3.Size = New System.Drawing.Size(151, 22)
Me.RadioButton3.TabIndex = 2
Me.RadioButton3.Text = "RadioButton3"
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(13, 41)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(151, 33)
Me.RadioButton2.TabIndex = 1
Me.RadioButton2.Text = "RadioButton2"
'
'RadioButton1
'
Me.RadioButton1.Location = New System.Drawing.Point(13, 20)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(151, 26)
Me.RadioButton1.TabIndex = 0
Me.RadioButton1.Text = "RadioButton1"
'
'RadioButton5
'
Me.RadioButton5.Location = New System.Drawing.Point(13, 111)
Me.RadioButton5.Name = "RadioButton5"
Me.RadioButton5.Size = New System.Drawing.Size(151, 27)
Me.RadioButton5.TabIndex = 4
Me.RadioButton5.Text = "RadioButton5"
'
'RadioButton7
'
Me.RadioButton7.Location = New System.Drawing.Point(13, 43)
Me.RadioButton7.Name = "RadioButton7"
Me.RadioButton7.Size = New System.Drawing.Size(151, 27)
Me.RadioButton7.TabIndex = 6
Me.RadioButton7.Text = "RadioButton7"
'
'RadioButton6
'
Me.RadioButton6.Location = New System.Drawing.Point(13, 20)
Me.RadioButton6.Name = "RadioButton6"
Me.RadioButton6.Size = New System.Drawing.Size(151, 23)
Me.RadioButton6.TabIndex = 5
Me.RadioButton6.Text = "RadioButton6"
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.RadioButton8)
Me.GroupBox2.Controls.Add(Me.RadioButton7)
Me.GroupBox2.Controls.Add(Me.RadioButton6)
Me.GroupBox2.Location = New System.Drawing.Point(196, 137)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(177, 100)
Me.GroupBox2.TabIndex = 1
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "GroupBox2"
'
'RadioButton8
'
Me.RadioButton8.Location = New System.Drawing.Point(13, 65)
Me.RadioButton8.Name = "RadioButton8"
Me.RadioButton8.Size = New System.Drawing.Size(151, 29)
Me.RadioButton8.TabIndex = 7
Me.RadioButton8.Text = "RadioButton8"
'
'Draw1
'
Me.Draw1.Location = New System.Drawing.Point(11, 197)
Me.Draw1.Name = "Draw1"
Me.Draw1.Size = New System.Drawing.Size(72, 39)
Me.Draw1.TabIndex = 2
Me.Draw1.Text = "Draw"
'
'Exit1
'
Me.Exit1.Location = New System.Drawing.Point(85, 197)
Me.Exit1.Name = "Exit1"
Me.Exit1.Size = New System.Drawing.Size(79, 39)
Me.Exit1.TabIndex = 3
Me.Exit1.Text = "Exit"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(7, 165)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(81, 19)
Me.Label1.TabIndex = 4
Me.Label1.Text = "Label1"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(85, 162)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(82, 29)
Me.TextBox1.TabIndex = 5
Me.TextBox1.Text = "TextBox1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(9, 22)
Me.BackColor = System.Drawing.Color.Silver
Me.ClientSize = New System.Drawing.Size(420, 272)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Exit1)
Me.Controls.Add(Me.Draw1)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Font = New System.Drawing.Font("Times New Roman", 13.8!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(177, Byte))
Me.Name = "Form1"
Me.Text = "Form1"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Dim selectDash As Integer
Dim selectColor As Integer
Dim Width1 As Integer
Dim Color1 As Color
Dim Pen1 As Pen
Private Sub SetColor()
Select Case selectColor
Case 1
Color1 = Color.Red
Case 2
Color1 = Color.Green
Case 3
Color1 = Color.Blue
End Select
End Sub
Private Sub SetDash()
Pen1 = New Pen(Color1, Width1)
Select Case selectDash
Case 1
Pen1.DashStyle = Drawing.Drawing2D.DashStyle.Dash
Case 2
Pen1.DashStyle = Drawing.Drawing2D.DashStyle.Dot
Case 3
Pen1.DashStyle = Drawing.Drawing2D.DashStyle.DashDot
Case 4
Pen1.DashStyle = Drawing.Drawing2D.DashStyle.DashDotDot
Case 5
Pen1.DashStyle = Drawing.Drawing2D.DashStyle.Solid
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
selectColor = 1
selectDash = 1
Label1.Text = "Width"
TextBox1.Text = "1"
GroupBox1.Text = "Dash Is"
RadioButton1.Text = "Dash"
RadioButton2.Text = "Dot"
RadioButton3.Text = "DashDot"
RadioButton4.Text = "DashDotDot"
RadioButton5.Text = "Solid"
GroupBox2.Text = "Color Is "
RadioButton6.Text = "Red"
RadioButton7.Text = "Green"
RadioButton8.Text = "Blue"
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
selectDash = 1
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
selectDash = 2
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
selectDash = 3
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
selectDash = 4
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
selectDash = 5
End Sub
Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
selectColor = 1
End Sub
Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged
selectColor = 2
End Sub
Private Sub RadioButton8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton8.CheckedChanged
selectColor = 3
End Sub
Private Sub Draw1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Draw1.Click
Dim Graph As Graphics
Graph = Form1.ActiveForm.CreateGraphics
Graph.Clear(Drawing.Color.Silver)
Width1 = Val(TextBox1.Text)
SetColor()
SetDash()
Dim i As Integer
For i = 20 To 220 Step 20
Graph.DrawLine(Pen1, i, 10, i, 150)
Next
End Sub
Private Sub Exit1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Exit1.Click
End
End Sub
End Class
انواع این خطوط رو میشه ترسیم کرد