域名到期了网站会打不开吗,用毛做简单的网站,合肥学网站设计,微分销商城网站建设实现步骤
实现左右布局
使用了Grid两列的网格布局#xff0c;第一列宽度占35%#xff0c;第二列宽度占65%。使用容器布局Border包裹左右布局内容#xff0c;设置背景色、设置圆角
!-- 定义两列--
Grid.ColumnDefinitionsColumnDefinition Width 第一列宽度占35%第二列宽度占65%。使用容器布局Border包裹左右布局内容设置背景色、设置圆角
!-- 定义两列--
Grid.ColumnDefinitionsColumnDefinition Width 0.35*/ColumnDefinitionColumnDefinition Width 0.65*/ColumnDefinition/Grid.ColumnDefinitions!-- 左侧布局具体实现--
Border Grid.Column0 CornerRadius10,0,0,10Border.BackgroundLinearGradientBrush StartPoint0,0 EndPoint1,1GradientStop Color#00999A Offset0/GradientStop Color#0072c0 Offset1//LinearGradientBrush/Border.Background
/Border
!-- 右侧布局具体实现--Border Grid.Column1 CornerRadius0,10,10,0 BackgroundWhiteSmoke/Border
编写左侧布局
Grid.Column1 这一行代码的作用是将一个 Border 控件放置在 Grid 的第一列
Border中的CornerRadius圆角元素和Margin外边距元素的值的顺序左上右下 StackPanel Grid.Column0TextBlock Margin0,100,0,0 Textbilibili ForegroundWhiteFontSize40 HorizontalAlignmentCenter FontWeightBold/TextBlock Margin20,5,20,0TextWelcome to the bilibili. You can register by clicking the button belowTextWrappingWrapWithOverflow ForegroundWhite LineHeight25/Button Margin0,80,0,0 ContentSign Up Foreground WhiteBackgroundTransparent BorderBrushWhite Width200//StackPanel
编写右侧布局
!-- 右侧布局 --Border Grid.Column1 CornerRadius0,10,10,0 BackgroundWhiteSmoke !-- 圆角边框浅灰色背景 --StackPanel Margin20 !-- 内容面板包含登录表单和其他UI元素 --!-- 登录提示 --TextBlock TextSign in to bilibili Foreground#0072c0 FontSize30 HorizontalAlignmentCenter Margin0,0,0,25 FontWeightbold/ !-- 社交媒体登录按钮 --StackPanel OrientationHorizontal HorizontalAlignmentCenterButton BackgroundTransparent BorderBrushTransparentImage SourceImages\wechat.png Width40 Height40//ButtonButton BackgroundTransparent BorderBrushTransparentImage SourceImages\weibo.png Width40 Height40 Margin5,0,5,0//ButtonButton BackgroundTransparent BorderBrushTransparentImage SourceImages\qq.png Width40 Height40//Button/StackPanel!-- 提示使用账户信息登录 --TextBlock Margin0,15,0,0 Textor use your account info TextAlignmentCenter FontFamilyArial FontSize14 Foreground#878787/!-- 用户名输入框 --Border Margin0,30,0,0 Height35 Width340 BorderBrush#878787 BorderThickness1 CornerRadius20StackPanel OrientationHorizontal!-- 绘制原型图像 --Ellipse Width25 Height25 Margin5,0,0,0Ellipse.FillImageBrush ImageSourceImages\user.png//Ellipse.Fill/EllipseTextBlock Margin5,0,0,0 Textusername FontSize20 FontFamilyArial VerticalAlignmentCenter//StackPanel/Border!-- 密码输入框 --Border Margin0,10,0,0 Height35 Width340 BorderBrush#878787 BorderThickness1 CornerRadius20StackPanel OrientationHorizontalEllipse Width25 Height25 Margin5,0,0,0Ellipse.FillImageBrush ImageSourceImages\password.png//Ellipse.Fill/EllipseTextBlock Margin5,0,0,0 Textpassword FontSize20 FontFamilyArial VerticalAlignmentCenter//StackPanel/Border!-- 登录按钮 --Button Margin0,25,0,0 ContentSign In Width200 Background#0072c0 ForegroundWheat FontSize16//StackPanel/BorderEllipse 元素在WPF中用于绘制一个椭圆形或圆形当宽度和高度相等时。
代码片段创建了一个宽高均为25像素的圆形并使用 ImageBrush 来填充这个圆形使得圆形内部显示为图片
使用Canves进行图片布局
Canvas 是一种布局面板它允许你通过显式设置元素的 Canvas.Left、Canvas.Top、Canvas.Right 和 Canvas.Bottom 属性来精确地定位子元素。Canvas 适用于需要绝对定位的场景 !-- bilibili图标 --
Canvas Grid.Column0Image SourceImages\bilibili_word.png/ Width40 Height40Canvas.Left30 Canvas.Top400/Image/Canvas
!-- 退出按钮 --Canvas Grid.Column1Button BackgroundTransparent Canvas.Left485 Canvas.Top5BorderBrushTransparentImage SourceImages\close.png Width25 Height25//Button/Canvas