Chia sẻ

Chúng ta sẽ cùng nhau tìm hiểu cách đặt độ mờ cho hình ảnh trong WPF (Set opacity for Image in WPF). Kết quả thu được như sau:

Mã XAML

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WPF" Height="300" Width="400">
<StackPanel Orientation="Horizontal">
<Image Margin="-30" Opacity=".7" Source="c:image.gif"
ToolTip="Middle Image" Width="150" />
</StackPanel>
</Window>
<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WPF" Height="300" Width="400"> <StackPanel Orientation="Horizontal"> <Image Margin="-30" Opacity=".7" Source="c:image.gif" ToolTip="Middle Image" Width="150" /> </StackPanel> </Window>
<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="300" Width="400">
    <StackPanel Orientation="Horizontal">
        <Image Margin="-30" Opacity=".7" Source="c:image.gif"
               ToolTip="Middle Image" Width="150" />
    </StackPanel>
</Window>

Chúc thành công !

ĐĂNG KÝ MUA HÀNG

    Email (*)

    Điện thoại (*)

    Tên sản phẩm/Dịch vụ:


    Chia sẻ
    Xem thêm  [WPF] Hướng dẫn Bind Label to ScrollBar trong WPF

    Trả lời

    Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *