using CPF;
using CPF.Animation;
using CPF.Controls;
using CPF.Drawing;
using CPF.Shapes;
using CPF.Styling;
using CPF.Svg;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace CPFApp
{
public class Window1 : Window
{
protected override void InitializeComponent()
{
Icon = "res://ConsoleApp1/icon.png";
//需要根据项目修改
LoadStyleFile("res://ConsoleApp1/Stylesheet.css");
//需要根据项目修改
Title = "标题";
Width = 548;
Height = 356;
Background = null;
Children.Add(new Border
{
Child = new Panel
{
Children =
{
new Panel
{
MarginRight = 19,
MarginTop = 40,
IsGroup = false,
Classes = "loginBox",
Commands =
{
{
nameof(MouseDown),
(s,e)=>(e as RoutedEventArgs).Handled=true
}
},
Children =
{
new Panel
{
MarginTop = 64,
Classes = "textBox",
Attacheds =
{
{
AttachedExtenstions.IsEmpty,
true,
nameof(TextBox.Text),
a=>a.GetChildren().First(b=>b is TextBox),
BindingMode.OneWay,
(string text)=>string.IsNullOrWhiteSpace(text)
}
},
IsGroup = true,
Children =
{
new TextBox
{
MarginBottom = 3,
MarginRight = 3,
MarginLeft = 31,
MarginTop = 3,
Classes = "singleLine",
},
new TextBlock
{
MarginLeft = 38,
Classes = "placeholder",
Text = "用户名",
},
new SVG
{
MarginLeft = 5,
Height = 20,
IsAntiAlias = true,
Width = 20,
Stretch = Stretch.Uniform,
Source=""
}
},
Height = 36f,
Width = 220f,
},
new Panel
{
MarginTop = 118,
Classes = "textBox",
Attacheds =
{
{
AttachedExtenstions.IsEmpty,
true,
nameof(TextBox.Text),
a=>a.GetChildren().First(b=>b is TextBox),
BindingMode.OneWay,
(string text)=>string.IsNullOrWhiteSpace(text)
}
},
IsGroup = true,
Children =
{
new TextBox
{
PasswordChar = '#',
MarginBottom = 2,
MarginRight = 2,
MarginLeft = 31,
MarginTop = 2,
Classes = "singleLine",
},
new TextBlock
{
MarginLeft = 38,
Classes = "placeholder",
Text = "密码",
},
new SVG
{
MarginLeft = 5,
Height = 20,
IsAntiAlias = true,
Width = 22,
Stretch = Stretch.Uniform,
Source=""
}
},
Height = 36f,
Width = 220f,
},
new CheckBox
{
MarginLeft = 26,
MarginTop = 175,
Content = "记住密码",
},
new CheckBox
{
MarginLeft = 181,
MarginTop = 175,
Content = "自动登录",
},
new Button
{
MarginLeft = 27,
MarginTop = 213,
Classes = "primary",
Height = 33,
Width = 226,
Content = "登录",
},
new TextBlock
{
FontSize = 20f,
MarginTop = 13,
Text = "XX管理系统",
}
},
Height = 264,
Width = 274,
},
new Panel
{
MarginBottom = 0,
Background = "#5862E5",
Children =
{
new SVG
{
IsAntiAlias = true,
Source = "res://ConsoleApp1/svg1.svg",
Stretch = Stretch.Uniform,
Height = 196,
Width = 167,
},
},
MarginLeft = 0,
MarginTop = 0,
Width = 222,
Commands =
{
{
nameof(MouseDown),
(s,e)=>DragMove()
}
}
},
new SVG
{
Fill = "#6C6C6C",
MarginLeft = 501,
MarginTop = 9,
Height = 18,
IsAntiAlias = true,
Width = 18,
Stretch = Stretch.Uniform,
Source="",
Triggers =
{
{
nameof(IsMouseOver),
Relation.Me,
null,
(nameof(SVG.Fill),"#111")
}
},
Commands =
{
{
nameof(MouseDown),
(s,e)=>Close()
}
}
},
},
Height = "100%",
Width = "100%",
},
BorderStroke = "0,Solid",
ShadowBlur = 10,
Background = "#FFFFFF",
Height = "100%",
Width = "100%",
Commands =
{
{
nameof(MouseDown),
(s,e)=>DragMove()
}
}
});
}
}
}