想达到的效果是。两张图片重叠。鼠标在第一张上面滑动,鼠标滑过的地方变为透明能看到下面的一张。请问如何去动态的修改图片单个像素的透明度啊。。先谢谢啦。
解决方案 »
- c#同一工具栏按钮,当打开不同TABPAGE页面中时,实现不能的功能
- 仿QQ~~~急!!!给分!!!
- C#实现ftp的RequestUri段转义问题
- 我用Vmware虚拟机来测试软件,如何使虚拟机与本机进行网络共享?让虚拟机可以用到本机的文件。
- 如何写一个函数返回一个xml文件
- 穷人求救:我的分没有了,可是还想再发一个问题,有分的时候再加给你们吧,请看看……
- zedgraph怎么判断点在图的什么位置?
- 无法引用system.threading.tasks
- 100分相送:datagrid+数据更新问题
- win10的出现,能否给C#辉煌
- C#调用C++DLL时,参数为结构体指针类型
- 求助,极坐标转换为平面直角坐标,连点描线,哪儿出错了呢 ?
问一个问题。pictureBox透明问题怎么解决呀。我现在像素问题解决了,可是像素透明了以后 pictureBox这个控件不透明。。郁闷。
<Window x:Class="WpfApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="810" Width="972">
<Canvas Name="canvas1" Background="#FF3E3D3D">
<Image Canvas.Left="90" Canvas.Top="12" Name="image1" Stretch="Fill" MouseLeftButtonDown="image1_MouseLeftButtonDown" SnapsToDevicePixels="True" MouseMove="image1_MouseMove" MouseLeftButtonUp="image1_MouseLeftButtonUp" MouseLeave="image1_MouseLeave" />
</Canvas>
</Window>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 System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;namespace WpfApp
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.image1.Source = wb;
}
WriteableBitmap wb = new WriteableBitmap(new BitmapImage(new Uri(@"C:\Users\Administrator\Desktop\WpfApp\WpfApp\sunset.png"))); bool f = false;
private void image1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
f = true;
}
private static byte[] _colorArray = new byte[16] { 245, 255, 255, 0, 245, 255, 255, 0, 245, 255, 255, 0, 245, 255, 255, 0 }; private void image1_MouseMove(object sender, MouseEventArgs e)
{
if (f)
{
Point pt = e.GetPosition(this.image1); if (pt.X > wb.Width)
{
return;
} if (pt.Y > wb.Height)
{
return;
}
wb.WritePixels(new Int32Rect((int)pt.X, (int)pt.Y, 2, 2), _colorArray, 8, 0);
this.image1.Source = wb;
}
} private void image1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
f = false;
} private void image1_MouseLeave(object sender, MouseEventArgs e)
{
f = false;
}
}
}