473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Draw Line in a specific picturebox

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
1 2537
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dennis | last post by:
Hello, Ive to draw a line on a picture i used this code: Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) x1 = z.X y1 = z.Y lbl3 = "x1: " & x1 lbl4...
2
by: utkuozan | last post by:
I am currently placing a "+" sign on a picture previously loaded in a PictureBox by coding these below in an OnMouseDown event. System.Drawing.Graphics formGraphics = PictureBox.CreateGraphics (...
2
by: John | last post by:
I created a number of pictureboxes in a panel, and want to draw lines in those pictureboxes but I cannot. Please see the following code and make corrections. Thanks. Private Sub...
18
by: Ed Bitzer | last post by:
Can draw a line on my form with a button click event but cannot upon the Load event when I wish. No more line object so used the following: Dim bit As Bitmap = New Bitmap(Me.Width, Me.Height) Dim...
0
by: Ben3eeE | last post by:
Im having trouble making a Paint.exe straight line draw. You know the one where you point out where to start then hold down the mouse button and release it to finish the drawing. My problem is...
5
by: lgeastwood | last post by:
I have tweaked the PictureBox97.mdb (Stephen Lebans <www.lebans.com>) code to nicely draw lines, rectangles and circles to the specs that I input. I'm at a loss though with trying to setup an...
2
by: Overseer | last post by:
What is the best way to draw graphics like Task Manager's Performance Graphic??
0
by: Niu Kun | last post by:
Dear all, I'm planning to draw some overlapped pictures on a tabpage. I use PictureBox control. And the picture seems well at first. But when I try to draw a PictureBox on the other. The...
0
by: kam45 | last post by:
I did one program that draws a line with two squares at the ends and I can just click and extend each ends. It works ok but I need to move the whole line. Would anyone knows how? Private Const...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.