This course teaches how to install and configure Windows Server 2012 R2. It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Hi,

I have to draw few curves using dot net drawing classes which is fine. now when user right clicks on the curve, i need to save value associated with that point to the database. how do i do that? how do i retrive the database values associated with curve? please help...

regards

I have to draw few curves using dot net drawing classes which is fine. now when user right clicks on the curve, i need to save value associated with that point to the database. how do i do that? how do i retrive the database values associated with curve? please help...

regards

thanks.

Because a tru curve would have several values, Start X, Start Y, End X, End Y, Radius(since a curve is apart of a circle) , Midpoint.

the only other way would be to save an array of X-Y values.

However if each curve is "set" like ( and ) are, then all you need is the starting X-Y part and let the program draw out the curve.

Private Sub Form11_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.Mouse

' e.X()

' e.Y()

End Sub

info at strategus dot be

to explain, is the curve completely made of XY coordinates you got from an array or table, or do you have just a few XY coordinates and you let the programm calculated the rest of the points ?

here is the table structure

ResultsSetID int part of composite PK

GraphPointID int part of composite PK

AttachmentPoint decimal x coordinate

LimitBand decimal

ExpectedLoss decimal y coordi for 1st curve

CatPrice decimal y coordiante for 2nd curve

RiskLoad decimal y coordiante for 3rd curve

To explain a little more.

1. I could build a curve with, lets say just 4 points (and calculate the other points to draw a smooth curve)

X = 0, Y = 20

X = 20, Y = 10

X = 40, Y = 30

X = 60, Y = 20

2. or do you have all the points of the curve (where every point of the curve is defined and no calculation is needed)

Thank u so much but I am extremly sorry..i never specified that it has to be done in the web application, that is the whole problem..is right click on the curve and trapping those coordinates possible in web?

So get a refund for your points at community support, and maybe reask the question in the javascript topic.

Sorry.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

the example draw 3 lines from a table I created and filled with some values. when you left click on a pixel in the panel it will retrieve the row from the table. If you have aditional questions don't hesitate to ask

Dim dt As New DataTable

Dim xRange As Double

Dim YRange As Double

Dim bm As Bitmap

Dim el As New ArrayList

Dim cp As New ArrayList

Dim rl As New ArrayList

Private Sub Form15_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

bm = New Bitmap(Panel1.Width, Panel1.Height)

End Sub

Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.Paint

If Not IsNothing(bm) Then

e.Graphics.DrawImage(bm, 0, 0)

End If

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

dt.Columns.Add("Attachment

dt.Columns.Add("ExpectedLo

dt.Columns.Add("CatPrice",

dt.Columns.Add("RiskLoad",

For x As Integer = 0 To 100

Dim dr As DataRow = dt.NewRow

dr.Item("AttachmentPoint")

dr.Item("ExpectedLoss") = x * 2

dr.Item("CatPrice") = x * 3

dr.Item("RiskLoad") = x * 4

dt.Rows.Add(dr)

Next

xRange = Decimal.Round(Panel1.Width

GetTopYrange()

For y As Integer = 0 To dt.Rows.Count - 1

el.Add(CStr(CInt(dt.Rows(y

cp.Add(CStr(CInt(dt.Rows(y

rl.Add(CStr(CInt(dt.Rows(y

bm.SetPixel(CInt(dt.Rows(y

bm.SetPixel(CInt(dt.Rows(y

bm.SetPixel(CInt(dt.Rows(y

Next

Panel1.Invalidate()

End Sub

Public Sub GetTopYrange()

Dim YR As Single = 0

For x As Integer = 0 To dt.Rows.Count - 1

If dt.Rows(x).Item("ExpectedL

YR = dt.Rows(x).Item("ExpectedL

End If

If dt.Rows(x).Item("CatPrice"

YR = dt.Rows(x).Item("CatPrice"

End If

If dt.Rows(x).Item("RiskLoad"

YR = dt.Rows(x).Item("RiskLoad"

End If

Next

YRange = Decimal.Round((Panel1.Heig

End Sub

Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.Mouse

Dim mycolor As Color

Dim rownum As Integer

mycolor = bm.GetPixel(e.X, e.Y)

If mycolor.G = 128 Then 'ExpectedLoss

rownum = el.IndexOf(CStr(e.X) & CStr(e.Y))

MsgBox(dt.Rows(rownum).Ite

ElseIf mycolor.B = 255 Then 'catprice

rownum = cp.IndexOf(CStr(e.X) & CStr(e.Y))

MsgBox(dt.Rows(rownum).Ite

ElseIf mycolor.R = 255 Then 'Riskload

rownum = rl.IndexOf(CStr(e.X) & CStr(e.Y))

MsgBox(dt.Rows(rownum).Ite

Else

Exit Sub

End If

End Sub