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 ...
随机推荐
- PHP strip_tags() 函数
定义和用法 strip_tags() 函数剥去 HTML.XML 以及 PHP 的标签. 语法 strip_tags(string,allow) 参数 描述 string 必需.规定要检查的字符串. ...
- 164. Maximum Gap
题目: Given an unsorted array, find the maximum difference between the successive elements in its sort ...
- x+2y+3z=n的非负整数解数
题目:给一个正整数n,范围是[1,10^6],对于方程:x+2y+3z = n,其中x,y,z为非负整数,求有多少个这样的三元组 (x,y,z)满足此等式. 分析:先看x+2y=m,很明显这个等式的非 ...
- 解决在IE里预览时弹出:为了有利于保护安全性......
用Dreamweaver做网页,在IE里预览时弹出这个:为了有利于保护安全性,Internet Explorer 已限制此网页运行可以访问计算机的脚本或ActiveX控件. 在页面顶部加段代码就可以了 ...
- hadoop2.2编程:矩阵相乘简单实现
/* matrix-matrix multiplication on Hadoop A x B = C constraint: A, B, C must be of the same size I u ...
- 【转】win7 旗舰版激活密钥
原文网址:http://zhidao.baidu.com/question/1496641289562471179.html 旗舰版KH2J9-PC326-T44D4-39H6V-TVPBYTFP9Y ...
- Servlet能读到JSessionID,读不到其它cookie问题
Servlet的Cookie值保存与获取 今天测试设置和获取Cookie遇到了一点小问题,很奇怪的问题: 把J2ee服务部署在本地 8080端口:访问任何一个服务时,如果客户端没有cookie,则下发 ...
- HDU 1518
思路:从第一个数开始搜索,将其和与边长比对,相等则计数+1,计数达到3的时候说明可以组成,因为剩下那条必与边长相等,搜索过程注意剪枝,若某个数已被加入边长则不能重复计算,应将其标记,另外应在每一层递归 ...
- selenium 处理浏览器多窗口
测试过程中,会弹出一些子窗口,并且有可能在多个窗口之间切换 必须要获取每个窗口的唯一标识符切换到该窗口,才能对该窗口的元素进行操作 首先,获取每个窗口的唯一标识符,然后以及和的形式返回 var mai ...
- eclipse tomcat内存溢出,加大内存
保存图片失败,请点击这里获得详细信息. 加入 -Xms256M -Xmx512M -XX:PermSize=256m -XX:MaxPermSize=512m