473,832 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

drawing lines

I would like to know how to plot coordinates in the form
using drawline method .For eg: Given only x and y fields
and about 50 records are there in database .I should fetch
the records from database and plot it in the form given
only x and Y coordinates.
please help me to tackle this problem.
Nov 20 '05 #1
2 1579
"Vishruth" <ra************ @rediffmail.com > schrieb
I would like to know how to plot coordinates in the form
using drawline method .For eg: Given only x and y fields
and about 50 records are there in database .I should fetch
the records from database and plot it in the form given
only x and Y coordinates.
please help me to tackle this problem.


Pseudo-Code:

sub render(g as graphics)

for
g.drawXYZ
next

end sub

In OnPaint, call
render(e.graphi cs)

Outside OnPaint (inside the Form):

dim g as graphics
g = me.creategraphi cs
try
render g
finally
g.dispose
end try

See also:
http://msdn.microsoft.com/library/en...tingimages.asp
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
I Didnt have time to finish this, but its almost there. . .

Me.CON = New System.Data.Ole Db.OleDbConnect ion
'
'CON
'
Me.CON.Connecti onString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""C:\Doc uments and
Settings\Admini strator\My Documents\" & _
"FamilyPlusFrie nds.mdb"";Jet OLEDB:Engine
Type=5;Provider =""Microsoft.Je t.OLEDB.4.0" & _
""";Jet OLEDB:System database=;Jet OLEDB:SFP=False ;persist security
info=False;Ext" & _
"ended Properties=;Mod e=Share Deny None;Jet OLEDB:Encrypt
Database=False; Jet OLED" & _
"B:Create System Database=False; Jet OLEDB:Don't Copy Locale on
Compact=False;J et " & _
"OLEDB:Comp act Without Replica Repair=False;Us er ID=Admin;Jet
OLEDB:Global Bulk T" & _
"ransaction s=1"
'
'Form1
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(392, 357)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Me.CON = New System.Data.Ole Db.OleDbConnect ion
'
'CON ( The Connection to the access Database )
'
Me.CON.Connecti onString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""C:\Doc uments and
Settings\Admini strator\My Documents\" & _
"FamilyPlusFrie nds.mdb"";Jet OLEDB:Engine
Type=5;Provider =""Microsoft.Je t.OLEDB.4.0" & _
""";Jet OLEDB:System database=;Jet OLEDB:SFP=False ;persist security
info=False;Ext" & _
"ended Properties=;Mod e=Share Deny None;Jet OLEDB:Encrypt
Database=False; Jet OLED" & _
"B:Create System Database=False; Jet OLEDB:Don't Copy Locale on
Compact=False;J et " & _
"OLEDB:Comp act Without Replica Repair=False;Us er ID=Admin;Jet
OLEDB:Global Bulk T" & _
"ransaction s=1"
Dim SQLStr As String = "Select * From PLOT"

Dim myCommand As New OleDb.OleDbComm and(SQLStr, CON)
CON.Open()
Dim blackPen As New Pen(Color.Black , 10)

' Draw line to screen.
Dim g As Graphics = Me.CreateGraphi cs()

Dim lastX, lastY As Integer
RDR = myCommand.Execu teReader()
' Always call Read before accessing data.
While RDR.Read()

g.DrawLine(blac kPen, lastX, lastY, RDR.GetInt32(0) ,
RDR.GetInt32(1) )

lastX = RDR.GetInt32(0)
lastY = RDR.GetInt32(1)
End While
' always call Close when done reading.
RDR.Close()
' Close the connection when done with it.
CON.Close()

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2430
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
12348
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?
0
1338
by: borhan | last post by:
I am designing a program in which the user will be drawing, lines, circules and so on, on a paint control which displays an image opened by the user. "It's like there is a map on the picturebox control and the user draws some raads on the map." I am using System::Drawing::Graphics class, first I assign the handle of the picbox where the user wil draw: graphicsSurface = System::Drawing::Graphics::FromHwnd( picBox->Handle );
8
5652
by: Benoit Martin | last post by:
I had to draw my own control because I couldn't find any control doing what I wanted it to do. This control has a grid that I need to have control over. To do that, I draw each line of the grid using a 1pixel pictureBox. I also need "boxes" to be placed within that grid depending on data pulled from my dataset. I also used pictureBox controls for that. All those components that I use to draw my control are added to the controls collection...
2
2255
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
3192
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
1665
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
3789
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.
1
3992
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...
5
12884
by: Macias | last post by:
Hi, Please help me, how I can make a line drawing on PictureBox similar to MS paint. I thinking about this: click and hold button, move mouse and relase button. I'm trying useing this g.DrawLine(..), but I have a lot of line. In C++ is a parameter XORPUT, but in C# I can't find it.
0
9795
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
10498
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
10212
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
9319
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...
0
6951
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
5623
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
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4421
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
3
3077
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.