前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >WPF 制作留言板

WPF 制作留言板

作者头像
zls365
发布2020-11-10 11:16:04
4.8K0
发布2020-11-10 11:16:04
举报
文章被收录于专栏:CSharp编程大全CSharp编程大全

留言板实例:

代码语言:javascript
复制
<Window x:Class="WpfApp1.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:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="留言板" Height="240" Width="400">
    <!--Grid>
        <Button Content="打开" Name="btnCtrlOpen"  Click="btnCtrlOpen_Click" HorizontalAlignment="Left" Margin="310,115,0,0" VerticalAlignment="Top" Width="75" />
        <Button Content="关闭" Name="btnCtrlClose"  HorizontalAlignment="Left" Margin="495,115,0,0" VerticalAlignment="Top" Width="75" Click="BtnCtrlClose_Click"/>
        <Button Content="设置" Name="btnCtrlSet"  HorizontalAlignment="Left" Margin="415,200,0,0" VerticalAlignment="Top" Width="75"/>
        <Label Content="显示标签" Name="lblShow" HorizontalAlignment="Left" Margin="170,115,0,0" VerticalAlignment="Top"/>
        <Rectangle Name="Rec1" Width="200" Height="120" Fill="Blue" Margin="250,50,100,50" RadiusX="0.75" RadiusY="0.75"/>

    </-->
    <!--<Canvas Margin="50,50,50,50" Background="White" >
            <Rectangle Name="rect" Canvas.Left="300" Canvas.Top="180" Fill="Black" Stroke="Red"  Width="200" Height="200"/>
            <Ellipse  Name="el" Canvas.Left="160" Canvas.Top="150" Fill="Azure" Stroke="Green" Width="180" Height="180"/>
    </Canvas>-->
    <!--<StackPanel Margin="10,10,10,10" Background="Azure" Orientation="Vertical">
        <Label>A Button Stack</Label>
        <Button Content="Button 1"></Button>
        <Button>Button 2</Button>
        <Button>Button 3</Button>
        <Button Content="Button 4"></Button>
        <Button Content="Button 5"/>
    </StackPanel>-->
    <!--<WrapPanel Margin="10" Background="Azure">
        <Button VerticalAlignment="Top" Margin="5">Top Button</Button>
        <Button MinHeight="50">Tall Button 2</Button>
        <Button VerticalAlignment="Bottom">Bottom Button</Button>
        <Button>Stretch Button</Button>
        <Button VerticalAlignment="Center">Center Button</Button>
        <Button>Next Button</Button>
    </WrapPanel>-->
    <!--<DockPanel Margin="10" Background="Azure" LastChildFill="True">
        <Button DockPanel.Dock="Top" Background="Red">Top Button</Button>
        <Button DockPanel.Dock="Left" Background="Gray">Left Button</Button>
        <Button DockPanel.Dock="Right" Background="Green">Right Button</Button>
        <Button DockPanel.Dock="Bottom"  Background="White">Bottom Button</Button>
        <Button>Remaining Button</Button>
    </DockPanel>-->
    <!--<Grid Width="Auto" Height="Auto">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="120"/>
            <ColumnDefinition Width="150"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>
        <Rectangle Grid.Row="0" Grid.Column="0" Fill="Green" Margin="10,10,10,20"/>
        <Rectangle Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Fill="Blue" Margin="10,10,10,20"/>
        <Rectangle Grid.Row="0" Grid.Column="4" Fill="Orange"/>
        <Button Grid.Row="1" Grid.Column="0">Button 2</Button>
        <Rectangle Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Fill="Red"/>
    </Grid>-->
    <!--<UniformGrid>
        <Ellipse Margin="10" Fill="Gray"/>
        <Ellipse Margin="10" Fill="Gray"/>
        <Ellipse Margin="10" Fill="Green"/>
        <Ellipse Margin="10" Fill="Green"/>
        <Ellipse Margin="10" Fill="Red"/>
    </UniformGrid>-->
    <!--<StackPanel>
        <TextBox x:Name="textBox" Margin="5"/>
        <Button Content="OK" Margin="5" Click="Button_Click"/>
    </StackPanel>-->
    <!--<Grid Background="Azure">
        --><!--<ListBox Margin="5" ItemsSource="{x:Array Type=sys:String}"/>-->
        <!--<ListBox Margin="5" ItemsSource="{x:Array Type=sys:String}"/>--><!--
        <ListBox Margin="10,10,600,10">
            <ListBox.ItemsSource>
                <x:Array Type="sys:String">
                    <sys:String>tom1</sys:String>
                    <sys:String>tom2</sys:String>
                </x:Array>
            </ListBox.ItemsSource>

        </ListBox>
        <Button Content="Button" HorizontalAlignment="Left" Margin="217,10,0,0" VerticalAlignment="Top" Width="85" Height="46"/>
        <Button Margin="217,77,475,292" Height="50" Width="100">
            --><!--<TextBlock Text="hello"/>--><!--
            <Image Source="C:\Users\admin\source\repos\WpfApp1\WpfApp1\bin\Debug\start.png"/>
        </Button>
    </Grid>-->
    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="80"/>
            <ColumnDefinition Width="4"/>
            <ColumnDefinition Width="80"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="4"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="4"/>
            <RowDefinition Height="25"/>
        </Grid.RowDefinitions>
        <TextBlock Text="请选择您的部门并留言:" Grid.Column="0" Grid.Row="0" VerticalAlignment="Center"/>
        <ComboBox Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="4"/>
        <TextBox Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="5" BorderBrush="Black"/>
        <Button Content="提交" Grid.Column="4" Grid.Row="2"/>
        <Button Content="清除"  Grid.Column="4" Grid.Row="4"/>
    </Grid>
</Window>

运行结果:

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-11-05,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 CSharp编程大全 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档