对话框错误 [英] Error with dialog

查看:96
本文介绍了对话框错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Microsoft Chart for Windows Forms Samples Environment的示例之一,但无法复制其中之一.代码如下:

I'm trying to use one of the samples of the Microsoft Chart for Windows Forms Samples Enviroment, but I can't reproduce one of them. The code is as follows:

Imports System.Windows.Forms.DataVisualization.Charting
...

' Mouse Down Event
Private Sub Chart1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Chart1.MouseDown
    ' Call Hit Test Method
    Dim result As HitTestResult = Chart1.HitTest(e.X, e.Y)

    If result.ChartElementType = ChartElementType.DataPoint Then
       
    'Create Dialog
    Dim dlg As New Dialog()
       
    'Initialize members
    dlg.ChartRef = Chart1
    dlg.pointIndex = result.PointIndex
       
    ' Show dialog
    dlg.Show()

    Else
    If result.ChartElementType <> ChartElementType.Nothing Then
        Dim elementType As String = result.ChartElementType.ToString()
        MessageBox.Show(Me, "Selected Element is: " + elementType)
    End If
    End If
End Sub 'Chart1_MouseDown
 
' Mouse Move Event
Private Sub Chart1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Chart1.MouseMove
    ' Call Hit Test Method
    Dim result As HitTestResult = Chart1.HitTest(e.X, e.Y)

    ' If a Data Point or a Legend item is selected.
    If result.ChartElementType = ChartElementType.DataPoint Or result.ChartElementType = ChartElementType.LegendItem Then
        ' Set cursor type 
        Me.Cursor = Cursors.Hand
    Else
        If result.ChartElementType <> ChartElementType.Nothing And result.ChartElementType <> ChartElementType.PlottingArea Then
            ' Set cursor type 
            Me.Cursor = Cursors.Hand
        Else
            ' Set default cursor
            Me.Cursor = Cursors.Default
        End If
    End If
End Sub 'Chart1_MouseMove 

错误出现在 Dim dlg As New Dialog(),因为它告诉我类型"Dialog"是没有定义.我缺少任何进口商品吗?浏览过论坛和文档,但找不到对我有帮助的东西.

The error is in the Dim dlg As New Dialog() as it tells me that the type "Dialog" is not defined. Is there any import I'm missing? Have looked around forums and documentation, but haven't found something that helps me.

推荐答案

错误出现在 Dim dlg As New Dialog(),因为它告诉我类型"Dialog"是没有定义.我缺少任何进口商品吗?浏览过论坛和文档,但找不到对我有帮助的东西.

The error is in the Dim dlg As New Dialog() as it tells me that the type "Dialog" is not defined. Is there any import I'm missing? Have looked around forums and documentation, but haven't found something that helps me.

Dialog是先前示例中定义的类吗?它不是.Net中的标准组件(属性ChartRef和pointIndex对于该类似乎是唯一的).它似乎是已设置为标准容器的表单 查看图表.

Is Dialog a class that is defined in an earlier example?  It isn't a standard component in .Net (the properties ChartRef and pointIndex appear to be unique to that class).   It appears to be a form that has been set up as a standard container for a chart.


这篇关于对话框错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆