<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2F2D%2FLine</id>
		<title>VB.Net/2D/Line - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2F2D%2FLine"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/2D/Line&amp;action=history"/>
		<updated>2026-04-05T00:25:07Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/2D/Line&amp;diff=68&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/2D/Line&amp;diff=68&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/2D/Line&amp;diff=69&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/2D/Line&amp;diff=69&amp;oldid=prev"/>
				<updated>2010-05-26T12:41:42Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Draw Colorful Line and Dash Line==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Drawing.Text&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Shared Sub Main()&lt;br /&gt;
        Dim myform As Form = New FrmDrawShapes()&lt;br /&gt;
        Application.Run(myform)&lt;br /&gt;
   End Sub &amp;quot; Main&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
Public Class FrmDrawShapes&lt;br /&gt;
   Inherits System.Windows.Forms.Form&lt;br /&gt;
#Region &amp;quot; Windows Form Designer generated code &amp;quot;&lt;br /&gt;
   Public Sub New()&lt;br /&gt;
      MyBase.New()&lt;br /&gt;
      &amp;quot;This call is required by the Windows Form Designer.&lt;br /&gt;
      InitializeComponent()&lt;br /&gt;
      &amp;quot;Add any initialization after the InitializeComponent() call&lt;br /&gt;
   End Sub&lt;br /&gt;
   &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
      If disposing Then&lt;br /&gt;
         If Not (components Is Nothing) Then&lt;br /&gt;
            components.Dispose()&lt;br /&gt;
         End If&lt;br /&gt;
      End If&lt;br /&gt;
      MyBase.Dispose(disposing)&lt;br /&gt;
   End Sub&lt;br /&gt;
   &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
   Private components As System.ruponentModel.Container&lt;br /&gt;
   &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
   &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
   &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
   &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;frmDrawShapes&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
      Me.ClientSize = New System.Drawing.Size(520, 197)&lt;br /&gt;
      Me.Name = &amp;quot;frmDrawShapes&amp;quot;&lt;br /&gt;
      Me.Text = &amp;quot;Drawing Shapes&amp;quot;&lt;br /&gt;
   End Sub&lt;br /&gt;
#End Region&lt;br /&gt;
   &amp;quot; draw various shapes on form&lt;br /&gt;
   Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)&lt;br /&gt;
      Dim graphicsObject As Graphics = e.Graphics&lt;br /&gt;
      &amp;quot; bitmap texture&lt;br /&gt;
      Dim textureBitmap As Bitmap = New Bitmap(10, 10)&lt;br /&gt;
      Dim graphicsObject2 As Graphics = _&lt;br /&gt;
         Graphics.FromImage(textureBitmap) &amp;quot; get bitmap graphics&lt;br /&gt;
      &amp;quot; brush and pen used throughout program&lt;br /&gt;
      Dim solidColorBrush As SolidBrush = _&lt;br /&gt;
         New SolidBrush(Color.Red)&lt;br /&gt;
      Dim coloredPen As Pen = New Pen(solidColorBrush)&lt;br /&gt;
      &amp;quot; draw pie-shaped arc in white&lt;br /&gt;
      coloredPen.Color = Color.White&lt;br /&gt;
      coloredPen.Width = 6&lt;br /&gt;
      graphicsObject.DrawPie(coloredPen, 240, 30, 75, 100, 0, 270)&lt;br /&gt;
      &amp;quot; draw lines in green and yellow&lt;br /&gt;
      coloredPen.Color = Color.Green&lt;br /&gt;
      coloredPen.Width = 5&lt;br /&gt;
      graphicsObject.DrawLine(coloredPen, 395, 30, 320, 150)&lt;br /&gt;
      &amp;quot; draw a rounded, dashed yellow line&lt;br /&gt;
      coloredPen.Color = Color.Yellow&lt;br /&gt;
      coloredPen.DashCap = LineCap.Round&lt;br /&gt;
      coloredPen.DashStyle = DashStyle.Dash&lt;br /&gt;
      graphicsObject.DrawLine(coloredPen, 320, 30, 395, 150)&lt;br /&gt;
   End Sub &amp;quot; OnPaint&lt;br /&gt;
End Class &lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Draw lines to connect rectangles==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Drawing.Text&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Shared Sub Main()&lt;br /&gt;
        Dim myform As Form = New FrmDrawing()&lt;br /&gt;
        Application.Run(myform)&lt;br /&gt;
   End Sub &amp;quot; Main&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
Public Class FrmDrawing&lt;br /&gt;
   Inherits System.Windows.Forms.Form&lt;br /&gt;
#Region &amp;quot; Windows Form Designer generated code &amp;quot;&lt;br /&gt;
   Public Sub New()&lt;br /&gt;
      MyBase.New()&lt;br /&gt;
      &amp;quot;This call is required by the Windows Form Designer.&lt;br /&gt;
      InitializeComponent()&lt;br /&gt;
      &amp;quot;Add any initialization after the InitializeComponent() call&lt;br /&gt;
   End Sub&lt;br /&gt;
   &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
      If disposing Then&lt;br /&gt;
         If Not (components Is Nothing) Then&lt;br /&gt;
            components.Dispose()&lt;br /&gt;
         End If&lt;br /&gt;
      End If&lt;br /&gt;
      MyBase.Dispose(disposing)&lt;br /&gt;
   End Sub&lt;br /&gt;
   &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
   Private components As System.ruponentModel.Container&lt;br /&gt;
   &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
   &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
   &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
   &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;frmDrawing&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
      Me.BackColor = System.Drawing.SystemColors.AppWorkspace&lt;br /&gt;
      Me.ClientSize = New System.Drawing.Size(472, 157)&lt;br /&gt;
      Me.Name = &amp;quot;frmDrawing&amp;quot;&lt;br /&gt;
      Me.Text = &amp;quot;Drawing lines, rectangles and ovals&amp;quot;&lt;br /&gt;
   End Sub&lt;br /&gt;
#End Region&lt;br /&gt;
   &amp;quot; display ovals lines, and rectangles&lt;br /&gt;
   Protected Overrides Sub OnPaint( _&lt;br /&gt;
      ByVal paintEvent As PaintEventArgs)&lt;br /&gt;
      &amp;quot; get graphics object&lt;br /&gt;
      Dim g As Graphics = paintEvent.Graphics&lt;br /&gt;
      Dim brush As SolidBrush = New SolidBrush(Color.Blue)&lt;br /&gt;
      Dim pen As Pen = New Pen(Color.AliceBlue)&lt;br /&gt;
      &amp;quot; draw lines to connect rectangles&lt;br /&gt;
      g.DrawLine(pen, 90, 30, 110, 40)&lt;br /&gt;
      g.DrawLine(pen, 90, 120, 110, 130)&lt;br /&gt;
      g.DrawLine(pen, 240, 30, 260, 40)&lt;br /&gt;
      g.DrawLine(pen, 240, 120, 260, 130)&lt;br /&gt;
&lt;br /&gt;
      &amp;quot; draw top rectangle&lt;br /&gt;
      g.DrawRectangle(pen, 110, 40, 150, 90)&lt;br /&gt;
   End Sub &amp;quot; OnPaint&lt;br /&gt;
End Class &amp;quot; FrmDrawing&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Paint Lines==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Printing&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Class MyFirstForm&lt;br /&gt;
    Inherits Form&lt;br /&gt;
&lt;br /&gt;
    Public Sub Draw(ByVal g As Graphics)&lt;br /&gt;
        g.SmoothingMode = SmoothingMode.AntiAlias&lt;br /&gt;
        Dim rect As Rectangle = Me.ClientRectangle&lt;br /&gt;
        Dim cx As Integer = rect.Width&lt;br /&gt;
        Dim cy As Integer = rect.Height&lt;br /&gt;
        Dim scale As Single = CSng(cy) / CSng(cx)&lt;br /&gt;
        Dim _brush As LinearGradientBrush = New LinearGradientBrush(Me.ClientRectangle, Color.Empty, Color.Empty, 45)&lt;br /&gt;
        Dim blend As ColorBlend = New ColorBlend()&lt;br /&gt;
        blend.Colors = New Color() {Color.Red, Color.Green, Color.Blue}&lt;br /&gt;
        blend.Positions = New Single() {0.0, 0.5, 1.0}&lt;br /&gt;
        _brush.InterpolationColors = blend&lt;br /&gt;
        Dim _pen As Pen = New Pen(_brush)&lt;br /&gt;
        Dim x As Integer&lt;br /&gt;
        For x = 0 To cx Step 7&lt;br /&gt;
            g.DrawLine(_pen, 0, x * scale, cx - x, 0)&lt;br /&gt;
            g.DrawLine(_pen, 0, (cx - x) * scale, cx - x, cx * scale)&lt;br /&gt;
            g.DrawLine(_pen, cx - x, 0 * scale, cx, (cx - x) * scale)&lt;br /&gt;
            g.DrawLine(_pen, cx - x, cx * scale, cx, x * scale)&lt;br /&gt;
        Next&lt;br /&gt;
        Dim format As StringFormat = New StringFormat()&lt;br /&gt;
        format.Alignment = StringAlignment.Center&lt;br /&gt;
        format.LineAlignment = StringAlignment.Center&lt;br /&gt;
        Dim s As String = &amp;quot;Ain&amp;quot;t graphics cool?&amp;quot;&lt;br /&gt;
        g.DrawString(s, Me.Font, _brush, rect.X, rect.Y, format)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub MyPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint&lt;br /&gt;
        Dim g As Graphics = e.Graphics&lt;br /&gt;
        Draw(g)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        Dim myform As Form = New MyFirstForm()&lt;br /&gt;
        Application.Run(myform)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Use Texture Brush to Draw a Line==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Drawing.Text&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
  Shared Sub Main()&lt;br /&gt;
     Dim form1 As Form1 = new Form1&lt;br /&gt;
     Application.Run(form1)&lt;br /&gt;
  End Sub&lt;br /&gt;
  &lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Public Class Form1&lt;br /&gt;
  Inherits System.Windows.Forms.Form&lt;br /&gt;
#Region &amp;quot; Windows Form Designer generated code &amp;quot;&lt;br /&gt;
  Public Sub New()&lt;br /&gt;
    MyBase.New()&lt;br /&gt;
    &amp;quot;This call is required by the Windows Form Designer.&lt;br /&gt;
    InitializeComponent()&lt;br /&gt;
    &amp;quot;Add any initialization after the InitializeComponent() call&lt;br /&gt;
  End Sub&lt;br /&gt;
  &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
    If disposing Then&lt;br /&gt;
      If Not (components Is Nothing) Then&lt;br /&gt;
        components.Dispose()&lt;br /&gt;
      End If&lt;br /&gt;
    End If&lt;br /&gt;
    MyBase.Dispose(disposing)&lt;br /&gt;
  End Sub&lt;br /&gt;
  &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
  Private components As System.ruponentModel.IContainer&lt;br /&gt;
  &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
  &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
  &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
  &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
    Me.SuspendLayout()&lt;br /&gt;
    &amp;quot;&lt;br /&gt;
    &amp;quot;Form1&lt;br /&gt;
    &amp;quot;&lt;br /&gt;
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
    Me.ClientSize = New System.Drawing.Size(392, 213)&lt;br /&gt;
    Me.Controls.AddRange(New System.Windows.Forms.Control() {})&lt;br /&gt;
    Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
    Me.Text = &amp;quot;Form1&amp;quot;&lt;br /&gt;
    Me.ResumeLayout(False)&lt;br /&gt;
  End Sub&lt;br /&gt;
#End Region&lt;br /&gt;
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
  End Sub&lt;br /&gt;
  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)&lt;br /&gt;
    Dim G As Graphics = e.Graphics&lt;br /&gt;
    Dim P1 As Pen = New Pen(Color.Blue, 10)&lt;br /&gt;
    &amp;quot;pentype&lt;br /&gt;
    Dim P3 As Pen = New Pen(Color.Blue, 10)&lt;br /&gt;
    P3.Brush = New TextureBrush(New Bitmap(&amp;quot;figure2.bmp&amp;quot;))&lt;br /&gt;
    G.DrawLine(P3, 20, CInt(Me.Height / 2), Me.Width - 20, CInt(Me.Height / 2))&lt;br /&gt;
  End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>