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 ...
随机推荐
- 【NOIP TG 解方程】
存代码: #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> ...
- Cppcheck 用法(上篇)
http://blog.csdn.net/u011012932/article/details/52778149
- 【HDOJ】1260 Tickets
水DP,不过这道题目的数据好像有问题.24时制可表示范围是0~23,12时制可表示范围应为1~12.也就是说24点(即0点)其实表示为12:00:00am,而中午12:00:00其实表示为12:00: ...
- wzplayer2 for windows ActiveX 试用地址
提供wzplayer2 for windows ActiveX,测试地址:http://www.coolradio.cn/IE.htm 大家使用时候必须允许未签名ActiveX下载和运行,否则将无法正 ...
- Android开发UI之Toast的使用
Toast,A toast provides simple feedback about an operation in a small popup. 对于操作提供一个简单反馈信息. 官网链接:htt ...
- hadoop 序列化源码浅析
1.Writable接口 Hadoop 并没有使用 JAVA 的序列化,而是引入了自己实的序列化系统, package org.apache.hadoop.io 这个包中定义了大量的可 ...
- 【转】win7与VMware ubuntu虚拟机实现文件共享(最后一定要装open-vm-dkms插件)
原文网址:http://blog.sina.com.cn/s/blog_453b9efb01019hpl.html 一般来说,由于一些特殊的需要,会在Win7系统中利用虚拟机(VMware)安装ubu ...
- 016专家视图测试脚本开发- Environment对象的使用;Msgbox和Print的区别
(1)读取Built-in 'file -> settings -> Enrionment -> variable type 为 Built-in os = Environment. ...
- 【原】1.1RDD源码解读(一)
1.RDD(Resilient Distributed DataSet)是Spark生态系统中最基本的抽象,代表不可变的.可并行操作的分区元素集合.RDD这个类有RDD系列所有基本的操作,比如map. ...
- vijos P1459 车展(Treap,中位数)
P1459车展 描述 遥控车是在是太漂亮了,韵韵的好朋友都想来参观,所以游乐园决定举办m次车展.车库里共有n辆车,从左到右依次编号为1,2,…,n,每辆车都有一个展台.刚开始每个展台都有一个唯一的 ...