随笔分类 - WPF
WPF
摘要:首先需要在项目中引用System.Windows.Forms,System.Drawing;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using Syst
阅读全文
摘要:在WPF 中可以使用MediaElement 为应用程序添加媒体播放控件,以完成播放音频、视频功能。由于MediaElement 属于UIElement,所以它同时也支持鼠标及键盘的操作。本篇将使用MediaElement类和Windows API Code Pack创建一个简单的视频播放器实现一些基本功能。界面框架 在XAML 中放入一个MediaElement 控件(支持视频播放),五个Button 控件(分别用于“打开视频文档”、“播放/暂停”、“停止”、“快退”、“快进”),一个Slider 控件(控制音量)。<StackPanel HorizontalAlignment=&qu
阅读全文
摘要:<Windowx:Class="WPFFolderExplorer.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:my="clr-namespace:WPFFolderExplorer" Title="Folder Explorer"Height="3
阅读全文
摘要:原理为:打开子窗体时,把父窗体的引用传入到子窗体,然后在子窗体中对引用进行操作。父窗体代码:private void button1_Click(object sender, RoutedEventArgs e){ Window2 win = new Window2(this); win.Owner = this; win.ShowDialog(); }子窗体代码: Window1 win; public Window2(Window1 win1) { InitializeComponent...
阅读全文