netrosly

CrunchyRollItem - GDI

Feb 1st, 2015
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.35 KB | None | 0 0
  1. 'Random Controls: CrunchyRollItem
  2. 'By Nettro ;P
  3. ' Tip: you must use the refresh boolean to show or change the image <- this feature was to stop the lag -> if you know vb.net and gdi you can easily change it so it "downloads" the image instead of using a picturebox.
  4. Imports System.ComponentModel
  5. Imports System.IO
  6.  
  7. Public Class CrunchyRollItems
  8.     Inherits Panel
  9.     Public picturebx As New PictureBox
  10.     Public Property useonlineimage As Boolean = False
  11.     Public Property Image As Image
  12.     Public Property URLImage As String
  13.     Property refresh2 As Boolean = False
  14.     Sub New()
  15.         Me.Size = New Size(150, 135)
  16.  
  17.     End Sub
  18.     Property Texxt As String = "Baku Baku - Episode 10"
  19.     Private Sub CrunchyRollItems_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
  20.  
  21.         e.Graphics.DrawRectangle(New Pen(Color.FromArgb(227, 227, 227)), New Rectangle(1, 1, Me.Width - 3, Me.Height - 3)) '227, 227, 227
  22.         e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(2, 2, Me.Width - 4, Me.Height - 4))
  23.         e.Graphics.DrawLine(New Pen(Color.FromArgb(206, 206, 206)), New Point(2, Me.Height - 3), New Point(Me.Width - 4, Me.Height - 3))
  24.         e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(234, 234, 234)), New Rectangle(10, Me.Height / 2 + 16, Me.Width - 20, 4))
  25.         e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(234, 234, 234)), New Rectangle(10, 10, Me.Width - 20, Me.Height / 2 + 10 - 10))
  26.         picturebx.SizeMode = PictureBoxSizeMode.StretchImage
  27.         picturebx.Location = New Point(11, 11)
  28.         picturebx.Size = New Size(Me.Width - 22, Me.Height / 2 + 10 - 11)
  29.         If refresh2 = False Then
  30.             For Each pic As PictureBox In Me.Controls.OfType(Of PictureBox)()
  31.                 pic.Dispose()
  32.             Next
  33.             If useonlineimage = False Then
  34.                 picturebx.Image = Image
  35.             Else
  36.                 picturebx.LoadAsync(URLImage)
  37.             End If
  38.             Controls.Add(picturebx)
  39.             refresh2 = True
  40.         End If
  41.         e.Graphics.DrawString(Texxt, New Font("arial", 9, FontStyle.Regular), New SolidBrush(Color.DarkGray), New Rectangle(8, Me.Height / 2 + 20, Me.Width - 15, Me.Height / 2 - 10), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  42.     End Sub
  43. End Class
Advertisement
Add Comment
Please, Sign In to add comment