WPF窗体之间跳转的无缝效果
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WPF窗体之间跳转的无缝效果相关的知识,希望对你有一定的参考价值。
我在WPF中做了两个窗体:MainWindow.xaml和Video.xaml。在这两个窗体中,我都写有MediaElement并链接视频。
同时,在MainWindow.xaml窗体中,有一个Button,当点击它时,MainWindow.xaml跳转到Video.xaml。但是,在跳转的过程中,有一个非常明显的间隙。如果,我链接的视频文件较大,这个跳转的间隙就会更加明显。我现在想实现无缝跳转,这个要怎么做啊?
请大神不吝赐教啊!
vbscript vba:form_jump跳转的窗体
Private Sub UserForm_Initialize()
Dim arr() As String
ReDim arr(1 To 100)
j = 0
For i = 2 To 10000
If Cells(i, 1).Interior.ColorIndex = 37 Then
j = j + 1
arr(j) = Cells(i, 1).Value
End If
Next
ReDim Preserve arr(1 To j)
Me.ListBox1.List = arr
'Me.ListBox1.RowSource = "Sheet3!H1:H" & Sheet3.Range("h65535").End(xlUp).Row
End Sub
Private Sub CommandButton1_Click()
For n = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(n) = True Then
Call 跳转2(ListBox1.List(n))
UserForm1.Hide
Exit For
End If
Next
End Sub
Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub
'[1]模块1
Sub 跳转()
UserForm1.Show
End Sub
Sub 跳转2(a$)
i = Range("a2:a30000").Find(a, , , xlWhole).Row
Cells(i + 1, 2).Select
End Sub
[1]五重窗体,需加背景色
Public rowbegin1, rowbegin2, rowbegin3, rowbegin4
Private Sub ListBox1_Change()
col1 = 1
Dim arr() As String
ReDim arr(1 To 100)
j = 0
For n = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(n) = True Then
str1 = ListBox1.List(n)
End If
Next
rowbegin1 = fr2(str1, col1)
For i = rowbegin1 To blue_next(rowbegin1, col1)
If Cells(i, col1 + 1).Interior.ColorIndex = 37 Then
j = j + 1
arr(j) = Cells(i, col1 + 1).Value
End If
Next
If j <> 0 Then
ReDim Preserve arr(1 To j)
Me.ListBox2.List = arr
Else
Me.ListBox2.Clear
End If
End Sub
Private Sub ListBox2_Change()
col1 = 2
Dim arr() As String
ReDim arr(1 To 100)
j = 0
For n = 0 To ListBox2.ListCount - 1
If ListBox2.Selected(n) = True Then
str1 = ListBox2.List(n)
End If
Next
rowbegin2 = fr2(str1, col1, rowbegin1)
For i = rowbegin2 To blue_next(rowbegin2, col1)
If Cells(i, col1 + 1).Interior.ColorIndex = 37 Then
j = j + 1
arr(j) = Cells(i, col1 + 1).Value
End If
Next
If j <> 0 Then
ReDim Preserve arr(1 To j)
Me.ListBox3.List = arr
Else
Me.ListBox3.Clear
End If
End Sub
Private Sub ListBox3_Change()
col1 = 3
Dim arr() As String
ReDim arr(1 To 100)
j = 0
For n = 0 To ListBox3.ListCount - 1
If ListBox3.Selected(n) = True Then
str1 = ListBox3.List(n)
End If
Next
rowbegin3 = fr2(str1, col1, rowbegin2)
For i = rowbegin3 To blue_next(rowbegin3, col1)
If Cells(i, col1 + 1).Interior.ColorIndex = 37 Then
j = j + 1
arr(j) = Cells(i, col1 + 1).Value
End If
Next
If j <> 0 Then
ReDim Preserve arr(1 To j)
Me.ListBox4.List = arr
Else
Me.ListBox4.Clear
End If
End Sub
Private Sub ListBox4_Change()
col1 = 4
Dim arr() As String
ReDim arr(1 To 100)
j = 0
For n = 0 To ListBox4.ListCount - 1
If ListBox4.Selected(n) = True Then
str1 = ListBox4.List(n)
End If
Next
rowbegin4 = fr2(str1, col1, rowbegin3)
For i = rowbegin4 To blue_next(rowbegin4, col1)
If Cells(i, col1 + 1).Interior.ColorIndex = 37 Then
j = j + 1
arr(j) = Cells(i, col1 + 1).Value
End If
Next
If j <> 0 Then
ReDim Preserve arr(1 To j)
Me.ListBox5.List = arr
Else
Me.ListBox5.Clear
End If
End Sub
Function blue_next(row1, col1, Optional max = 10000)
b1 = ActiveSheet.UsedRange.Find(what:="*", searchorder:=xlByRows, searchdirection:=xlPrevious).row
For j = col1 To col1
For i = row1 + 1 To b1
If Cells(i, j).Interior.ColorIndex = 37 Then
b2 = i '本列中最近的,可能为空,或者可能是下一大组数据的同一列的
Exit For
End If
Next
If b2 = "" Then b2 = b1 + 1
'b1 = Application.Min(Array(b1, b2))
Next
blue_next = b2
End Function
Sub t11()
a = blue_next(81, 3)
End Sub
Private Sub UserForm_Initialize()
Dim arr() As String
ReDim arr(1 To 100)
j = 0
For i = 2 To 10000
If Cells(i, 1).Interior.ColorIndex = 37 Then
j = j + 1
arr(j) = Cells(i, 1).Value
End If
Next
ReDim Preserve arr(1 To j)
Me.ListBox1.List = arr
End Sub
Private Sub CommandButton1_Click()
For n = 0 To ListBox5.ListCount
If ListBox5.Selected(n) = True Then 'begin from 0 not 1
Call jump_to_3(ListBox5.List(n), 5, rowbegin4)
Me.Hide
Exit Sub
End If
Next
For n = 0 To ListBox4.ListCount
If ListBox4.Selected(n) = True Then 'begin from 0 not 1
Call jump_to_3(ListBox4.List(n), 4, rowbegin3)
Me.Hide
Exit Sub
End If
Next
For n = 0 To ListBox3.ListCount
If ListBox3.Selected(n) = True Then
Call jump_to_3(ListBox3.List(n), 3, rowbegin2)
Me.Hide
Exit Sub
End If
Next
For n = 0 To ListBox2.ListCount
If ListBox2.Selected(n) = True Then
Call jump_to_3(ListBox2.List(n), 2, rowbegin1)
Me.Hide
Exit Sub
End If
Next
For n = 0 To ListBox1.ListCount
If ListBox1.Selected(n) = True Then
Call jump_to_3(ListBox1.List(n), 1, 3)
Me.Hide
Exit Sub
End If
Next
End Sub
Private Sub CommandButton2_Click()
Me.Hide
End Sub
'[2]模块1
Sub jump_5()
UserForm5.Show
End Sub
Sub jump_to_3(word, col, row)
a = fr2(word, col, row)
Cells(a, col).Select
End Sub
以上是关于WPF窗体之间跳转的无缝效果的主要内容,如果未能解决你的问题,请参考以下文章