By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,182 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,182 IT Pros & Developers. It's quick & easy.

Draw Line in a specific picturebox

P: n/a
Hi,

I Have a form with Collection of 52 picturebox.

Public cl As New Collection
Private m_Bitmap As Bitmap

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim i As Int32

For i = 1 To 52
m_Bitmap = New
Bitmap(System.Drawing.Image.FromFile("C:\diente40x 40.bmp"))
cl.Add(m_Bitmap, i.ToString())
Next i

End Sub

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

Dim posx As Integer = 0
Dim posy As Integer = 0
For i As Integer = 1 To 52

e.Graphics.DrawImage(cl(i), posx, posy)
posy = posy + 20
posx = posx + 40

Next
End Sub

I need draw a line in a specific picturebox, for example:

In a combobox select 25, then draw a line in a bitmap 25, how make
this??

tks 4 ur help

Aug 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello Alejandro,

I think if it were me, given the code you have just posted.. I would maintain
an array of 52 bytes. These bytes would contain either a 0 or a 1. On your
loop through the bitmap collection in your form paint event check the index
of the byte array. If 0, do nothing, if 1, draw a line. You already know
the coordinates of the bitmap, so drawing the line is trivial.

-Boo
Hi,

I Have a form with Collection of 52 picturebox.

Public cl As New Collection
Private m_Bitmap As Bitmap
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim i As Int32

For i = 1 To 52
m_Bitmap = New
Bitmap(System.Drawing.Image.FromFile("C:\diente40x 40.bmp"))
cl.Add(m_Bitmap, i.ToString())
Next i
End Sub

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

Dim posx As Integer = 0
Dim posy As Integer = 0
For i As Integer = 1 To 52
e.Graphics.DrawImage(cl(i), posx, posy)
posy = posy + 20
posx = posx + 40
Next
End Sub
I need draw a line in a specific picturebox, for example:

In a combobox select 25, then draw a line in a bitmap 25, how make
this??

tks 4 ur help

Aug 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.