Re: Problems with PictureBox
- From: "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
- Date: Fri, 6 Jan 2006 10:48:25 -0500
First off, your system clock seems to be off... I see your post date as
January 1, 2006 when today is actually January 6th.
Now, for the standard reply to .NET questions....
Almost everybody in this newsgroup is using VB6 or lower. While you may get
a stray answer to VB.NET (including VB2003 and VB2005 which has dropped .NET
from its name) questions here, you should ask them in newsgroups devoted
exclusively to .NET programming (the languages are different enough to
warrant separate newsgroup support). Look for newsgroups with either the
word "dotnet" or "vsnet" in their name.
For the microsoft news server, try these newsgroups for Visual Basic .NET
related questions...
microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data
And these for more general .NET questions
microsoft.public.dotnet.general
microsoft.public.vsnet.general
Note: There are many other .NET newgroups (use the first three "fields" from
the last two as templates when searching for them), but the above ones
should get you started.
Rick
"tan" <tdh0@xxxxxxx> wrote in message
news:dp9aur$fmo$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi all,
> I have a problem with PictureBox.Sav in the following code.
> After loading Bitmap image, tracing a line on it and Save ; the line
> disappeared in the new image !
> Please help !
> Tony.
>
> VB.NET
> -------------------------
> Imports System.IO
> Imports System.Drawing.Drawing2D
>
> 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 Button1 As System.Windows.Forms.Button
> Friend WithEvents Button2 As System.Windows.Forms.Button
> Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
> Friend WithEvents OpenFileDialog1 As
System.Windows.Forms.OpenFileDialog
> Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
> Friend WithEvents Button3 As System.Windows.Forms.Button
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
> InitializeComponent()
> Me.Button1 = New System.Windows.Forms.Button
> Me.Button2 = New System.Windows.Forms.Button
> Me.TextBox1 = New System.Windows.Forms.TextBox
> Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
> Me.PictureBox1 = New System.Windows.Forms.PictureBox
> Me.Button3 = New System.Windows.Forms.Button
> Me.SuspendLayout()
> '
> 'Button1
> '
> Me.Button1.Location = New System.Drawing.Point(16, 8)
> Me.Button1.Name = "Button1"
> Me.Button1.Size = New System.Drawing.Size(64, 24)
> Me.Button1.TabIndex = 0
> Me.Button1.Text = "Save"
> '
> 'Button2
> '
> Me.Button2.Location = New System.Drawing.Point(16, 360)
> Me.Button2.Name = "Button2"
> Me.Button2.Size = New System.Drawing.Size(64, 24)
> Me.Button2.TabIndex = 1
> Me.Button2.Text = "Exit"
> '
> 'TextBox1
> '
> Me.TextBox1.AcceptsReturn = True
> Me.TextBox1.Location = New System.Drawing.Point(232, 8)
> Me.TextBox1.Name = "TextBox1"
> Me.TextBox1.Size = New System.Drawing.Size(224, 20)
> Me.TextBox1.TabIndex = 2
> Me.TextBox1.Text = "Img"
> '
> 'PictureBox1
> '
> Me.PictureBox1.BorderStyle =
> System.Windows.Forms.BorderStyle.FixedSingle
> Me.PictureBox1.Location = New System.Drawing.Point(16, 40)
> Me.PictureBox1.Name = "PictureBox1"
> Me.PictureBox1.Size = New System.Drawing.Size(496, 312)
> Me.PictureBox1.TabIndex = 7
> Me.PictureBox1.TabStop = False
> '
> 'Button3
> '
> Me.Button3.Location = New System.Drawing.Point(88, 8)
> Me.Button3.Name = "Button3"
> Me.Button3.Size = New System.Drawing.Size(64, 24)
> Me.Button3.TabIndex = 8
> Me.Button3.Text = "Load"
> '
> 'Form1
> '
> Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
> Me.ClientSize = New System.Drawing.Size(536, 403)
> Me.Controls.Add(Me.Button3)
> Me.Controls.Add(Me.PictureBox1)
> Me.Controls.Add(Me.TextBox1)
> Me.Controls.Add(Me.Button2)
> Me.Controls.Add(Me.Button1)
> Me.Name = "Form1"
> Me.Text = "Form1"
> Me.ResumeLayout(False)
>
> End Sub
>
> #End Region
>
> Private Sub Button1_Click(ByVal sender As System.Object, _
> ByVal e As System.EventArgs) Handles Button1.Click
>
> Dim bild As New Bitmap(TextBox1.Text)
> Dim sPathWithoutExt As String
> Dim sPath As String
>
> Dim gr As Graphics = PictureBox1.CreateGraphics
> gr.DrawImage(bild, 60, 60)
> gr.SmoothingMode = SmoothingMode.AntiAlias
>
> Dim m_Pen As New Pen(Color.Red, 2)
> PictureBox1.CreateGraphics.DrawLine(m_Pen, 10, 5, 20, 30)
>
> sPathWithoutExt = _
> TextBox1.Text.Substring(0, TextBox1.Text.LastIndexOf("."))
> sPath = _
> TextBox1.Text.Substring(0, TextBox1.Text.LastIndexOf("\"))
>
> PictureBox1.Image.Save(sPathWithoutExt & ".jpg",
> Drawing.Imaging.ImageFormat.Jpeg)
>
>
> End Sub
>
> Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button3.Click
> With OpenFileDialog1
> .InitialDirectory = "c:\"
> .Filter = "Bitmap (*.bmp)|*.bmp"
> .RestoreDirectory = True
>
> If .ShowDialog() = DialogResult.OK Then
> TextBox1.Text = .FileName
> PictureBox1.Image = _
> System.Drawing.Image.FromFile(TextBox1.Text)
> End If
> End With
> End Sub
>
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button2.Click
> Me.Close()
> End Sub
> End Class
>
>
.
- Prev by Date: Coral Command Button for VB 6.0 (Visual Basic)
- Next by Date: pixel analysis (colors per by percentage)
- Previous by thread: Coral Command Button for VB 6.0 (Visual Basic)
- Next by thread: pixel analysis (colors per by percentage)
- Index(es):