首页 > 其他分享 >WPF LinearGradientBrush StartPoint EndPoint

WPF LinearGradientBrush StartPoint EndPoint

时间:2024-12-22 21:53:07浏览次数:8  
标签:WPF EndPoint StartPoint LinearGradientBrush

<Window x:Class="WpfApp92.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp92"
        WindowState="Maximized"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Ellipse Grid.Column="0">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.0" Color="Blue"/>
                    <GradientStop Offset="1.0" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse Grid.Column="1">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                    <GradientStop Offset="0.0" Color="Blue"/>
                    <GradientStop Offset="1.0" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse Grid.Column="2">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                    <GradientStop Offset="0.0" Color="Blue"/>
                    <GradientStop Offset="1.0" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse Grid.Column="3">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="1,0">
                    <GradientStop Offset="0.0" Color="Blue"/>
                    <GradientStop Offset="1.0" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse Grid.Column="4">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="-2,2" EndPoint="2,2">
                    <GradientStop Offset="0.0" Color="Blue"/>
                    <GradientStop Offset="1.0" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
    </Grid>
</Window>

 

标签:WPF,EndPoint,StartPoint,LinearGradientBrush
From: https://www.cnblogs.com/Fred1987/p/18622626

相关文章

  • WPF HitTestResult
    usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;usingSystem.Windows.Media;usingSystem.Windows.Media.Imaging;usingSystem.Windows.Navigation;......
  • WPF实现加载的动态效果
         思路:1.创建一个画布,长宽100*100;<CanvasWidth="100"Height="100">2.画布上创建一个圆,直径25,位于正上方中间,底色浅灰;<StyleTargetType="Ellipse"><SetterProperty="Width"Value="25"/>......
  • Wpf Prism中添加新控件的区域适配器
    上节中我们讲了怎么样定义一个区域与区域引用视图,但并不是所有的组件都支持组件当作区域使用,比如StackPanel就不支持当作区域来使用:我们自接使用会报以下错误,这时候我们就要自定义一个区域适配器: 1.首先我们创建一个StackPanelRegionAdapter的类:1usingPrism.Regions;2......
  • wpf Prism中区域的使用
    1.首先,我们创建一个区域内容,这里我们创建一个ViewA使用UseControl这个就是普通的UseControl,只是加了个TextBlock,显示ViewAViewA.xaml1<UserControlx:Class="MyTest.ViewA"2xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"3......
  • Wpf加入Prism框架
          Prism是一个开源框架,用于在WPF、XamarinForms、Uno/WinUI等应用中创建松耦合、可维护、可测试的XAML应用程序。Prism提供了一组设计模式的实现,这些设计模式有助于编写结构良好且可维护的XAML应用程序,包括MVVM,dependencyinjection,commands,EventAggregator等......
  • WPF DrawingVisual DrawingContext DrawImage RenderTargetBitmap
    usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;......
  • 一个使用 WPF 开发的管理系统
    一个使用WPF开发的管理系统 思维导航前言WPF介绍项目技术栈项目源码结构项目运行截图项目源码地址优秀项目和框架精选前言最近发现有不少小伙伴在学习 WPF,今天大姚给大家分享一个使用WPF开发的管理系统,该项目包含了用户登录、人员管理、角色授权、插件管......
  • WPF call graphic draw functions via bitmap converting to bitmapimage
    usingSystem;usingSystem.Collections.Generic;usingSystem.Drawing;usingSystem.IO;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows......
  • WPF GeometryDrawing
    <Windowx:Class="WpfApp76.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.......
  • WPF DashStyles,Solid,Dash,Dot,DashDot,DashDotDot
    <Windowx:Class="WpfApp73.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.......