|
-
Jan 11th, 2003, 08:38 PM
#1
Thread Starter
Junior Member
How do I import an image
How do I import an image? I want to make a simple slide show Application. It would have the normal buttons and scroll thru family photos.
Do I have to DIM the image before I can make it show up when the button is clicked? And it has to be imported some how to the Application ………. is that Correct?
I know it is simple for most out there and maybe someone has one they could let me learn from or some code you can send me.
Sorry I am very new at this.
-
Jan 11th, 2003, 09:15 PM
#2
Hyperactive Member
You could just store the images in a bitmap then display them.
Dim myBmp as New BitMap("c:\images\myimg.bmp")
depending on where you want to display them is where you would copy them, if you want to display them on the main form, just do
Dim myBmp as New BitMap("c:\images\myimg.bmp")
Dim G as Graphics = Me.CreateGraphics
G.DrawImage(myBmp, 0 0)
Hope that helps..
-
Jan 11th, 2003, 09:50 PM
#3
Last edited by MrPolite; Jan 11th, 2003 at 09:54 PM.
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jan 11th, 2003, 10:33 PM
#4
yay gay
myPic.Image = Image.FromFile("C:\...")
i dont remember if it is myPic.Image or myPic.Picture sorry
\m/  \m/
-
Jan 11th, 2003, 11:18 PM
#5
Thread Starter
Junior Member
Ok here is what i have
===========================
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 ImageList1 As System.Windows.Forms.ImageList
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
'
'ImageList1
'
Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(552, 266)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
#End Region
Private Sub
TextArea_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles TextArea.Paint
Dim myBmp As New Bitmap("C:\Documents and Settings\ROBERT\My Documents\My Pictures/car.jpg")
Dim G As Graphics = Me.CreateGraphics
G.DrawImage()("myBmp, 0 ")
'End Sub
End Class
===========================
Error I get
Identifier expected.
==================
Something Is Wrong !
-
Jan 12th, 2003, 12:13 AM
#6
Hyperactive Member
TextArea_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles TextArea.Paint
Dim myBmp As New Bitmap("C:\Documents and Settings\ROBERT\My Documents\My Pictures\car.jpg")
Dim G As Graphics = Me.CreateGraphics
G.DrawImage(myBmp, 0, 0)
Try That
-
Jan 12th, 2003, 01:17 PM
#7
Thread Starter
Junior Member
Here is the error i am getting now the code in blue at the bottom is where the Swigglly line is
=======================
C:\Projects\WindowsApplication6\Form1.vb(46): Handles clause requires a WithEvents variable.
================================
HERE IS THE CODE
====================
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.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
#End Region
Private Sub TextArea_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles TextArea .Paint
Dim myBmp As New Bitmap("C:\Documents and Settings\ROBERT\My Documents\My Pictures\car.jpg")
Dim G As Graphics = Me.CreateGraphics
G.DrawImage(myBmp, 0, 0)
End Sub
End Class
-
Jan 12th, 2003, 01:45 PM
#8
yay gay
for a class support events u must put withevents instead of dim on the var that will instantiate that...i dont do vb.net a while ago so i cant see where it is but i think that that is what the error is saying about..
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|