国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

WPF 啟動(dòng)項(xiàng)目 Grid、StackPanel 布局

這篇具有很好參考價(jià)值的文章主要介紹了WPF 啟動(dòng)項(xiàng)目 Grid、StackPanel 布局。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

WPF 啟動(dòng)項(xiàng)目

<!--x:Class="WPF_Study.App"  對(duì)應(yīng)類:WPF_Study.App-->
<!--xmlns:local="clr-namespace:WPF_Study"  命名空間:WPF_Study-->
<Application x:Class="WPF_Study.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:WPF_Study"
             StartupUri="MainWindow.xaml">
    
    <!--StartupUri="MainWindow.xaml"  啟動(dòng)界面:MainWindow.xaml-->
    <Application.Resources>
         
    </Application.Resources>
</Application>

<!--x:Class="WPF_Study.App"  對(duì)應(yīng)類:WPF_Study.App-->
<!--xmlns:local="clr-namespace:WPF_Study"  命名空間:WPF_Study-->
<!--StartupUri="MainWindow.xaml"  啟動(dòng)界面:MainWindow.xaml-->

Grid布局

<Window x:Class="WPF_Study.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:WPF_Study"
        mc:Ignorable="d"
        Title="WPF入門" Height="600" Width="800">
    <Grid>
        <Button HorizontalAlignment="Left" VerticalAlignment="Top" Width="200" Height="40" Content="你好"/>
        <Button HorizontalAlignment="Right" VerticalAlignment="Top" Width="200" Height="40" Content="你好"/>
        <Button HorizontalAlignment="Center" VerticalAlignment="Top" Width="200" Height="40" Content="你好"/>

        <Button HorizontalAlignment="Left" VerticalAlignment="Center" Width="200" Height="40" Content="你好"/>
        <Button HorizontalAlignment="Right" VerticalAlignment="Center" Width="200" Height="40" Content="你好"/>
        <Button HorizontalAlignment="Center" VerticalAlignment="Center" Width="200" Height="40" Content="你好"/>

        <Button HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="200" Height="40" Content="你好"/>
        <Button HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Height="40" Content="你好"/>
        <Button HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="200" Height="40" Content="你好"/>
    </Grid>
</Window>

模擬布局

WPF 啟動(dòng)項(xiàng)目 Grid、StackPanel 布局,C#,wpf

<Window x:Class="WPF_Study.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:WPF_Study"
        mc:Ignorable="d"
        Title="WPF入門" Height="600" Width="800">
    <Grid ShowGridLines="True" Background="DimGray">
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="20"/>
            <RowDefinition/>
            <RowDefinition Height="20"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
            <Button Content="?文件" Width="70" Height="20"/>
            <Button Content="編輯" Width="70" Height="20"/>
            <Button Content="查看" Width="70" Height="20"/>

            <Button Content="外觀" Width="70" Height="20"/>
            <Button Content="設(shè)置" Width="70" Height="20"/>
            <Button Content="幫助" Width="70" Height="20"/>
        </StackPanel>

        <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
            <Button Content="?1" Width="20" Height="20"/>
            <Button Content="2" Width="20" Height="20"/>
            <Button Content="3" Width="20" Height="20"/>

            <Button Content="4" Width="20" Height="20"/>
            <Button Content="5" Width="20" Height="20"/>
            <Button Content="6" Width="20" Height="20"/>
        </StackPanel>

        <Grid Background="Gray" Grid.Row="2" Grid.Column="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="70"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <StackPanel Grid.Row="0" Grid.Column="0">
                <Button Height="20" Content="1"/>
                <Button Height="20" Content="2"/>
                <Button Height="20" Content="3"/>
                <Button Height="20" Content="4"/>
                <Button Height="20" Content="5"/>
                <Button Height="20" Content="6"/>
            </StackPanel>

            <TextBox Grid.Row="0" Grid.Column="1" TextWrapping="Wrap"/>
        </Grid>

        <Grid Grid.Row="3" Grid.Column="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Button Grid.Row="0" Grid.Column="0" Content="行 8/11" />
            <Button Grid.Row="0" Grid.Column="1" Content="列 3/2" />
            <Button Grid.Row="0" Grid.Column="2" Content="字符 3/2" />
            <Button Grid.Row="0" Grid.Column="3" Content="求值 --" />
            <Button Grid.Row="0" Grid.Column="4" Content="選定 --" />
            <Button Grid.Row="0" Grid.Column="5" Content="選行 --" />
            <Button Grid.Row="0" Grid.Column="6" Content="匹配 --" />

            <Button Grid.Row="0" Grid.Column="7" Content="求值 --" />
            <Button Grid.Row="0" Grid.Column="8" Content="選定 --" />
            <Button Grid.Row="0" Grid.Column="9" Content="選行 --" />
            <Button Grid.Row="0" Grid.Column="10" Content="匹配 --" />
            <Button Grid.Row="0" Grid.Column="11" Content="字符 3/2" />
        </Grid>
    </Grid>
</Window>

設(shè)置布局

1.固定像素布局 Width = “200”
2.比例布局 Width = “1*”
3.內(nèi)容長(zhǎng)度自動(dòng)布局 Width = “AUTO”
WPF 啟動(dòng)項(xiàng)目 Grid、StackPanel 布局,C#,wpf文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-835352.html

<Window x:Class="WPF_Study.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:WPF_Study"
        mc:Ignorable="d"
        Title="WPF入門" Height="600" Width="800">
    <Grid ShowGridLines="True">
        <!--定義分行-->
        <Grid.RowDefinitions>
            <!--1* 按照比例分配  1/(1+2) = 1/3-->
            <RowDefinition Height="1*"/>
            <!--2* 按照比例分配  2/(1+2) = 2/3-->
            <RowDefinition Height="2*"/>
        </Grid.RowDefinitions>

        <!--定義分列-->
        <Grid.ColumnDefinitions>
            <!--Width="AUTO" 根據(jù)內(nèi)容寬度變化-->
            <ColumnDefinition Width="AUTO"/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Button Grid.Column="0" Grid.Row="0" Content="0,0" Width="100" />
        <Button Grid.Column="2" Grid.Row="1" Content="1,2" />
    </Grid>
</Window>

到了這里,關(guān)于WPF 啟動(dòng)項(xiàng)目 Grid、StackPanel 布局的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • WPF 組態(tài)軟件實(shí)現(xiàn)思路(WPF控件可視化布局)

    WPF 組態(tài)軟件實(shí)現(xiàn)思路(WPF控件可視化布局)

    一、實(shí)現(xiàn)控件選中及自由拖動(dòng) 二、實(shí)現(xiàn)控件對(duì)齊功能 三、實(shí)現(xiàn)對(duì)齊輔助線功能 四、實(shí)現(xiàn)框選功能 GitHub地址點(diǎn)此 屬性編輯控件基于Devexpress V21.2.3 控件庫(kù),如需編譯需購(gòu)買及安裝 Devexpress V21.2.3 開(kāi)發(fā)庫(kù) 腳本編輯基于AvalonEdit開(kāi)源庫(kù) https://github.com/icsharpcode/AvalonEdit 圖標(biāo)控件基于

    2024年02月04日
    瀏覽(66)
  • WPF 零基礎(chǔ)入門筆記(1):WPF靜態(tài)頁(yè)面,布局+樣式+觸發(fā)器

    WPF 零基礎(chǔ)入門筆記(1):WPF靜態(tài)頁(yè)面,布局+樣式+觸發(fā)器

    WPF 零基礎(chǔ)入門筆記(0):WPF簡(jiǎn)介 WPF MaterialDesign 初學(xué)項(xiàng)目實(shí)戰(zhàn)(0):github 項(xiàng)目Demo運(yùn)行 WPF MaterialDesign 初學(xué)項(xiàng)目實(shí)戰(zhàn)(1)首頁(yè)搭建 WPF MaterialDesign 初學(xué)項(xiàng)目實(shí)戰(zhàn)(2)首頁(yè)導(dǎo)航欄樣式 WPF MaterialDesign 初學(xué)項(xiàng)目實(shí)戰(zhàn)(3)動(dòng)態(tài)側(cè)邊欄 WPF MaterialDesign 初學(xué)項(xiàng)目實(shí)戰(zhàn)(4)側(cè)邊欄路由管理

    2024年02月11日
    瀏覽(52)
  • (四)WPF - 布局

    WPF 布局包括兩個(gè)階段: 一個(gè)測(cè)量階段和排列階段 在測(cè)量階段,容器遍歷所有子元素,并詢問(wèn)子元素它們所期望的尺寸。 在排列階段,容器在合適的位置放置子元素。(每個(gè)元素都被其父元素告知它自己的尺寸是多少以設(shè)定尺寸和位置) 這兩個(gè)階段讓父和子元素能夠協(xié)商需

    2024年02月10日
    瀏覽(26)
  • WPF_布局基礎(chǔ)

    WPF_布局基礎(chǔ)

    定義由列和行組成的靈活的網(wǎng)格區(qū)域。 行 列 背景 尺寸 自動(dòng)適應(yīng):以所在行的元素最高尺寸為標(biāo)準(zhǔn)來(lái)定義行高。 絕對(duì)尺寸:給指定數(shù)值或者比例來(lái)定義行高。 跨行跨列:類似合并方格。 將子元素排列成水平或垂直的一行(默認(rèn):垂直)。 將子元素按從左到右的順序定位,

    2024年02月10日
    瀏覽(23)
  • C# WPF編程-布局

    C# WPF編程-布局

    WPF窗口只能包含單個(gè)元素。為在WPF窗口中放置多個(gè)元素并創(chuàng)建更貼近實(shí)用的用戶界面,需要在窗口上放置一個(gè)容器,然后在這個(gè)容器中添加其他元素。 造成這一限制的原因是Window類繼承自ContentControl類。 在WPF窗口布局需要遵循以下幾條重要原則: 不應(yīng)顯示設(shè)定元素的尺寸 :

    2024年03月25日
    瀏覽(23)
  • WPF 布局

    WPF 布局

    WPF中所有布局如下,我們一一嘗試實(shí)現(xiàn),本文檔主要以圖形化的形式展示每個(gè)布局的功能。 布局 :?Border、?BulletDecorator、?Canvas、?DockPanel、?Expander、?Grid、?GridView、?GridSplitter、?GroupBox、?Panel、?ResizeGrip、?Separator、?ScrollBar、?ScrollViewer、?StackPanel、?Thumb、?Viewbox、?

    2024年02月02日
    瀏覽(25)
  • C# WPF布局

    C# WPF布局

    布局: 1、Grid: Window x:Class=\\\"WpfApp2.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-compatibili

    2024年04月22日
    瀏覽(29)
  • WPF網(wǎng)格拖動(dòng)自動(dòng)布局效果

    WPF網(wǎng)格拖動(dòng)自動(dòng)布局效果

    使用Canvas和鼠標(biāo)相關(guān)事件實(shí)現(xiàn)如下的效果: XAML代碼: C#代碼 項(xiàng)目地址github

    2024年02月11日
    瀏覽(22)
  • 淺談WPF之UI布局

    淺談WPF之UI布局

    一個(gè)成功的軟件,離不開(kāi)人性化的UI設(shè)計(jì),如何抓住用戶第一視覺(jué),讓用戶產(chǎn)生依賴感,合適優(yōu)雅的布局必不可少。本文以一些簡(jiǎn)單的小例子,簡(jiǎn)述 WPF中布局 面板 控件 的使用 ,僅供學(xué)習(xí)分享使用,如有不足之處,還請(qǐng)指正。 在WPF中,關(guān)于布局面板控件,主要有以下幾種:

    2024年01月25日
    瀏覽(18)
  • WPF 入門筆記 - 02 - 布局綜合應(yīng)用

    WPF 入門筆記 - 02 - 布局綜合應(yīng)用

    本篇博文對(duì)接上篇末尾處WPF常用布局控件的綜合應(yīng)用,為痕跡g布局控件介紹課后作業(yè)的一個(gè)思路方法。 首先來(lái)談一談布局原則: WPF 窗口只能包含一個(gè)元素(Window元素屬于內(nèi)容控件,內(nèi)容控件只允許有一個(gè)子元素),所以我們得在窗口中放置一個(gè)容器,才能使我們的窗口放置更

    2024年02月06日
    瀏覽(29)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包