VB.net(WPF系统)。如何多次打开和关闭同一窗口?

时间:2019-02-17 00:01:47

标签: wpf vb.net

(WPF系统)。如何多次打开和关闭同一窗口? 下面的代码不起作用。我只能打开“关于”窗口一次。 我不知道如何避免这个错误。你可以帮帮我吗 ?谢谢。

'Window Main

Class MainWindow
    Dim WindowAbout As FormAbout = New FormAbout
    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
        WindowAbout.ShowDialog()
    End Sub
End Class

--------

'Window About

Imports System.ComponentModel

Public Class FormAbout
    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
        Close()
    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

搜索后,答案是:添加WindowAbout = New FormAbout

class Edge(object):
    def __init__(self, pointA, pointB):
        self._A = pointA
        self._B = pointB
        ab = pointA + pointB
        self._midpoint = Vector(ab.x / 2, ab.y / 2, ab.z / 2)


    def get_A(self):
        return self._A

    def set_A(self, point):
        self._A = point

    def get_B(self):
        return self._B

    def set_B(self, point):
        self._B = point

    A = property(get_A, set_A)
    B = property(get_B, set_B)

    def __eq__(self, other):
        if isinstance(other, Edge):
            if (self.A == other.A) and (self.B == other.B):
                return True
            elif (self.B == other.A) and (self.A == other.B):
                return True
            else:
                return False

    def __ne__(self, other):
        return not self.__eq__(other)

    def __hash__(self):
        return hash((self.A, self.B)) # =/= hash((self.B, self.A))!

    def __str__(self):
        return "[{}, {}]".format(self.A, self.B)