473,722 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Dim i As Int32

For i = 1 To 52
m_Bitmap = New
Bitmap(System.D rawing.Image.Fr omFile("C:\dien te40x40.bmp"))
cl.Add(m_Bitmap , i.ToString())
Next i

End Sub

Private Sub Form1_Paint(ByV al sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles MyBase.Paint

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

e.Graphics.Draw Image(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 2570
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(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Dim i As Int32

For i = 1 To 52
m_Bitmap = New
Bitmap(System.D rawing.Image.Fr omFile("C:\dien te40x40.bmp"))
cl.Add(m_Bitmap , i.ToString())
Next i
End Sub

Private Sub Form1_Paint(ByV al sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles MyBase.Paint

Dim posx As Integer = 0
Dim posy As Integer = 0
For i As Integer = 1 To 52
e.Graphics.Draw Image(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
9704
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 = "y1: " & y1
2
1800
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 ( ); string drawString = "+"; System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16); System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); float x = e.X - 10; float y = e.Y - 10;
2
3052
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 Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Panel1.AutoScroll = True Panel1.Width = 200 Panel1.Height = 200
18
8567
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 g As Graphics = Graphics.FromImage(bit) Dim myPen As Pen = New Pen(Color.Blue, 1) Me.CreateGraphics.DrawLine(myPen, 0, 5, Me.Width, 5) Appreciate some help. Ed
0
1218
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 that if i move the mouse back the line should move back with it and if i spin the mouse the line should spin and dont draw anything before i release the button. im using Microsoft visual stuido.net 2003
5
9241
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 Ellipse Drawing Function. The following code I found on Google works in VB5 and draws an ellipse shape no problem using the Circle Method. Private Sub cmdDrawEllipse_Click() Dim X As Long, Y As Long Dim ElipseWidth As Integer, ElipseHeight As...
2
4224
by: Overseer | last post by:
What is the best way to draw graphics like Task Manager's Performance Graphic??
0
1531
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 transparent part of the PictureBox seems to have the same colour with the tabpage background. And the PictureBox under it is covered by that. The covered part is never seen again. Can I simply solve the problem with existing simple control?
0
1382
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 gs As Integer = 34 Private Const hw As Integer = 6 Private Const hhw As Integer = hw \ 2 Private bf As Bitmap Private drag As Integer = -1 Private pts() As Point Private Sub Form1_Load(ByVal sender As System.Object,...
0
8863
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9384
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.