How To Show a PictureBox in my Own Class

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

my Problem is to Show a Form Without a BorderStyle. Bu
this is not possible in Compact Framework
So i got a idea

A Class that Shows a Picturebox, but it dont work this is my Code

Public Class clsBa
Private WithEvents tTimer As New System.Windows.Forms.Time

Private bBitMap As New Bitmap(100, 100
Private gGraphics As Graphics = gGraphics.FromImage(bBitMap
Private bGreenBrush As SolidBrush = New SolidBrush(Color.Green
Private bSilverBrush As SolidBrush = New SolidBrush(Color.Silver

Private pPictureBox As New System.Windows.Forms.PictureBo

Sub StartTimer(
tTimer.Interval = 100
tTimer.Enabled = Tru
End Su

Private Sub tTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tTimer.Tic
Show(
End Su

Public Sub Show(
'gGraphics.FromImage(bBitMap
gGraphics.FillRectangle(bGreenBrush, 1, 1, 50, 50

pPictureBox.Left =
pPictureBox.Width = 10
pPictureBox.Top =
pPictureBox.Height = 10
pPictureBox.Image = bBitMa
pPictureBox.Show(
End Su
End Clas

What do i wrong?

Plz Help
 
Don't forget to add a PictureBox to your control's collection:

Me.Controls.Add(pPictureBox)

--
Alex Yakhnin .NET CF MVP
www.intelliprog.com | www.opennetcf.org

DocDeath said:
Hi,

my Problem is to Show a Form Without a BorderStyle. But
this is not possible in Compact Framework.
So i got a idea:

A Class that Shows a Picturebox, but it dont work this is my Code:

Public Class clsBar
Private WithEvents tTimer As New System.Windows.Forms.Timer

Private bBitMap As New Bitmap(100, 100)
Private gGraphics As Graphics = gGraphics.FromImage(bBitMap)
Private bGreenBrush As SolidBrush = New SolidBrush(Color.Green)
Private bSilverBrush As SolidBrush = New SolidBrush(Color.Silver)

Private pPictureBox As New System.Windows.Forms.PictureBox

Sub StartTimer()
tTimer.Interval = 1000
tTimer.Enabled = True
End Sub

Private Sub tTimer_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tTimer.Tick
 
Where must i Add my Control? in the Class Or in My MainForm?

Plz Help me again, it dont works.

Thx
 
Back
Top