zoukankan      html  css  js  c++  java
  • 如何绘制与配置2D图形界面

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="521.082" Width="525">
        <Grid Name="grid">
            <Line Name="line" X1="10" Y1="10" X2="100" Y2="100" Stroke="Black" VerticalAlignment="Center"></Line>
            <Ellipse Name="ellipse" Fill="Red" HorizontalAlignment="Left" Height="112" Margin="187,66,0,0" Stroke="Black" VerticalAlignment="Top" Width="167"/>
            <Button Content="Button" HorizontalAlignment="Left" Margin="53,73,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/>
            <Canvas HorizontalAlignment="Left" Height="156" Margin="189,313,0,0" VerticalAlignment="Top" Width="158">
                <Ellipse Height="100" Canvas.Left="31" Stroke="Black" Canvas.Top="29" Width="100"/>
            </Canvas>
            <Path Stroke="Red" StrokeThickness="5" Data="M30,30 Q 60,30 30,90"></Path>
            <Polygon Stroke="Blue" StrokeThickness="4" Points="40,100 80,120 60,160">
                <Polygon.Fill>
                    <SolidColorBrush Color="Yellow"></SolidColorBrush>
                </Polygon.Fill>
            </Polygon>
            <Canvas Width="100" Height="100">
                <Ellipse Fill="Yellow" Stroke="Black"
                        StrokeThickness="7"
                        Width="100" Height="100"></Ellipse>
                <Ellipse Fill="Black" Width="10" Height="15"
                         Canvas.Left="28" Canvas.Top="28"></Ellipse>
                <Ellipse Fill="Black" x:Name="myEllipse"
                         Width="10" Height="15"
                         Canvas.Left="62" Canvas.Top="28"></Ellipse>
                <Path Stroke="Black" StrokeThickness="6" Data="M30,60 Q 50,90 70,60"></Path>
            </Canvas>
        </Grid>
    </Window>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    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 WpfApplication1
    {
        /// <summary>
        /// MainWindow.xaml 的交互逻辑
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }
    
            private void Button_Click_1(object sender, RoutedEventArgs e)
            {
                Line l1 = new Line();
                l1.X1 = 100;
                l1.Y1 = 100;
                l1.X2 = 500;
                l1.Y2 = 100;
                l1.Stroke = new SolidColorBrush(Color.FromRgb(0,0,225));
                l1.StrokeThickness = 2;
                grid.Children.Add(l1);
    
                ellipse.Height = 218;
                
            }
    
        }
    }

  • 相关阅读:
    Mac下持续集成-查看占用的端口及kill
    windons模拟linux终端工具----cmder
    windows中使用django时报错:A server error occurred. Please contact the administrator.
    Pycharm和Navicat免费全功能版资源(即破解版)
    git常用命令
    pycharm常用的快捷键
    CSS3的媒体查询
    CSS列表中与list-style=none等价的样式
    CSS3中的mouse事件(mouseleave,mouseenter,mouseout,mouseover)
    CSS层级(浮动,定位的层级提升)
  • 原文地址:https://www.cnblogs.com/hushzhang/p/5895414.html
Copyright © 2011-2022 走看看