Draw Line in a specific picturebox

A

Alejandro

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:\diente40x40.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
 
G

GhostInAK

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top