Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Collections.Generic
- Imports System.ComponentModel
- Imports System.Drawing
- Imports System.Data
- Imports System.Linq
- Imports System.Text
- Imports System.Windows.Forms
- Partial Public Class ImagePanel
- Inherits Panel
- Private imgUrl As [String] = ""
- Private title As [String] = ""
- Private pict As PictureBox = Nothing
- Private label1 As Label = Nothing
- Public Sub New()
- MyBase.New()
- InitializeComponent()
- End Sub
- Public Sub New(img As [String], title As [String])
- MyBase.New()
- imgUrl = img
- Me.title = title
- Me.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
- Me.Name = "panel2"
- Me.Size = New System.Drawing.Size(108, 108)
- ' pictureBox
- Me.pict = New PictureBox()
- Me.pict.Image = New Bitmap(img)
- Me.pict.Location = New System.Drawing.Point(4, 4)
- Me.pict.Size = New System.Drawing.Size(100, 100)
- Me.pict.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
- Me.pict.BringToFront()
- '' label
- 'Me.label1 = New Label()
- 'Me.label1.AutoSize = True
- 'Me.label1.Location = New System.Drawing.Point(4, 99)
- 'Me.label1.Size = New System.Drawing.Size(131, 13)
- 'Me.label1.Text = title
- 'Me.Controls.Add(Me.label1)
- AddHandler Me.pict.Click, AddressOf picture_click
- AddHandler Me.Click, AddressOf Picture_Click
- InitializeComponent()
- End Sub
- Public Property Selected As Boolean
- Private Sub Picture_Click(sender As Object, e As EventArgs)
- 'Me.Selected = Not Me.Selected
- 'If Selected Then
- ' Me.BackColor = Color.LightBlue
- 'Else
- ' Me.BackColor = Color.Transparent
- 'End If
- End Sub
- Public Sub setImageURL(url As [String])
- Me.imgUrl = url
- Me.pict.Image = New Bitmap(url)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment