wpf ,PNG图形半透明窗体 ,使用webbrowser控件
MainWindow1.XAML
<Window x:Name="MainWindow1" x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="完美世界更新程序" Height="800" Width="984"
WindowStyle="None" WindowStartupLocation="CenterScreen"
Background="Transparent" OpacityMask="White" AllowsTransparency="True" Loaded="MainWindow1_Loaded" Closed="MainWindow1_Closed" LocationChanged="MainWindow1_LocationChanged"
>
<Grid>
<Image Name="image1" Stretch="Fill" Source="main-bg.png" StretchDirection="Both" Width="984" Height="747" Margin="0,0,0,53" MouseDown="image1_MouseDown" />
<Button Content="--" HorizontalAlignment="Left" Margin="646.154,337.884,0,0" VerticalAlignment="Top" Width="50.769" Click="Button_Click_1"/>
<Button Content="X" HorizontalAlignment="Left" Margin="701.923,337.884,0,0" VerticalAlignment="Top" Width="51.154" Click="Button_Click"/>
<Button Content="dlg" HorizontalAlignment="Left" Margin="726.154,635.384,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_2"/>
<Border x:Name="border1" BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="218.461" Margin="235.576,375.578,0,0" VerticalAlignment="Top" Width="516.155"/>
</Grid>
</Window>
MainWindow1.XAML.CS
using System;
using System.Collections.Generic;
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 System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
Window1 window1 = new Window1();
private void InitialWindow1()
{
window1.WindowStyle = System.Windows.WindowStyle.None;
window1.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
window1.ResizeMode = System.Windows.ResizeMode.NoResize;
window1.ShowInTaskbar = false;
window1.webBrowser1.Navigate(new Uri("http://w2i.wanmei.com/launcher/index.htm"));
window1.Owner = this;
window1.Show();
}
//下面效果正确的前提 主窗体的 WindowStyle = System.Windows.WindowStyle.None;
private void MoveWindow1()
{
window1.Left = MainWindow1.Left + border1.Margin.Left;
window1.Top = MainWindow1.Top + border1.Margin.Top;
window1.Width = border1.Width;
window1.Height = border1.Height;
}
private void image1_MouseDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
MainWindow1.WindowState = System.Windows.WindowState.Minimized;
}
private void MainWindow1_Loaded(object sender, RoutedEventArgs e)
{
border1.Visibility = System.Windows.Visibility.Hidden;
InitialWindow1();
MoveWindow1();
}
private void MainWindow1_Closed(object sender, EventArgs e)
{
window1.Close();
}
private void MainWindow1_LocationChanged(object sender, EventArgs e)
{
MoveWindow1();
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
Window2 window2 = new Window2();
if (window2.ShowDialog() == true)
{
MessageBox.Show("U pressed Ok Button!");
}
}
}
}

window1.xaml

<Window x:Class="WpfApplication1.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="385" Width="515" AllowsTransparency="True"
Background="Transparent" OpacityMask="White" WindowStyle="None"
ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<Image Name="image1" Stretch="Fill" Source="video-bg.png" StretchDirection="Both" Width="515" Height="385" Margin="0,-2.308,0,2.307" MouseDown="image1_MouseDown" />
<Button Content="OK" HorizontalAlignment="Left" Margin="221,304.615,0,0" VerticalAlignment="Top" Width="75" IsDefault="True" Click="Button_Click"/>
<Button Content=" Cancel" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="307,304.615,0,0" IsCancel="True"/>
<Label Content="this ShowDialog Window" HorizontalAlignment="Left" Height="60" Margin="131,126.461,0,0" VerticalAlignment="Top" Width="193.846" Background="#FFEE0F0F"/>
</Grid>
</Window>
windows2.xaml.cs
using System;
using System.Collections.Generic;
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 System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Window2.xaml 的交互逻辑
/// </summary>
public partial class Window2 : Window
{
public Window2()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void image1_MouseDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
}
}


- WPF实现窗体中的悬浮按钮
WPF实现窗体中的悬浮按钮,按钮可拖动,吸附停靠在窗体边缘. 控件XAML代码: <Button x:Class="SunCreate.Common.Controls.FloatBut ...
- WPF透明窗体制作
原文:WPF透明窗体制作 窗体的样式: <Grid Width="{Binding Width, ElementName=w}" Height="{Binding ...
- WPF透明窗体不支持缩放解决方案
方案一 WPF中的无边框透明窗体,由于没有边并且透明,窗体无法进行缩放操作,今天来讲解如何解决这个问题. 先说一下思路,我们先手为该窗体添加4个边,4个角用于缩放操作,然后再为他们写事件,完成拖放操作 ...
- WPF 透明窗体
窗体属性中设置:Background="Transparent" AllowsTransparency="True" WindowStyle="Non ...
- 关于WinForm引用WPF窗体---在Winform窗体中使用WPF控件
项目中有个界面展示用WPF实现起来比较简单,并且能提供更酷炫的效果,但是在WinForm中使用WPF窗体出现了问题,在网上找了一下有些人说Winform不能引用WPF的窗体,我就很纳闷,Win32都能 ...
- WPF中嵌入WinForm中的webbrowser控件
原文:WPF中嵌入WinForm中的webbrowser控件 使用VS2008创建WPF应用程序,需使用webbrowser.从工具箱中添加WPF组件中的webbrowser发现其中有很多属性事件不能 ...
- 在Winform窗体中使用WPF控件(附源码)
原文:在Winform窗体中使用WPF控件(附源码) 今天是礼拜6,下雨,没有外出,闲暇就写一篇博文讲下如何在Winform中使用WPF控件.原有是我在百度上搜索相关信息无果,遂干脆动手自己实现. W ...
- 在WPF中嵌入WebBrowser可视化页面
无论是哪种C/S技术,涉及数据可视化就非常的累赘了,当然大神也一定有,只不过面向大多数人,还是通过网页来实现,有的时候不想把这两个功能分开,一般会是客户的原因,所以我们打算在WPF中嵌入WebBrow ...
- WPF中禁止WebBrowser控件打开新窗口
一.针对纯WPF的WebBrowser控件: <summary> Suppress Script Errors In WPF WebBrowser </summary> pub ...
随机推荐
- Altium快捷键
M快捷键 PCB快捷键 编辑 视图
- 【Linux远程管理】RDP协议远程管理
RDP(Remote Desk Protocol).远程桌面协议,常用的Windows操作系统的远程桌面管理就就是基于该协议. 而在Linux下,我们也是可以找到开源的rdp server的,这就是x ...
- Ember.js demo3
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...
- 【HDOJ】1114 Piggy-Bank
DP,先将coins按照重量排序可以优化. #include <stdio.h> #include <stdlib.h> #define MAXNUM 10005 #defin ...
- string.Split函数
正文 string str = "a---b---c"; string[] array = str.Split(new char[]{'-'}); 分割之后array中的元素为 分 ...
- Codevs_1166_[NOIP2007]_矩阵取数游戏_(动态规划+高精度)
描述 http://codevs.cn/problem/1166/ 分析 #include <iostream> #include <cstring> #include < ...
- UVA_11468_Substring_(AC自动机+概率动态规划)
描述 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...
- phpcms 2008 /preview.php SQL注入漏洞
漏洞版本: phpcms 2008 漏洞描述: phpcms2008 是一款基于 PHP+Mysql 架构的网站内容管理系统,也是一个开源的 PHP 开发平台. phpcms 2008的preview ...
- BZOJ3166: [Heoi2013]Alo
3166: [Heoi2013]Alo Time Limit: 20 Sec Memory Limit: 256 MBSubmit: 394 Solved: 204[Submit][Status] ...
- (转载)SQL Server 2005 日志文件过大处理
由于安装的时候没有计划好空间,默认装在系统盘,而且又没有做自动备份.截断事务日志等,很快LDF文件就达到十几G,或者几十G ,此时就不得不处理了. 备份和计划就不说了,现在就说下怎么把它先删除吧: 1 ...