|
-
May 6th, 2007, 01:01 PM
#1
Thread Starter
New Member
[RESOLVED] picturebox,how to load an image?
hi,
picturebox,how to load an image?
in windows application, i can use picturebox.imagelocation method and write the address of the image...but i can't use this method in mobile application...so how?
help me expert!! i'm new..plis
-
May 7th, 2007, 12:57 AM
#2
Addicted Member
Re: picturebox,how to load an image?
Code:
Public Class frmMain
Inherits System.Windows.Forms.Form
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Private m_Bmp() As Bitmap
Private m_bmpOff As Bitmap
Private appPath As String
#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
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
'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 pct As System.Windows.Forms.PictureBox
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))
Me.pct = New System.Windows.Forms.PictureBox
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.MenuItem3 = New System.Windows.Forms.MenuItem
Me.ImageList1 = New System.Windows.Forms.ImageList
'
'pct
'
Me.pct.Image = CType(resources.GetObject("pct.Image"), System.Drawing.Image)
Me.pct.Location = New System.Drawing.Point(8, 16)
Me.pct.Size = New System.Drawing.Size(224, 240)
Me.pct.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
'
'MainMenu1
'
Me.MainMenu1.MenuItems.Add(Me.MenuItem1)
Me.MainMenu1.MenuItems.Add(Me.MenuItem2)
Me.MainMenu1.MenuItems.Add(Me.MenuItem3)
'
'MenuItem1
'
Me.MenuItem1.Text = "Login"
'
'MenuItem2
'
Me.MenuItem2.Text = "About"
'
'MenuItem3
'
Me.MenuItem3.Text = "Keluar"
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
'
'frmMain
'
Me.Controls.Add(Me.pct)
Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular)
Me.Menu = Me.MainMenu1
Me.Text = "Selamat Datang"
End Sub
#End Region
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Dim fabout As New frmAbout
fabout.ShowDialog()
End Sub
Public Sub LoadBmp(ByVal bmpName As String, ByVal i As Integer)
' Try to Load the Bitmap
Try
m_Bmp(i) = New Bitmap(appPath + bmpName)
Catch
' Any error ? Create a bitmap
m_Bmp(i) = New Bitmap(Me.Width, Height)
'Graphics.FromImage(m_Bmp(i)).FillRectangle(New SolidBrush(Me.BackColor), New Rectangle(0, 0, Width - 1, Height - 1))
'Graphics.FromImage(m_Bmp(i)).DrawLine(New Pen(Color.Red), 0, 0, Width - 1, Height - 1)
'Graphics.FromImage(m_Bmp(i)).DrawLine(New Pen(Color.Red), Width - 1, 0, 0, Height - 1)
End Try
End Sub
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strAssmPath As String = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase
appPath = strAssmPath.Substring(0, strAssmPath.LastIndexOf("\") + 1)
ReDim m_Bmp(1)
LoadBmp("parfum.bmp", 0)
LoadBmp("Bliss.bmp", 1)
pct.Image = m_Bmp(0)
End Sub
End Class
-
May 7th, 2007, 02:01 AM
#3
Thread Starter
New Member
Re: picturebox,how to load an image?
thnx suf
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
|