Imports System.Windows.Forms
Imports System.Drawing
Imports System.IO
Imports Basics
Imports IMidRange
Imports GraphicsObjects
Imports MidRange
Imports BVCtl
Imports MathUtilities
Imports SecundaryForms
Imports GraphicsUtilities
Imports FormUtils
'no usar pictureBox, ya que funciona mal el refresh del picturebox
Public Class Frm2DDemo
Inherits System.Windows.Forms.Form
#Region " C�digo generado por el Dise�ador de Windows Forms "
Public Sub New()
MyBase.New()
'El Dise�ador de Windows Forms requiere esta llamada.
InitializeComponent()
'Agregar cualquier inicializaci�n despu�s de la llamada a InitializeComponent()
Initialize()
End Sub
'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requerido por el Dise�ador de Windows Forms
Private components As System.ComponentModel.IContainer
'NOTA: el Dise�ador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Dise�ador de Windows Forms.
'No lo modifique con el editor de c�digo.
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemView As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemEdit As System.Windows.Forms.MenuItem
Friend WithEvents SttsBrMain As System.Windows.Forms.StatusBar
Friend WithEvents SttsBrPnl1 As System.Windows.Forms.StatusBarPanel
Friend WithEvents TabCtlMain As System.Windows.Forms.TabControl
Friend WithEvents MenuItem9 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemPrinterMode As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemScreenMode As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemCopy As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemHelp As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem17 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem19 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemAbout As System.Windows.Forms.MenuItem
Friend WithEvents MenuItemUserMode As System.Windows.Forms.MenuItem
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Friend WithEvents PropertyGrid1 As System.Windows.Forms.PropertyGrid
Friend WithEvents MnuItmFullScreen As System.Windows.Forms.MenuItem
Friend WithEvents ImageList2 As System.Windows.Forms.ImageList
Friend WithEvents SttsBrPnl2 As System.Windows.Forms.StatusBarPanel
Friend WithEvents SttsBrPnl3 As System.Windows.Forms.StatusBarPanel
Friend WithEvents VisorCtl1 As BVCtl.VisorCtl
Friend WithEvents ImageViewer1 As BVCtl.ImageViewer
Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
Friend WithEvents MnItmFP As System.Windows.Forms.MenuItem
Friend WithEvents MnItmSec As System.Windows.Forms.MenuItem
Friend WithEvents MnuItmBisec As System.Windows.Forms.MenuItem
Friend WithEvents MnuItmNewt As System.Windows.Forms.MenuItem
Friend WithEvents MnuItmRidd As System.Windows.Forms.MenuItem
Friend WithEvents MnuItmBIn As System.Windows.Forms.MenuItem
Friend WithEvents MnuItmBOut As System.Windows.Forms.MenuItem
Friend WithEvents BvToolBar1 As BVCtl.BVToolBar
Friend WithEvents ContextMenu2 As System.Windows.Forms.ContextMenu
Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon
Friend WithEvents ImageViewer2 As BVCtl.ImageViewer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Frm2DDemo))
Me.TabCtlMain = New System.Windows.Forms.TabControl
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid
Me.ImageViewer1 = New BVCtl.ImageViewer
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem9 = New System.Windows.Forms.MenuItem
Me.MenuItemView = New System.Windows.Forms.MenuItem
Me.MenuItemScreenMode = New System.Windows.Forms.MenuItem
Me.MenuItemPrinterMode = New System.Windows.Forms.MenuItem
Me.MenuItemUserMode = New System.Windows.Forms.MenuItem
Me.MenuItem19 = New System.Windows.Forms.MenuItem
Me.MnuItmFullScreen = New System.Windows.Forms.MenuItem
Me.MenuItemEdit = New System.Windows.Forms.MenuItem
Me.MenuItemCopy = New System.Windows.Forms.MenuItem
Me.MenuItemHelp = New System.Windows.Forms.MenuItem
Me.MenuItemAbout = New System.Windows.Forms.MenuItem
Me.SttsBrMain = New System.Windows.Forms.StatusBar
Me.SttsBrPnl1 = New System.Windows.Forms.StatusBarPanel
Me.SttsBrPnl2 = New System.Windows.Forms.StatusBarPanel
Me.SttsBrPnl3 = New System.Windows.Forms.StatusBarPanel
Me.ContextMenu1 = New System.Windows.Forms.ContextMenu
Me.MnItmFP = New System.Windows.Forms.MenuItem
Me.MnItmSec = New System.Windows.Forms.MenuItem
Me.MnuItmBisec = New System.Windows.Forms.MenuItem
Me.MnuItmNewt = New System.Windows.Forms.MenuItem
Me.MnuItmRidd = New System.Windows.Forms.MenuItem
Me.MenuItem7 = New System.Windows.Forms.MenuItem
Me.MnuItmBIn = New System.Windows.Forms.MenuItem
Me.MnuItmBOut = New System.Windows.Forms.MenuItem
Me.ImageList2 = New System.Windows.Forms.ImageList(Me.components)
Me.MenuItem17 = New System.Windows.Forms.MenuItem
Me.VisorCtl1 = New BVCtl.VisorCtl
Me.BvToolBar1 = New BVCtl.BVToolBar
Me.ContextMenu2 = New System.Windows.Forms.ContextMenu
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)
Me.ImageViewer2 = New BVCtl.ImageViewer
Me.TabCtlMain.SuspendLayout()
Me.TabPage1.SuspendLayout()
CType(Me.SttsBrPnl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SttsBrPnl2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SttsBrPnl3, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'TabCtlMain
'
Me.TabCtlMain.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.TabCtlMain.Controls.Add(Me.TabPage1)
Me.TabCtlMain.Location = New System.Drawing.Point(0, 40)
Me.TabCtlMain.Multiline = True
Me.TabCtlMain.Name = "TabCtlMain"
Me.TabCtlMain.SelectedIndex = 0
Me.TabCtlMain.Size = New System.Drawing.Size(248, 424)
Me.TabCtlMain.TabIndex = 22
'
'TabPage1
'
Me.TabPage1.Controls.Add(Me.ImageViewer2)
Me.TabPage1.Controls.Add(Me.PropertyGrid1)
Me.TabPage1.Controls.Add(Me.ImageViewer1)
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(240, 398)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "Graph Control"
'
'PropertyGrid1
'
Me.PropertyGrid1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.PropertyGrid1.CommandsVisibleIfAvailable = True
Me.PropertyGrid1.HelpVisible = False
Me.PropertyGrid1.LargeButtons = False
Me.PropertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar
Me.PropertyGrid1.Location = New System.Drawing.Point(8, 200)
Me.PropertyGrid1.Name = "PropertyGrid1"
Me.PropertyGrid1.Size = New System.Drawing.Size(224, 188)
Me.PropertyGrid1.TabIndex = 49
Me.PropertyGrid1.Text = "PropertyGrid1"
Me.PropertyGrid1.ToolbarVisible = False
Me.PropertyGrid1.ViewBackColor = System.Drawing.SystemColors.Window
Me.PropertyGrid1.ViewForeColor = System.Drawing.SystemColors.WindowText
'
'ImageViewer1
'
Me.ImageViewer1.AllowDeletions = BVCtl.ImageViewer.EAllowDeletions.None
Me.ImageViewer1.BackColor = System.Drawing.Color.White
Me.ImageViewer1.EnablePreview = False
Me.ImageViewer1.IsSelected = False
Me.ImageViewer1.Location = New System.Drawing.Point(8, 8)
Me.ImageViewer1.Name = "ImageViewer1"
Me.ImageViewer1.Size = New System.Drawing.Size(112, 184)
Me.ImageViewer1.TabIndex = 0
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItemView, Me.MenuItemEdit, Me.MenuItemHelp})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem9})
Me.MenuItem1.Text = "File"
'
'MenuItem9
'
Me.MenuItem9.Index = 0
Me.MenuItem9.Text = "-"
'
'MenuItemView
'
Me.MenuItemView.Index = 1
Me.MenuItemView.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItemScreenMode, Me.MenuItemPrinterMode, Me.MenuItemUserMode, Me.MenuItem19, Me.MnuItmFullScreen})
Me.MenuItemView.Text = "View"
'
'MenuItemScreenMode
'
Me.MenuItemScreenMode.Checked = True
Me.MenuItemScreenMode.Index = 0
Me.MenuItemScreenMode.Text = "Screen Mode"
'
'MenuItemPrinterMode
'
Me.MenuItemPrinterMode.Index = 1
Me.MenuItemPrinterMode.Text = "Printer Mode"
'
'MenuItemUserMode
'
Me.MenuItemUserMode.Index = 2
Me.MenuItemUserMode.Text = "User Mode"
'
'MenuItem19
'
Me.MenuItem19.Index = 3
Me.MenuItem19.Text = "-"
'
'MnuItmFullScreen
'
Me.MnuItmFullScreen.Index = 4
Me.MnuItmFullScreen.Text = "Toggle Full Screen"
'
'MenuItemEdit
'
Me.MenuItemEdit.Index = 2
Me.MenuItemEdit.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItemCopy})
Me.MenuItemEdit.Text = "Edit"
'
'MenuItemCopy
'
Me.MenuItemCopy.Index = 0
Me.MenuItemCopy.Text = "Copy To ClipBoard"
'
'MenuItemHelp
'
Me.MenuItemHelp.Index = 3
Me.MenuItemHelp.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItemAbout})
Me.MenuItemHelp.Text = "Help"
'
'MenuItemAbout
'
Me.MenuItemAbout.Index = 0
Me.MenuItemAbout.Text = "ABout"
'
'SttsBrMain
'
Me.SttsBrMain.Location = New System.Drawing.Point(0, 459)
Me.SttsBrMain.Name = "SttsBrMain"
Me.SttsBrMain.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.SttsBrPnl1, Me.SttsBrPnl2, Me.SttsBrPnl3})
Me.SttsBrMain.ShowPanels = True
Me.SttsBrMain.Size = New System.Drawing.Size(800, 22)
Me.SttsBrMain.TabIndex = 28
'
'SttsBrPnl1
'
Me.SttsBrPnl1.Width = 350
'
'SttsBrPnl2
'
Me.SttsBrPnl2.Width = 150
'
'SttsBrPnl3
'
Me.SttsBrPnl3.Width = 150
'
'ContextMenu1
'
Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MnItmFP, Me.MnItmSec, Me.MnuItmBisec, Me.MnuItmNewt, Me.MnuItmRidd, Me.MenuItem7, Me.MnuItmBIn, Me.MnuItmBOut})
'
'MnItmFP
'
Me.MnItmFP.Checked = True
Me.MnItmFP.DefaultItem = True
Me.MnItmFP.Index = 0
Me.MnItmFP.Text = "False Position"
'
'MnItmSec
'
Me.MnItmSec.Index = 1
Me.MnItmSec.Text = "Secant Method"
'
'MnuItmBisec
'
Me.MnuItmBisec.Index = 2
Me.MnuItmBisec.Text = "Bisection"
'
'MnuItmNewt
'
Me.MnuItmNewt.Index = 3
Me.MnuItmNewt.Text = "Newton Raphson"
'
'MnuItmRidd
'
Me.MnuItmRidd.Index = 4
Me.MnuItmRidd.Text = "Ridders Method"
'
'MenuItem7
'
Me.MenuItem7.Index = 5
Me.MenuItem7.Text = "-"
'
'MnuItmBIn
'
Me.MnuItmBIn.Index = 6
Me.MnuItmBIn.Text = "Bracket In"
'
'MnuItmBOut
'
Me.MnuItmBOut.Index = 7
Me.MnuItmBOut.Text = "Bracket Out"
'
'ImageList2
'
Me.ImageList2.ImageSize = New System.Drawing.Size(32, 32)
Me.ImageList2.ImageStream = CType(resources.GetObject("ImageList2.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList2.TransparentColor = System.Drawing.Color.Transparent
'
'MenuItem17
'
Me.MenuItem17.Index = -1
Me.MenuItem17.Text = ""
'
'VisorCtl1
'
Me.VisorCtl1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.VisorCtl1.BackColor = System.Drawing.Color.White
Me.VisorCtl1.Location = New System.Drawing.Point(256, 40)
Me.VisorCtl1.Name = "VisorCtl1"
Me.VisorCtl1.Size = New System.Drawing.Size(536, 416)
Me.VisorCtl1.TabIndex = 30
'
'BvToolBar1
'
Me.BvToolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Normal
Me.BvToolBar1.AutoSize = True
Me.BvToolBar1.BackColor = System.Drawing.SystemColors.Control
Me.BvToolBar1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.BvToolBar1.ButtonSize = New System.Drawing.Size(32, 32)
Me.BvToolBar1.Divider = False
Me.BvToolBar1.Dock = System.Windows.Forms.DockStyle.Top
Me.BvToolBar1.ImageList = Me.ImageList2
Me.BvToolBar1.Name = "BvToolBar1"
Me.BvToolBar1.TabIndex = 31
'
'NotifyIcon1
'
Me.NotifyIcon1.Text = "NotifyIcon1"
Me.NotifyIcon1.Visible = True
'
'ImageViewer2
'
Me.ImageViewer2.AllowDeletions = BVCtl.ImageViewer.EAllowDeletions.None
Me.ImageViewer2.BackColor = System.Drawing.Color.White
Me.ImageViewer2.EnablePreview = False
Me.ImageViewer2.IsSelected = False
Me.ImageViewer2.Location = New System.Drawing.Point(128, 8)
Me.ImageViewer2.Name = "ImageViewer2"
Me.ImageViewer2.Size = New System.Drawing.Size(104, 184)
Me.ImageViewer2.TabIndex = 50
'
'Frm2DDemo
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(800, 481)
Me.Controls.Add(Me.BvToolBar1)
Me.Controls.Add(Me.VisorCtl1)
Me.Controls.Add(Me.SttsBrMain)
Me.Controls.Add(Me.TabCtlMain)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Menu = Me.MainMenu1
Me.MinimumSize = New System.Drawing.Size(640, 480)
Me.Name = "Frm2DDemo"
Me.Text = "Bode Viewer XP V7 - Functions Root Finder Demo"
Me.TabCtlMain.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
CType(Me.SttsBrPnl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.SttsBrPnl2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.SttsBrPnl3, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private WithEvents intVisor As VisorXYAdvanced
Private frmFS As FrmFullScreen
Private GoV As GraphOfVisorSimple
Private MsManager As MessageManager
Private intFRConfig As FRConfig
Private htbl As Hashtable
Private wR As WindowRange
Private ZoomToolBar As ZoomTool
Private WithEvents FRToolbar As FindRootToolBar
Private CursorToolbar As CursorToolBarUtility
'Private WithEvents BvTlBrBandMain As BVCtl.BVToolBarBand
'Private BvTlBarBtnRun As BVCtl.BVToolBarButton
Friend WithEvents MnuItmCubic As System.Windows.Forms.MenuItem
Friend WithEvents MnuItmFive As System.Windows.Forms.MenuItem
Friend WithEvents MnuItm1 As System.Windows.Forms.MenuItem
Friend WithEvents MnuItm2 As System.Windows.Forms.MenuItem
Friend WithEvents MnuItm3 As System.Windows.Forms.MenuItem
Friend WithEvents MnuItm4 As System.Windows.Forms.MenuItem
Private Sub Initialize()
Dim ico As Icon
MsManager = New MessageManager
AddHandler MsManager.SendMessage, AddressOf OnMessageReicived
htbl = New Hashtable
intVisor = New VisorXYAdvanced(VisorCtl1)
intVisor.SetRanges(-10, 10, -12, 12)
intVisor.AutoResize = True
intFRConfig = New FRConfig(Me.intVisor, Me.BvToolBar1)
Me.intFRConfig.XRange = New Range(10, -10)
Me.intFRConfig.NumberOfPoints = 200
Me.intFRConfig.Expresion = "0,02*x^3-x+3"
InitializeToolBar()
InitializeMenu2()
ZoomToolBar = New ZoomTool(intVisor, Me.BvToolBar1)
FRToolbar = New FindRootToolBar(intVisor, Me.BvToolBar1, Me.intFRConfig.SelectedFunction)
Me.FRToolbar.ShowToolBar()
CursorToolbar = New CursorToolBarUtility(Me.intVisor, Me.BvToolBar1)
CursorToolbar.ShowToolBar()
ImageViewer1.Add(Me.intFRConfig, intFRConfig.Icon.ToBitmap, intFRConfig.Description)
Me.intFRConfig.Add(Me.intFRConfig.ParseManager.CurrentFunction)
GoV = intVisor.CurrentGoV
GoV.LineType = TypeOfVisorLine.Solid
GoV.BriefDescription = "function Graph"
ImageViewer1.Add(Me.FRToolbar.RootFinderObject, Me.FRToolbar.RootFinderObject.Icon.ToBitmap, "Root Find Features")
End Sub
Private Sub Frm2DDemo_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
PropertyGrid1.SelectedObject = Me.intVisor
PropertyGrid1.CommandsVisibleIfAvailable = True
AddHandler Me.ImageViewer1.ItemSelected, AddressOf onSelectItm
AddHandler Me.ImageViewer2.ItemSelected, AddressOf onSelectItm
AddHandler Me.intVisor.Selected, AddressOf onSelectItm
AddHandler CursorToolbar.PropertiesAvailable, AddressOf Me.ShowProperties
AddHandler CursorToolbar.CursorsChange, AddressOf Me.RefreshPropertyGrid
End Sub
#Region "InitializeToolBar"
Private Sub InitializeToolBar()
Me.intFRConfig.ToolBarBand.Buttons.Item("BvTlBarBtnRefresh").DropDownMenu = Me.ContextMenu2
Me.intFRConfig.ToolBarBand.Buttons.Item("BvTlBarBtnRefresh").ToolTipText = "Find Root"
Me.intFRConfig.ToolBarBand.Buttons.Item("BvTlBarBtnRefresh").Style = ToolBarButtonStyle.DropDownButton
End Sub
#End Region
#Region "InitializeMenus"
Private Sub InitializeMenu2()
Me.MnuItmCubic = New System.Windows.Forms.MenuItem
Me.MnuItmCubic.Index = 0
Me.MnuItmCubic.Text = "Cubic Function"
Me.MnuItmFive = New System.Windows.Forms.MenuItem
Me.MnuItmFive.Index = 1
Me.MnuItmFive.Text = "Five Order Function"
Me.MnuItm1 = New System.Windows.Forms.MenuItem
Me.MnuItm1.Index = 2
Me.MnuItm1.Text = "Mixed Sine and Cosine Function"
Me.MnuItm2 = New System.Windows.Forms.MenuItem
Me.MnuItm2.Index = 3
Me.MnuItm2.Text = "Even Cosine Function"
Me.MnuItm3 = New System.Windows.Forms.MenuItem
Me.MnuItm3.Index = 4
Me.MnuItm3.Text = "Multi Root Function"
Me.MnuItm4 = New System.Windows.Forms.MenuItem
Me.MnuItm4.Index = 5
Me.MnuItm4.Text = "Some Hyperbolic Function"
Me.ContextMenu2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MnuItmCubic, Me.MnuItmFive, _
MnuItm1, MnuItm2, MnuItm3, MnuItm4})
End Sub
#End Region
#Region "MnuItem Handles Methods"
Private Sub MnuItmCubic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItmCubic.Click
Me.intFRConfig.Expresion = "0,02*x^3-x+3"
End Sub
Private Sub MnuItmFive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItmFive.Click
Me.intFRConfig.Expresion = "-300*x^2+0.5*x^5"
End Sub
Private Sub MnuItm1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItm1.Click
Me.intFRConfig.Expresion = "cos(0.315*x)+sin(0.63*x)"
'0.2*x+cos(0.315*x)+sin(0.63*x)
End Sub
Private Sub MnuItm2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItm2.Click
'Me.intFRConfig.Expresion = "0.01*x^2*cos(x)"
Me.intFRConfig.Expresion = "(0.01*x^2-x-1)*cos(x)"
End Sub
Private Sub MnuItm3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItm3.Click
Me.intFRConfig.Expresion = "0,02*x^3-x+3*sin(x)+1"
End Sub
Private Sub MnuItm4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItm4.Click
Me.intFRConfig.Expresion = "1/(x^2+3*x-5)"
Me.intVisor.YAxisProperties.Range = New Range(-10, 10)
End Sub
#End Region
#Region "Select Region"
Sub RefreshPropertyGrid(ByVal sender As Object, ByVal e As EventArgs)
PropertyGrid1.SelectedObject = Me.CursorToolbar.CursorsProperties
PropertyGrid1.Refresh()
End Sub
Sub ShowProperties(ByVal sender As Object, ByVal e As EventArgs)
If TypeOf sender Is CursorToolBarUtility Then
PropertyGrid1.SelectedObject = CType(sender, CursorToolBarUtility).CursorsProperties
End If
End Sub
Sub onSelectItm(ByVal sender As Object, ByVal e As ItmEventArgs)
PropertyGrid1.SelectedObject = e.Obj
If TypeOf e.Obj Is GraphOfVisorComplex Then
GoV = e.Obj
ElseIf TypeOf e.Obj Is FindRootCls Then
AddKnownRanges()
ElseIf TypeOf e.Obj Is WindowRange Then
Me.FRToolbar.RootFinderObject.Range = CType(e.Obj, WindowRange).Range
Me.intVisor.Refresh()
End If
End Sub
Sub onSelectItm(ByVal sender As Object, ByVal e As EventArgs)
PropertyGrid1.SelectedObject = sender
Me.ImageViewer2.Clear()
Me.ImageViewer2.Add(GoV, intVisor.GetPreviewImage(), "Analized function")
End Sub
#End Region
#Region "Window Range Methods"
'agrega los rangos conocidos al segundo ImageVieewer
Private Sub AddKnownRanges()
'Me.ImageViewer2.Clear()
RemoveKnownRanges()
Dim i As Integer
For i = 0 To Me.FRToolbar.RootFinderObject.KnownRangesCount - 1
wR = New WindowRange(Me.intVisor, Me.FRToolbar.RootFinderObject.KnownRanges(i))
wR.Text = "Range" & i
Me.ImageViewer2.Add(wR, wR.Icon.ToBitmap, wR.Range.ToString)
Me.htbl.Add(wR, i)
AddHandler wR.RangeChange, AddressOf WindowRangeChange
Next
End Sub
Private Sub RemoveKnownRanges()
Me.ImageViewer2.Clear()
For Each wR In htbl.Keys
RemoveHandler wR.RangeChange, AddressOf WindowRangeChange
Next
htbl.Clear()
End Sub
Private Sub WindowRangeChange(ByVal sender As Object, ByVal e As EventArgs)
If htbl.ContainsKey(sender) Then
Dim i As Integer
i = htbl.Item(sender)
Me.FRToolbar.RootFinderObject.KnownRanges(i) = CType(sender, WindowRange).Range
i = Me.ImageViewer2.IndexOf(sender)
If i > -1 Then
Me.ImageViewer2.Item(i).Description = CType(sender, WindowRange).Range.ToString
End If
End If
End Sub
#End Region
#Region "Message"
Private Sub OnMessageReicived(ByVal sender As Object, ByVal s As MessageEventArgs)
Me.SttsBrPnl1.Text = s.Message
End Sub
#End Region
#Region "Main"
'/ <summary>
'/ The main entry point for the application.
'/ </summary>
Shared Sub Main()
Dim frm As New Frm2DDemo
frm.SttsBrPnl1.Text = "Loading..."
frm.Show()
'frm.Refresh()
frm.SttsBrPnl1.Text = ""
While frm.Created
System.Windows.Forms.Application.DoEvents()
End While
End Sub
#End Region
#Region "ToolBar Section"
Private Sub FRToolbar_ButtonClick(ByVal sender As Object, ByVal e As BVToolBarButtonClickEventArgs) Handles FRToolbar.ButtonClick
If e.Button.Name = "BvTlBarBtnBracketIn" OrElse e.Button.Name = "BvTlBarBtnBracketOut" Then
AddKnownRanges()
'Me.FRToolbar.Execute("BvTlBarBtnShowBracket")
Me.FRToolbar.Buttons("BvTlBarBtnShowBracket").Pushed = True
End If
End Sub
#End Region
#Region "Render Control Events"
Sub OnRenderControl_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles intVisor.MouseDown, intVisor.MouseMove
Me.SttsBrPnl2.Text = Me.intVisor.Cursor1Position.ToString
Me.SttsBrPnl3.Text = Me.intVisor.Cursor2Position.ToString
End Sub
#End Region
#Region "Color Mode Section"
Private Sub UnCheckModeMenus()
MenuItemScreenMode.Checked = False
MenuItemUserMode.Checked = False
MenuItemPrinterMode.Checked = False
End Sub
Private Sub MenuItemPrinterMode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemPrinterMode.Click
UnCheckModeMenus()
MenuItemPrinterMode.Checked = True
intVisor.GraphColorMode = GraphColorMode.CPrinter
End Sub
Private Sub MenuItemUserMode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemUserMode.Click
UnCheckModeMenus()
MenuItemUserMode.Checked = True
intVisor.GraphColorMode = GraphColorMode.CUser
End Sub
Private Sub MenuItemScreenMode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemScreenMode.Click
UnCheckModeMenus()
MenuItemScreenMode.Checked = True
intVisor.GraphColorMode = GraphColorMode.CScreen
End Sub
#End Region
Private Sub MnuItmBIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItmBIn.Click
Me.FRToolbar.BackedIn()
End Sub
Private Sub MnuItmBOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuItmBOut.Click
Me.FRToolbar.BackedOut()
End Sub
End Class