首页 > 其他分享 >WPF StreamGeometry

WPF StreamGeometry

时间:2024-06-15 21:54:16浏览次数:8  
标签:Windows System StreamGeometry streamGeo new using WPF true

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
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 WpfApp171
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.WindowState = WindowState.Maximized;
            StreamGeometryDemo();
        }

        private void StreamGeometryDemo()
        {
            Path ph = new Path();
            ph.Stroke = new SolidColorBrush(Colors.Red);
            ph.StrokeThickness = 10;

            StreamGeometry streamGeo = new StreamGeometry();
            streamGeo.FillRule = FillRule.EvenOdd;
            using (StreamGeometryContext context = streamGeo.Open())
            {
                context.BeginFigure(new Point(100, 800), true,true);
                context.LineTo(new Point(1500, 800), true, true);
                context.LineTo(new Point(1500, 100), true, true); 
            }

            streamGeo.Freeze();
            this.Title = streamGeo.GetArea().ToString();
            ph.Data=streamGeo;
            this.Content = ph;
        }
    }
}

 

标签:Windows,System,StreamGeometry,streamGeo,new,using,WPF,true
From: https://www.cnblogs.com/Fred1987/p/18249804

相关文章

  • WPF Path Data PathGeometry PathFigure Segments BezierSegment,LineSegment,ArcSeg
     BezierSegment//BezierCurveusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documen......
  • WPF Stretch None,Fill,Uniform,UnformToFill
    None, Thecontentpreservesitsoriginalsize.<ImageSource="/WpfApp169;component/cl.jpg"Stretch="None"/> Fill,Thecontentisresizedtofillthedestinationdimensions.Theaspectratioisnotpreserved.<ImageSource=......
  • WPF Image Image clip EllipseGeometry
    <Windowx:Class="WpfApp169.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 CanFreeze,Freeze(),IsFrozen frozen clone,freeze() it is in a read-only state
    <Windowx:Class="WpfApp168.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 Path LineGeometry,RectangleGeometry,EllipseGeometry
    usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Runtime.CompilerServices;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows......
  • WPF RenderTargetBitmap DrawingVisual DrawingContext DrawImage DrawRectangle Draw
    usingSystem;usingSystem.Collections.Generic;usingSystem.Globalization;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;......
  • WPF Image ZoomIn ZoomOut Pan/Move Rotate
    <Windowx:Class="WpfApp162.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft......
  • wpfui:一个开源免费具有现代化设计趋势的WPF控件库
    wpfui介绍wpfui是一款开源免费(MIT协议)具有现代化设计趋势的WPF界面库。wpfui为wpf的界面开发提供了流畅的体验,提供了一个简单的方法,让使用WPF编写的应用程序跟上现代设计趋势。截止写这篇文章,该项目获得了6.7kstarts。最近我也在使用wpfui,整体使用下来感觉非常不错,因此想写一......
  • DevExpress WPF中文教程:Grid - 如何完成列和编辑器配置(设计时)?
    DevExpressWPF拥有120+个控件和库,将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpressWPF能创建有着强大互动功能的XAML基础应用程序,这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。无论是Office办公软件的衍伸产品,还是以数据为中心......
  • WPF-DataGrid 样式设置
    在wpf中使用DataGrid虽然方便,但是其默认样式往往很难满足需求,而修改模板往往由比较麻烦,很多时候我们会用ListBox或ListView+DataTemplate来实现同样效果,但为了有些时候需要应用,这里记录一下一些基本属性设置方法,以免忘记。code<Windowx:Class="WpfApp7.MainWindow"......