private void Window_Loaded(object sender, RoutedEventArgs e) { try { VistaGlassHelper.ExtendGlass(this, -20, -20, -20, -20); } catch { this.Background = Brushes.White; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { VistaGlassHelper.ExtendGlass(this, -3, -3, -3, -3); } // If not Vista, paint background white. catch //(DllNotFoundException) { this.Background = Brushes.White; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { VistaGlassHelper.ExtendGlass(this, 2, 2, 2, 2); } catch { this.Background = System.Windows.Media.Brushes.White; } document.Load(@"E:\Project\TimeDeal\TimeDeal\TimeDeal\Th.xml"); }
/// <summary> /// 窗体载入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { //Vista Glass效果 try { VistaGlassHelper.ExtendGlass(this, -3, -3, -3, -3); } catch { this.Background = Brushes.White; } //初始化ListView_Music ListView_Bind(); }
public static void ExtendGlass(Window win, int left, int right, int top, int bottom) { // Obtain the window handle for WPF application WindowInteropHelper windowInterop = new WindowInteropHelper(win); IntPtr windowHandle = windowInterop.Handle; HwndSource mainWindowSrc = HwndSource.FromHwnd(windowHandle); mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent; VistaGlassHelper.Margins margins = VistaGlassHelper.GetDpiAdjustedMargins(windowHandle, left, right, top, bottom); int returnVal = VistaGlassHelper.DwmExtendFrameIntoClientArea(mainWindowSrc.Handle, ref margins); if (returnVal < 0) { throw new NotSupportedException("Operation failed."); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { VistaGlassHelper.ExtendGlass(this, -3, -3, -3, -3); } catch { this.Background = Brushes.White; } dt.Columns.Add("Title", typeof(string)); dt.Columns.Add("Content", typeof(string)); dt.Columns.Add("Time", typeof(string)); dt.Columns.Add("Music", typeof(string)); document.Load(@"E:\Project\TimeDeal\TimeDeal\TimeDeal\Th.xml"); root = document.DocumentElement; listView1_Bind(); }