初始化

This commit is contained in:
xhm
2023-11-21 23:05:03 +08:00
commit 2455630dad
2252 changed files with 466529 additions and 0 deletions

309
ClassLibrary1/Class1.cs Normal file
View File

@@ -0,0 +1,309 @@
using System;
using CPF;
using CPF.Controls;
namespace ClassLibrary1
{
public class Class1 : Control
{
protected override void InitializeComponent()
{
Bindings.Add("Padding", "333");
Background = "#FFffff";
Height = 519;
Width = 420;
if (!DesignMode)
{
Size = SizeField.Fill;
}
Children.Add(new TextBox
{
BorderStroke = "1,Solid" //测试
,
BorderFill = "#3C3C3C",
MarginTop = 25.9f,
Height = 20.5f,
Width = 123.5f,
HScrollBarVisibility = ScrollBarVisibility.Hidden,
Text = "231"
});
Children.Add(new Button
{
Width = 215,
MarginLeft = -0,
ToolTip = "test",
Height = 31,
MarginTop = 62,
Content = "Button测试🌐 🍪 🍕🚀123",
FontFamily = "黑体",
Commands =
{
{
nameof(Button.Click),
(s,e)=>
{
new Window1
{
}
.Show();
}
}
}
});
Children.Add(new CheckBox
{
MarginLeft = 150,
MarginTop = 122,
Content = "CheckBox",
});
Children.Add(new TextBlock
{
FontFamily = "Courier New",
MarginTop = 143.8f,
TextStrokeFill = "#F93F00",
TextStroke = "1,Solid",
Background = "#0ff",
Text = "🇨🇳牛运当头㊗8881",
});
Children.Add(new ListBox
{
MarginLeft = 28,
MarginTop = 269,
Width = 125,
Height = 168,
Items =
{
"test1",
"test2",
"asdad",
"on测试🌐 🍪 🍕🚀1",
"🍕🚀1",
"🚀",
"🌐",
"🍕",
"aa改改",
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
}
});
Children.Add(new ComboBox
{
MarginTop = 441.4f,
Items =
{
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
}
});
Children.Add(new ComboBox
{
MarginTop = 469.9f,
Items =
{
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
"🚀",
"🌐",
"🍕",
"🍪",
}
});
Children.Add(new ScrollViewer
{
Content = new TextBlock
{
Height = 246.4f,
Width = 208.4f,
Text = "Button",
TextAlignment = CPF.Drawing.TextAlignment.Center,
Background = "100,200,100,200"
},
Width = 146.5f,
Height = 169.4f,
MarginLeft = -0.2f,
MarginTop = 93f,
});
Children.Add(new Panel
{
Background= "url(res://ClassLibrary1/icon.png)",
Children =
{
new Button
{
Commands =
{
{
nameof(Button.Click),
nameof(ShowLayered),
this,
CommandParameter.EventSender,
CommandParameter.EventArgs
},
},
Height = 26,
Width = 76,
MarginLeft = 4,
MarginTop = 7,
Content = "显示加载",
},
new Button
{
MarginLeft = 105,
MarginTop = 13,
Content = "Button",
},
new Label
{
MarginTop = 40,
MarginLeft = 9,
Text = "123132",
},
new CheckBox
{
MarginLeft = 6,
MarginTop = 68,
Content = "CheckBox",
},
},
Bindings =
{
{
"Foreground",
"dfsfsfe",
null,
BindingMode.OneTime
},
},
MarginLeft = 224,
MarginTop = 52,
Height = 124,
Width = 179,
});
Children.Add(new DatePicker
{
MarginTop = 188,
MarginRight = 15,
Height = 26,
Width = 108,
});
Children.Add(new Switch
{
Width = 54,
MarginRight = 45,
MarginTop = 227,
Height = 26,
});
Children.Add(new TextBox
{
Background = "#FFFFFF",
MarginLeft = 15,
MarginTop = 461,
Height = 26,
Width = 132,
});
Children.Add(new TextBox
{
Width = 125,
MarginRight = 6,
Height = 29,
MarginBottom = 26,
Background = "#FFFFFF",
});
Children.Add(new TabControl
{
MarginLeft = 188,
MarginTop = 273,
Items =
{
new TabItem
{
Content = new Panel
{
Height = "100%",
Width = "100%",
},
Header = "TabItem",
},
new TabItem
{
Content = new Panel
{
Background = "#FFFFB2",
Children =
{
},
Height = "100%",
Width = "100%",
},
Header = "TabItem",
},
},
Height = 142,
Width = 156,
});
Children.Add(new NativeElement
{
MarginLeft = 180,
MarginTop = 194,
Height = 68,
Width = 100,
Content= CreateNativeControl?.Invoke()
});
}
protected override void OnInitialized()
{
base.OnInitialized();
Root.LoadStyleFile("res://ClassLibrary1/Stylesheet1.css");
}
void ShowLayered(CpfObject obj, RoutedEventArgs eventArgs)
{
this.ShowLoading("dfsds测试", a =>
{
System.Threading.Thread.Sleep(2000);
});
}
public static Func<object> CreateNativeControl;
}
}

View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Remove="icon.png" />
<None Remove="Stylesheet1.css" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="icon.png" />
<EmbeddedResource Include="Stylesheet1.css" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CPF\CPF.csproj" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,55 @@
using CPF;
using CPF.Animation;
using CPF.Controls;
using CPF.Drawing;
using CPF.Shapes;
using CPF.Styling;
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassLibrary1
{
public class ListBoxTemplate : Control
{
protected override void InitializeComponent()
{
BorderThickness = "0,0,0,1";
BorderType = BorderType.BorderThickness;
BorderFill = "#B4B4B4";
Height = 37.8f;
Width = 245.7f;
//模板定义
Children.Add(new TextBlock
{
MarginLeft = 42.1f,
MarginRight = 13.7f,
Width = 190f,
Text = "CPF控件322",
Bindings =
{
{
"Text",
"Item1"
},
},
});
Children.Add(new Picture
{
MarginLeft = 6.1f,
Width = 28.2f,
Height = 26.9f,
Bindings =
{
{
nameof(Picture.Source),
"Item2"
}
}
});
Bindings.Add("a","b");
Bindings.Add("a1","b2",null,BindingMode.OneTime);
Bindings.Add("a3","b4");
}
}
}

66
ClassLibrary1/MainView.cs Normal file
View File

@@ -0,0 +1,66 @@
using CPF;
using CPF.Controls;
using System;
namespace ClassLibrary1
{
public class MainView : Control
{
protected override void InitializeComponent()
{
//Root.LoadStyleFile("res://ClassLibrary1/Stylesheet1.css");
Background = "#FFFFFF";
Width = 387;
Height = 464;
Children.Add(new Button
{
MarginTop = 42,
Commands =
{
{
nameof(Button.Click),
nameof(ClickTest),
this,
CommandParameter.EventSender,
CommandParameter.EventArgs
},
},
Height = 31,
Width = 72,
Content = "Button",
});
Children.Add(new ListBox
{
Height = 189,
Width = 148,
Items =
{
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
}
});
}
void ClickTest(CpfObject obj, RoutedEventArgs eventArgs)
{
new Window1().Show();
}
}
}

View File

@@ -0,0 +1,91 @@
using CPF;
using CPF.Animation;
using CPF.Controls;
using CPF.Drawing;
using CPF.Shapes;
using CPF.Styling;
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassLibrary1
{
public class OpenFileDialogView : Control
{
protected override void InitializeComponent()
{
Background = "#FFFFFF";
Width = 400;
Height = 600;
if (!DesignMode)
{
Width = "90%";
Height = "90%";
}
Children.Add(new TextBlock
{
FontSize = 20f,
MarginTop = 19.3f,
Text = "文件选择"
});
Children.Add(new TextBlock
{
Height = 20f,
TextTrimming = TextTrimming.CharacterEllipsis,
MarginTop = 57.2f,
Text = "",
Width = "90%",
});
Children.Add(new ListBox
{
MarginBottom = 90f,
MarginTop = 80f,
Width = "90%",
});
Children.Add(new Button
{
Name="ok",
MarginRight = 30,
MarginBottom = 29f,
Height = 31.1f,
Width = 88.8f,
Content = "确定",
Commands =
{
{
nameof(Button.Click),
(s,e)=>
{
}
}
}
});
Children.Add(new Button
{
Name="cancel",
MarginBottom = 29f,
MarginLeft = 30f,
Height = 31.1f,
Width = 88.8f,
Content = "取消",
Commands =
{
{
nameof(Button.Click),
(s,e)=>
{
}
}
}
});
}
public Collection<string> SelectedFiles
{
get { return GetValue<Collection<string>>(); }
set { SetValue(value); }
}
}
}

View File

@@ -0,0 +1,490 @@
#ColorPicker #TrackBackground {
Background: null;
BorderFill: null;
}
#ColorPicker Thumb {
Height:5;
}
/*@font-face {
font-family: '微软雅黑';
src: url('res://ConsoleApp1/msyh.ttc');
} 加载字体
* {
FontFamily: 微软雅黑;
}*/
@media windows {
* {
FontFamily: '微软雅黑';
}
}
@media osx {
* {
FontFamily: '苹方-简';
}
}
@media linux {
* {
FontFamily: '文泉驿正黑';
}
}
/*设置窗体标题栏背景颜色圆角*/
/*#caption {
IsAntiAlias: true;
Background: #2c2c2c;
CornerRadius:5,5,0,0;
}
#frame {
CornerRadius: 5;
IsAntiAlias: true;
}*/
Button {
BorderFill: #DCDFE6;
IsAntiAlias: True;
CornerRadius: 4,4,4,4;
Background: #FFFFFF;
}
Button[IsMouseOver=true] {
BorderFill: rgb(198,226,255);
Background: rgb(236,245,255);
Foreground: rgb(64,158,255);
}
Button[IsPressed=true] {
BorderFill: rgb(58,142,230);
}
Button.primary {
BorderFill: rgb(64,158,255);
CornerRadius: 4,4,4,4;
Background: rgb(64,158,255);
Foreground: #FFFFFF;
}
Button.primary[IsMouseOver=true] {
BorderFill: rgb(102,177,255);
Background: rgb(102,177,255);
Foreground: #FFFFFF;
}
Button.primary[IsPressed=true] {
BorderFill: rgb(58,142,230);
Background: rgb(58,142,230);
}
Button.success {
BorderFill: rgb(103,194,58);
CornerRadius: 4,4,4,4;
Background: rgb(103,194,58);
Foreground: #FFFFFF;
}
Button.success[IsMouseOver=true] {
BorderFill: rgb(133,206,97);
Background: rgb(133,206,97);
Foreground: #FFFFFF;
}
Button.success[IsPressed=true] {
BorderFill: rgb(93,175,52);
Background: rgb(93,175,52);
}
Button.danger {
BorderFill: rgb(245,108,108);
Background: rgb(245,108,108);
CornerRadius: 4,4,4,4;
Foreground: #FFFFFF;
}
Button.danger[IsMouseOver=true] {
BorderFill: rgb(247,137,137);
Background: rgb(247,137,137);
Foreground: #FFFFFF;
}
Button.danger[IsPressed=true] {
BorderFill: rgb(221,97,97);
Background: rgb(221,97,97);
}
TextBox, .textBox, DatePicker {
Background: #fff;
IsAntiAlias: true;
BorderFill: #DCDFE6;
CornerRadius: 4,4,4,4;
BorderStroke: 1;
}
.groupPanel TextBox, DatePicker TextBox, .textBox TextBox {
BorderStroke: 0;
}
.textBox[IsKeyboardFocusWithin=true] {
BorderFill: #1E9FFF;
}
.singleLine { /*单行文本框*/
AcceptsReturn: false;
HScrollBarVisibility: Hidden;
VScrollBarVisibility: Hidden;
}
.singleLine #contentPresenter {
Padding: 3;
}
.multiline { /*多行文本框*/
}
.slotLeft {
CornerRadius: 0,4,4,0;
BorderFill: #DCDFE6;
Background: #F5F7FA;
BorderThickness: 1,0,0,0;
BorderType: BorderThickness;
MarginTop: 0;
MarginBottom: 0;
MarginRight: 0;
}
RadioButton #radioButtonBorder {
StrokeFill: rgb(220,223,230);
}
RadioButton[IsChecked=true] #radioButtonBorder {
StrokeFill: #1E9FFF;
Fill: #1E9FFF;
}
RadioButton #optionMark {
StrokeFill: #1E9FFF;
Fill: #fff;
}
CheckBox #indeterminateMark {
Fill: #1E9FFF;
}
CheckBox #checkBoxBorder {
Background: #fff;
BorderFill: rgb(220,223,230);
}
CheckBox[IsChecked=true] #checkBoxBorder {
Background: #1E9FFF;
BorderFill: #1E9FFF;
}
CheckBox Polyline {
StrokeFill: #fff;
}
.radioGroup {
BorderType: BorderThickness;
BorderFill: rgb(220,223,230);
BorderThickness: 1,1,0,1;
}
.radioGroup RadioButton {
BorderType: BorderThickness;
BorderFill: rgb(220,223,230);
BorderThickness: 0,0,1,0;
}
.radioGroup RadioButton #markPanel {
Visibility: Collapsed;
}
.radioGroup RadioButton TextBlock {
Margin: 5;
}
.radioGroup RadioButton[IsChecked=true] {
Background: rgb(64,158,255);
Foreground: #fff;
}
.error {
Foreground: #f00;
Visibility: Collapsed;
}
.error[DesignMode=true] {
Visibility: Visible;
}
.twoLine[AttachedExtenstions.IsError=true] .error {
Visibility: Visible;
}
.twoLine[AttachedExtenstions.IsError=true] .textBox {
BorderFill: #f00;
}
ScrollBar {
Background: null;
}
ScrollBar Thumb {
IsAntiAlias: true;
CornerRadius: 5;
}
ScrollBar[Orientation=Horizontal] {
Height: 12;
}
ScrollBar[Orientation=Vertical] {
Width: 12;
}
ScrollBar #PART_LineUpButton, ScrollBar #PART_LineDownButton {
Visibility: Collapsed;
}
ComboBox {
Background: #fff;
IsAntiAlias: true;
BorderFill: #DCDFE6;
CornerRadius: 4,4,4,4;
BorderStroke: 1;
}
ComboBox[IsKeyboardFocusWithin=true] {
BorderFill: #1E9FFF;
}
#DropDownPanel TextBlock {
MarginLeft: 5;
MarginTop: 2;
MarginBottom: 2;
FontSize: 14;
}
#dropDownBorder {
ShadowBlur: 2;
ShadowColor: rgba(0, 0, 0, 0.4);
BorderStroke: 0;
}
#DropDownPanel[IsMouseOver=false] ScrollBar {
Visibility: Collapsed;
}
#DropDownPanel ScrollBar[Orientation=Horizontal] {
Height: 10;
}
#DropDownPanel ScrollBar[Orientation=Vertical] {
Width: 10;
}
Slider {
IsAntiAlias: true;
}
Slider Thumb {
IsAntiAlias: true;
Width: 16;
Height: 16;
CornerRadius: 7;
BorderFill: rgb(64,158,255);
BorderStroke: 2;
Background: #fff;
ZIndex: 1;
}
Slider Thumb[IsMouseOver=true] {
animation-name: sliderMouseOver;
animation-duration: 0.1s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
Slider #TrackBackground {
CornerRadius: 2;
Background: rgb(228,231,237);
BorderStroke: 0;
}
Slider #decreaseRepeatButton {
Background: rgb(64,158,255);
CornerRadius: 2;
}
Slider[Orientation=Horizontal] #decreaseRepeatButton {
Height: 4;
MarginLeft: 5;
}
Slider[Orientation=Vertical] #decreaseRepeatButton {
Width: 4;
MarginBottom: 5;
}
ProgressBar {
CornerRadius: 5;
IsAntiAlias: true;
BorderFill: null;
Background: rgb(235,238,245);
}
ProgressBar #Indicator, ProgressBar #Animation {
CornerRadius: 5;
}
NumericUpDown {
Background: #fff;
IsAntiAlias: true;
BorderFill: #DCDFE6;
CornerRadius: 4,4,4,4;
BorderStroke: 1;
}
NumericUpDown RepeatButton {
Width: 20;
Background: rgb(245,247,250);
}
NumericUpDown #decreaseBtn {
CornerRadius: 4,0,0,4;
}
NumericUpDown #increaseBtn {
CornerRadius: 0,4,4,0;
}
NumericUpDown #textBoxBorder {
BorderFill: #DCDFE6;
}
NumericUpDown TextBox {
BorderStroke: 0;
}
.widget {
IsAntiAlias: true;
BorderFill: #DCDFE6;
CornerRadius: 4,4,4,4;
BorderStroke: 1;
}
.widgetHead {
Background: linear-gradient(0 0,0 100%,#F7F7F7 0,#F0F0F0 1);
BorderType: BorderThickness;
BorderThickness: 0,0,0,1;
BorderFill: #DCDFE6;
}
DataGrid {
Foreground: #7a7a7a;
}
DataGridCellTemplate, DataGridRow, DataGrid {
BorderFill: rgb(235,238,245);
}
DataGridRow {
Height: 36;
}
DataGridRow[IsMouseOver=true] {
Background: rgb(245,247,250);
}
DataGridRow[IsSelected=true] {
Background: rgb(245,247,250);
}
DataGridColumnTemplate {
Height: 38;
FontSize: 15;
FontStyle: Bold;
Background: #fff;
BorderFill: rgb(235,238,245);
}
TabControl #headBorder {
Background: #fff;
}
TabItem > Border {
BorderThickness: 0,0,0,2;
}
TabItem[IsSelected=true] > Border {
BorderFill: #1E9FFF;
}
TabItem[IsSelected=true] {
Foreground: #1E9FFF;
}
TabControl[TabStripPlacement=Left] TabItem, TabControl[TabStripPlacement=Right] TabItem {
Width: 100%;
BorderType: BorderThickness;
BorderThickness: 0,0,0,1;
BorderFill: #e8e8e8;
}
TabControl[TabStripPlacement=Left] TabItem TextBlock {
MarginRight: 0;
}
TabControl[TabStripPlacement=Left] TabItem > Border {
Width: 100%;
}
TabControl[TabStripPlacement=Left] #headerPanel, TabControl[TabStripPlacement=Right] #headerPanel {
Width: 100;
Background: rgb(245,247,250);
}
.closeBtn[IsMouseOver=true] {
Fill: #171717;
}
.placeholder {
IsHitTestVisible: false;
Foreground: "192,196,204";
Visibility: Collapsed;
}
.textBox[AttachedExtenstions.IsEmpty=true] .placeholder {
Visibility: Visible;
}
.loginBox TextBox, .loginBox .placeholder {
FontSize: 16;
}
.loginBox CheckBox {
Foreground: #757575;
}
.searchBox Button {
CornerRadius: 0,4,4,0,
}
#MenuPop #menuPanel > Border, #MenuPop ContextMenu > Border {
Background: #fff;
ShadowColor: rgba(0, 0, 0, 0.4);
}
#MenuPop MenuItem[IsMouseOver=true] {
Background: #DCDFE6;
}
#testGrid {
ColumnDefinitions-0-Width: "20";
}

255
ClassLibrary1/Window1.cs Normal file
View File

@@ -0,0 +1,255 @@
using CPF;
using CPF.Animation;
using CPF.Controls;
using CPF.Drawing;
using CPF.Shapes;
using CPF.Styling;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Essentials;
namespace ClassLibrary1
{
public class Window1 : Window
{
protected override void InitializeComponent()
{
Title = "标题";
Width = 300;
Height = 400;
Background = null;
CanResize = true;
Children.Add(new WindowFrame(this, new Panel
{
Width = "100%",
Height = "100%",
Children = //内容元素放这里
{
new Button
{
Content = new Button
{
Commands =
{
{
nameof(Button.Click),
nameof(MovePosition),
this,
CommandParameter.EventSender,
CommandParameter.EventArgs
},
},
Content = "Button",
},
MarginTop = 82,
Height = 30,
Width = 88,
Commands =
{
{
nameof(Button.Click),
(s,e)=>
{
this.Position=new PixelPoint(100,100);
}
}
}
},
new TextBox
{
Text = "123",
MarginLeft = 102,
BorderFill = "#9A9A9A",
BorderStroke = "1,Solid",
MarginTop = 14,
Height = 24,
Width = 95,
},
new Button
{
MarginTop = 148.6f,
Height = 30.2f,
Width = 87.5f,
Content = "打开文件浏览",
Commands =
{
{
nameof(Button.Click),
async (s,e)=>
{
OpenFileDialog dialog=new OpenFileDialog
{
Title="cpf文件选择",
Filters=
{
new FileDialogFilter
{
Extensions="jpg,png"
}
}
};
var f= await dialog.ShowAsync(this);
System.Diagnostics.Debug.WriteLine(f);
//var photo = await FilePicker.PickAsync();
//System.Diagnostics.Debug.WriteLine(photo.FileName);
// if (WindowState== WindowState.FullScreen)
//{
// WindowState= WindowState.Normal;
//}
//else
//{
// WindowState= WindowState.FullScreen;
//}
}
}
}
},
new Button
{
MarginLeft = 102,
MarginTop = 44,
Height = 30.2f,
Width = 87.5f,
Content = "退出程序",
Commands =
{
{
nameof(Button.Click),
(s,e)=>
{
CPF.Platform.Application.Exit();
}
}
}
},
new Panel
{
Name = "ColorPicker",
MarginTop = 178.8f,
MarginLeft = 47.6f,
Children =
{
new Slider
{
MarginBottom = 40f,
MarginTop = 5f,
MarginRight = 25f,
Background = "linear-gradient(0 0,0 100%,#000000 0,#FFffFF 1)",
Width = 10f,
ZIndex=1,
Orientation= Orientation.Vertical
},
new Control
{
Background = "linear-gradient(0 0,100% 0,#FF0000 0,#FFFFFF 1)",
MarginLeft = 5f,
MarginRight = 40f,
MarginTop = 5f,
MarginBottom = 40f,
},
new Control
{
Background = "linear-gradient(0 0,0 100%,#00000000 0,#000000 1)",
MarginLeft = 5f,
MarginRight = 40f,
MarginTop = 5f,
MarginBottom = 40f,
},
new Slider
{
MarginBottom = 40f,
MarginRight = 5f,
MarginTop = 5f,
Background = "linear-gradient(0 0,0 100%,#FA0000 0,#FAFF00 0.2,#00FF00 0.4,#00FFFF 0.6,#0000FF 0.8,#FF00FF 1)",
Width = 10f,
ZIndex=1,
Orientation= Orientation.Vertical
},
new Button
{
Width = 38.1f,
MarginBottom = 11.1f,
MarginRight = 5f,
Content = "OK",
},
new Button
{
MarginBottom = 10.9f,
MarginRight = 46.5f,
Width = 50.5f,
Content = "Cancel",
},
new TextBox
{
Text = "#FFFFFFFF",
MarginBottom = 11.1f,
Height = 20.9f,
MarginLeft = 5f,
Width = 73.5f,
HScrollBarVisibility= ScrollBarVisibility.Hidden,
VScrollBarVisibility= ScrollBarVisibility.Hidden,
AcceptsReturn=false,
BorderFill="#B1B1B1",
BorderStroke="1",
},
},
Width = 194.9f,
Height = 145.4f,
},
new TextBox
{
MarginRight = 12,
MarginBottom = 14,
Text = "#FFFFFFFF",
Height = 22,
Width = 81,
HScrollBarVisibility= ScrollBarVisibility.Hidden,
VScrollBarVisibility= ScrollBarVisibility.Hidden,
AcceptsReturn=false,
BorderFill="#B1B1B1",
BorderStroke="1",
},
new Button
{
Commands =
{
{
nameof(Button.Click),
nameof(msg),
this,
CommandParameter.EventSender,
CommandParameter.EventArgs
},
},
Height = 27,
Width = 87,
MarginLeft = 102,
MarginTop = 115,
Content = "弹窗",
},
}
})
{
MaximizeBox = true
});
LoadStyleFile("res://ClassLibrary1/Stylesheet1.css");
//加载样式文件,文件需要设置为内嵌资源
if (!DesignMode)//设计模式下不执行
{
}
}
void MovePosition(CpfObject obj, RoutedEventArgs eventArgs)
{
this.ViewImpl.Position = new PixelPoint();
}
void msg(CpfObject obj, RoutedEventArgs eventArgs)
{
MessageBox.Show("test");
}
}
}

BIN
ClassLibrary1/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB