473,657 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drawing Lines In VB 2005

32 New Member
Iv got a panel on the main form which is set to auto scroll. In the panel there is a picture box that i draw lines in. the lines work perfectly fine until the scroll bar comes up. The picture box expands in the scrollable panel but the program wont allow the lines to continuing drawing(vb 2005)

here's the coding
[coding]
Public Class Form1

Dim DrawGraphics As Graphics
Dim DrawBitmap As Bitmap

Dim y2 As Integer
Dim x2 As Integer = 10
Dim y1 As Integer = 0
Dim x1 As Integer = 0
Dim score As Integer
Dim avg As New ListBox

Private Sub btnenter_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnenter.Click
'picgra.Width = x2 + 25
' the value of the score on the grapgh is y2

picgra.Width = x2 + 30
y2 = System.Convert. ToInt64(txtscor e.Text)
x2 = x1 + 10
y2 = y2 * 2
avg.Items.Add(s core)
DrawGraphics.Dr awLine(Pens.Lig htGreen, x1, y1, x2, y2)
picgra.Image = DrawBitmap
y1 = y2
x1 = x2
Me.Text = x2



End Sub

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
'lblsize.Width = pnl1.Width
'picgra.Width = pnl1.Width
tmrdraw.Start()
tmrdraw.Interva l = 1
DrawBitmap = New Bitmap(picgra.W idth, picgra.Height)
DrawGraphics = Graphics.FromIm age(DrawBitmap)
picgra.Image = DrawBitmap

End Sub


Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
picgra.Width = 600
' DrawGraphics.Dr awLine(Pens.Lig htGreen, 0, 0, 600, 150)
'picgra.Image = DrawBitmap
End Sub
End Class
[/code]
if you have any idea on how i could fix it please post and i dont want to resort to having to import seperate programs into vb
Oct 29 '08 #1
0 1116

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2424
by: T. F. | last post by:
Hi, I need to create a box / field that the user can draw into (with some kind of pen). I also need to know how I can edit the size of the pen style and how I can "transport" the drawn image into a smaller box (that is only around 10x10 pixel so the original image must be comprimized onto that 10x10 pixel field..) and how to center it. ( if you guess that this is about neural networks you're right :) )
2
12327
by: Champika Nirosh | last post by:
Hi, I want to create drawing board application that can draw Line, rectagle, circle and free hand drawing. Each drawing need to be transparent, moveable (draggable), have bring to front and send to back feature etc. How can I do this .. where should I start?
6
1491
by: iwdu15 | last post by:
hi, this is a n00b question but when i draw on a panel in my form using GDI and a pen, but when i minimize the form, or put anything in front of the item in drawing on, the graphics go away. how can i fix this? -- -iwdu15
2
2229
by: George | last post by:
Dear colleagues, I refer to your help with specific graphic problem. It is necessary to create a viewfinder in graphic application. It seems that the algorithm is simple: just draw lines in specific position in according to value of some controls, track bars, for example. Next read the track bars value to find the coordinates of lines cross. It works, but I can not get real cross because the background image is being deface by lines...
9
3170
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I want to be able to draw lines in a picturebox based upon certain data points I have received. I dragged a picturebox from the toolbar onto my form, but after having gone through the help files, looking online and trying a variety of things, I...
4
1650
by: Galen Somerville | last post by:
My VB2005 app gets real time Heart sounds and an ECG from a USB device. I'm looking for a way to speed up the drawing of the traces on the screen. In the following code the routine GetSounds recieves the USB data for six consequtive horizontal pixels (or 6 sound/ECG samples). The routine FixChns handles the scaling of the data and puts it into the PlotAry for presentation. The variable RptCnt then handles the placement for the 6 sets...
4
3775
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've windows form, in this form i've a panel. I want to draw lines inside the panel using the panel coordinates( meaing that the left upper corner of the panel is 0,0), how can i do it? Thanks, Gidi.
2
2302
by: =?Utf-8?B?TWFyYyBBbGxhcmQ=?= | last post by:
Hello, I have posted this message in the normal newsgroup instead of posting it in the managed ones. I have a project in VB6 (GDI+) that will read a WMF File (created by my customer) and then resize it and insert it into a picture I have a problem with in in NET2005 (but it is OK in VB6).
1
3958
by: YouPoP | last post by:
I am doing an app (C# 2.0) where you can draw in a panel with your mouse in "real time". I actually have 2 problems; 1- it does not really is "real time", if your mouse move fast or very fast the line is added after a very small delay. 2-Because I use AddLine(), it adds very short lines from one point to another and it does not give a very good result. Also because of this and my "not real time" problem, when the mouse moves fast it adds...
0
8411
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
8739
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...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
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.