'****************************************************************************
'* Copyright (C) 2007 Peter Mortensen and Matthias Mann *
'* This file is part of MSQuant. *
'* *
'* MSQuant is distributed under the terms of *
'* the GNU General Public License. See src/COPYING.TXT or *
'* <http://www.gnu.org/licenses/gpl.txt> for details. *
'* *
'* MSQuant is free software; you can redistribute it *
'* and/or modify it under the terms of the GNU *
'* General Public License as published by the Free *
'* Software Foundation; either version 2 of the *
'* License, or (at your option) any later version. *
'* *
'* MSQuant is distributed in the hope that it will be *
'* useful, but WITHOUT ANY WARRANTY; without even the *
'* implied warranty of MERCHANTABILITY or FITNESS FOR *
'* A PARTICULAR PURPOSE. See the GNU General Public *
'* License for more details. *
'* *
'* You should have received a copy of the GNU General *
'* Public License along with MSQuant; if not, write to *
'* the Free Software Foundation, Inc., 59 Temple *
'* Place, Suite 330, Boston, MA 02111-1307 USA *
'* *
'* Purpose: <to be filled in>. *
'* *
'****************************************************************************
'****************************************************************************
'* CEBI *
'* Software Development Group *
'* Peter Mortensen *
'* E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk *
'* WWW: http://www.cebi.sdu.dk/ *
'* *
'* Program for post-processing of result from search in mass *
'* spectrometric data. *
'* *
'* FILENAME: frmZedGraphTryout.vb *
'* TYPE: VISUAL_BASIC *
'* *
'* CREATED: PM 2007-08-11 Vrs 1.0. *
'* UPDATED: PM 2007-xx-xx *
'* *
'****************************************************************************
Option Strict On
Option Explicit On
Imports ZedGraph
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Class frmZedGraphTryout
Private mPane As GraphPane
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub frmZedGraphTryout_Load( _
ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
' Setup the graph.
CreateGraph(ZedGraphControl1)
' Size the control to fill the form with a margin.
SetSize()
End Sub 'frmZedGraphTryout_Load
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub frmZedGraphTryout_Resize( _
ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Resize
'Respond to the form 'Resize' event.
Me.SetSize()
End Sub 'frmZedGraphTryout_Resize
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
' SetSize() is separate from Resize() so we can
' call it independently from the Form1_Load() method
'
' This leaves a 10 px margin around the outside of the control
' Customize this to fit your needs
Private Sub SetSize()
ZedGraphControl1.Location = New Point(10, 10)
' Leave a small margin around the outside of the control
ZedGraphControl1.Size = New Size(ClientRectangle.Width - 20, _
ClientRectangle.Height - 20)
End Sub 'SetSize
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub CreateGraph(ByRef aZgc As ZedGraphControl)
' Build the Chart
' Get a reference to the GraphPane.
mPane = aZgc.GraphPane
' Set the Titles.
mPane.Title.Text = "My Test Graph\n(For CodeProject Sample)"
mPane.XAxis.Title.Text = "My X Axis"
mPane.YAxis.Title.Text = "My Y Axis"
' Make up some data arrays based on the Sine function.
Dim list1 As PointPairList = New PointPairList()
Dim list2 As PointPairList = New PointPairList()
'Changed PM_MARKER_ZEDGRAPH 2007-09-19
' list1.LinearRegression()
' list1.SplineInterpolateX
'myPane.
Dim x As Double
Dim y1 As Double
Dim y2 As Double
Dim i As Integer
For i = 0 To (36 - 1)
x = i + 5
y1 = 1.5 + Math.Sin(i * 0.2)
y2 = 3.0 * (1.5 + Math.Sin(i * 0.2))
list1.Add(x, y1)
list2.Add(x, y2)
Next
' Generate a red curve with diamond.
' symbols, and "Porsche" in the legend.
Dim myCurve As LineItem = mPane.AddCurve( _
"Porsche", _
list1, Color.Red, SymbolType.Diamond)
' Generate a blue curve with circle
' symbols, and "Piper" in the legend
Dim myCurve2 As LineItem = mPane.AddCurve( _
"Piper", _
list2, Color.Blue, SymbolType.Circle)
'Changed PM_STICKS_ZEDGRAPH 2007-09-19
If True Then
Dim myCurve3 As StickItem = _
mPane.AddStick("Some Sticks", list1, Color.Blue)
myCurve3.Line.Width = 2.0F
End If
' Tell ZedGraph to refigure the
' axes since the data have changed.
'
' The AxisChange() method call must be made
' any time you add or change the data.
aZgc.AxisChange()
End Sub 'CreateGraph
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub ZedGraphControl1_ZoomEvent( _
ByVal aSender As ZedGraph.ZedGraphControl, _
ByVal oldState As ZedGraph.ZoomState, _
ByVal newState As ZedGraph.ZoomState) _
Handles ZedGraphControl1.ZoomEvent
Dim newXmin As Double = mPane.XAxis.Scale.Min
Dim newXmax As Double = mPane.XAxis.Scale.Max
End Sub 'ZedGraphControl1_ZoomEvent
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub ZedGraphControl1_ContextMenuBuilder( _
ByVal sender As ZedGraph.ZedGraphControl, _
ByVal menuStrip As System.Windows.Forms.ContextMenuStrip, _
ByVal mousePt As System.Drawing.Point) _
Handles ZedGraphControl1.ContextMenuBuilder
Trace.Assert(False, "Stop!", _
"PIL ASSERT. Internal/development assert for stopping execution......")
End Sub 'ZedGraphControl1_ContextMenuBuilder
End Class 'frmZedGraphTryout
Generated by script codePublish.pl at 2008-09-23T11:59:18.