1 Star 1 Fork 5

阿善/CPFUI

forked from BinGoo/CPFUI 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Window1.cs 39.70 KB
一键复制 编辑 原始数据 按行查看 历史
BinGoo 提交于 2024-05-28 17:50 +08:00 . no commit message
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
using CPF;
using CPF.Controls;
using CPF.Drawing;
using System;
using CPFUI.IControl;
using System.Reflection.Metadata;
using CPF.Shapes;
using CPFUI.IControl.Process;
using CPF.Threading;
namespace CPFUIDemo
{
public class Window1 : Window
{
OfficeMenuHelper officeMenuHelper = new OfficeMenuHelper();
OfficMenu officMenu;
MacMenu macmenu;
TabBarControl tabBarControl;
IPadViewControl ipadViewControl;
private IMListBox listBox;
private MenuControl MenuList;
IMChatBox chatBox;
public char Hour1
{
get { return GetValue<char>(); }
set { SetValue(value); }
}
public char Hour2
{
get { return GetValue<char>(); }
set { SetValue(value); }
}
public char Minute1
{
get { return GetValue<char>(); }
set { SetValue(value); }
}
public char Minute2
{
get { return GetValue<char>(); }
set { SetValue(value); }
}
public char Second1
{
get { return GetValue<char>(); }
set { SetValue(value); }
}
public char Second2
{
get { return GetValue<char>(); }
set { SetValue(value); }
}
protected override void InitializeComponent()
{
LoadStyleFile("res://CPFUIDemo/Stylesheet1.css");
//加载样式文件,文件需要设置为内嵌资源
LoadStyleFile("res://CPFUI/Style/Css/Normal.css",true);
Title = "标题";
Width = 1300;
Height = 868;
Background = null;
CanResize = true;
macmenu = new MacMenu()
{
//Background=Color.Red,
Spacing = 4,
ChangedCoefficient = 1.5,
MaxSize = 120,
MinSize = 60,
MarginBottom = 0,
};
tabBarControl = new TabBarControl
{
ItemHeight = 50,
ItemWidth = 100,
Orientation = Orientation.Horizontal,
MarginLeft = 0,
MarginTop = 0,
MarginRight = 0,
MarginBottom=0,
Background = Color.White,
Height = 50,
ChangedMove = true
};
ipadViewControl = new IPadViewControl
{
ClipToBounds = true,
CornerRadius = "0",
ItemHeight = 60,
ItemWidth = 80,
MatrixColumns=4,
MatrixRows=4,
Background = Color.White,
Height =500,
Width=400,
ChangedMove = true
};
listBox = new IMListBox()
{
Width = 276,
MarginRight = 0,
MarginTop = 0,
MarginBottom = 0,
};
officMenu = new OfficMenu
{
Classes = "TabMenu",
Height = 140,
Width=800,
MarginLeft = 0,
MarginRight = 0,
MarginTop = 0,
OfficeMenuList = officeMenuHelper.GetOfficeMenuList("首页")
};
MenuList = new MenuControl()
{
GroupForeground=Color.WhiteSmoke,
ItemNormalForeground = Color.White,
ItemSelectedForeground=Color.White,
MarginRight= 0,
MarginLeft = 0,
MarginTop = 0,
MarginBottom = 0,
};
for (int i = 0;
i < 5;
i++)
{
MenuGroupItem imGroup = new MenuGroupItem()
{
MarginLeft = 0,
MarginRight = 0,
};
imGroup.Caption = "菜单组";
for (int j = 0;
j < 3;
j++)
{
imGroup.AddItem(new CPFUI.IControl.MenuControlItem()
{
MarginLeft = 0,
MarginRight = 0,
Image = "res://CPFUIDemo/Resources/首页.png",
Text = "首页"
});
}
MenuList.AddGroup(imGroup);
}
chatBox = new IMChatBox
{
MarginRight = 276,
MarginTop = 0,
MarginBottom = 150,
MarginLeft = 230,
};
//macmenu.MacItemMouseDown += Macmenu_MacItemMouseDown;
Children.Add(new WindowFrame(this, new Panel
{
Width = "100%",
Height = "100%",
Children =
{
chatBox,
listBox,
MenuList,
new Border
{
Background=Color.DodgerBlue,
MarginLeft = 0,
MarginTop = 0,
Width=230,
MarginBottom = 0,
BorderType = BorderType.BorderStroke,
BorderStroke = new Stroke(0),
ShadowBlur = 8,
ShadowColor = Color.FromArgb(150, 70, 70, 70),
CornerRadius = new CornerRadius(14),
IsAntiAlias = true,
Child=MenuList
},//new CodeText
//{
// MarginTop=0,
// MarginRight=0,
// Width=500,
// MarginBottom=150
//}
}
})
{
MaximizeBox=true
});
if (!DesignMode)//设计模式下不执行,也可以用#if !DesignMode
{
}
CreatChatBox();
CreatChatBox2();
CreatChatBox1();
}
private void OfficMenu_OnTabHeadMenuClick(object sender, OfficeHeaderEvenArgs e)
{
officMenu.OfficeMenuList = officeMenuHelper.GetOfficeMenuList(e.TabName);
}
private void OfficMenu_OnTabMenuClick(object sender, OfficeMenuEvenArgs e)
{
}
private void Macmenu_MacItemMouseDown(object sender, CPF.Input.MouseButtonEventArgs e)
{
MacMenuItem item = sender as MacMenuItem;
MessageBox.Show(item.Caption);
}
public void CreatMacMenu()
{
for (int i = 1; i < 10; i++)
{
macmenu.AddMacMenuItem(new MacMenuItem() { Caption = $"系统菜单{i}", Icon = string.Format("res://CPFUIDemo/Resources/{0}.png", i) });
}
}
public void CreatTabBar()
{
for (int i = 1; i < 10; i++)
{
tabBarControl.AddTabBarItem(new TabBarItemTemplate() { TabBarBackground = Color.FromArgb(80, 0, 0, 0), Text="TabBar",Image = string.Format("res://CPFUIDemo/Resources/{0}.png", i) });
}
}
public void CreatIpadView()
{
for (int i = 0; i < 50; i++)
{
ipadViewControl.AddTabBarItem(new IPadViewItemTemplate() {TabBarBackground = Color.FromArgb(0, 0, 0, 0), Text = "Item"+i, Image = string.Format("res://CPFUIDemo/Resources/{0}.png",i%10) });
}
}
string[] groupnames = new string[] {
"我的设备",
" ╔--╗   ",
" ┊执┊ ╔--╗",
" ┊子┊ ┊与┊",
" ┊之┊ ┊子┊",
" ┊手┊ ┊携┊",
" ╚--╝ ┊老┊",
"     ╚--╝"
};
public void CreatIMListbox()
{
for (int i = 0; i < groupnames.Length; i++)
{
IMGroup group = new IMGroup();
group.Text = groupnames[i];
listBox.AddGroup(group);
for (int j = 0; j < 10; j++)
{
IMListBoxItem item = new IMListBoxItem(new UserInfo()
{
NickName = "BinGoo1",
Description= "太懒了,什么都没有~~!",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
});
listBox.AddItem(group,item);
}
}
}
public void CreatChatBox()
{
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "仿IPad桌面菜单",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =
ipadViewControl
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "加载进度条",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =
new Panel
{
Children =
{
new CircularProgress
{
TickColor=Color.OrangeRed,
Rotation=Direction.Anticlockwise,
MarginLeft = 0,
Width=100,
Height=100,
Interval=120
},
new CircularProgress
{
TickColor=Color.Green,
Rotation=Direction.Anticlockwise,
GraphType=GraphType.Ellipse,
MarginLeft = 100,
Width=100,
Height=100,
Interval=60
},
new CircularProgress
{
TickColor=Color.Black,
Rotation=Direction.Clockwise,
MarginLeft = 200,
Width=100,
Height=100,
Interval=80
},
new CircularProgress
{
TickColor=Color.DodgerBlue,
Rotation=Direction.Clockwise,
GraphType=GraphType.Ellipse,
IsChangeSize=true,
MarginLeft = 300,
Width=100,
Height=100,
Interval=30
},
}
}
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
}
public void CreatChatBox2()
{
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "笔记本小键盘",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =
new KeyBorderLetter{ }
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "全键盘",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =
new KeyBorderAll{ }
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
}); chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "数字键盘",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =
new KeyBorderNumber{ }
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
}
public void CreatChatBox1()
{
MindNode MindNode = new MindNode { Left = 100, Top = 5, Caption = "节点", Size = new SizeField(100, 50), GraphType = MindNodeGraphType.Circle };
MindNode MindNode1 = new MindNode { Left = 100, Top = 70, Caption = "节点", Size = new SizeField(100, 50), GraphType = MindNodeGraphType.Rectangle, Orientation = MindNodeOrientation.Bottom };
MindNode MindNode2 = new MindNode { Left = 100, Top = 140, Caption = "节点", Size = new SizeField(100, 50), GraphType = MindNodeGraphType.Rectangle, Orientation = MindNodeOrientation.Bottom };
MindNode MindNode3 = new MindNode { Left = 100, Top = 210, Caption = "节点", Size = new SizeField(100, 50), GraphType = MindNodeGraphType.Rectangle, Orientation = MindNodeOrientation.Bottom };
MindNode MindNode4 = new MindNode { Left = 100, Top = 280, Caption = "节点", Size = new SizeField(100, 50), GraphType = MindNodeGraphType.Rhombus, Orientation = MindNodeOrientation.Bottom };
MindNode3.NextNode.Add(MindNode4);
MindNode2.NextNode.Add(MindNode3);
MindNode1.NextNode.Add(MindNode2);
MindNode.NextNode.Add(MindNode1);
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "按钮Button",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =new StackPanel
{
Orientation=Orientation.Horizontal,
Children =
{
new ButtonEx{
MarginBottom=0,
BackColor=Color.Orange,
Foreground=Color.White,
Width=50,
Height=30,
CornerRadius="15",
Content=new Ellipse
{
IsAntiAlias = true,
Width = 20,
Height = 20,
StrokeFill = Color.Transparent,
Fill = string.Format("url({0}) Clamp Fill 0,0,0,0", "res://CPFUIDemo/Resources/error.png")
}
},
new ButtonEx{
MarginBottom=0,
BackColor=Color.Orange,
Foreground=Color.White,
Width=50,
Height=30,
CornerRadius="15",
Content="按钮"
},
new ButtonEx()
{
MarginBottom=0,
MarginLeft=5,
BackColor=Color.OrangeRed,
Foreground=Color.White,
Width=70,
Height=40,
Content=new Ellipse
{
IsAntiAlias = true,
Width = 30,
Height = 30,
StrokeFill = Color.Transparent,
Fill = string.Format("url({0}) Clamp Fill 0,0,0,0", "res://CPFUIDemo/Resources/success.png")
}
},
new ButtonEx()
{
MarginBottom=0,
MarginLeft=5,
BackColor=Color.DarkGreen,
Foreground=Color.White,
Width=90,
Height=50,
Content="按钮"
},
new ButtonEx()
{
MarginBottom=0,
MarginLeft=5,
BackColor=Color.FromRgb(30, 159, 255),
Foreground=Color.White,
Width=120,
Height=60,
Content="按钮"
},
}
}
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "PageControl",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =new PageControl()
{
Background=Color.White,
PageCount=20,
}
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "颜色拾取器",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =new ColorExtractorControl()
{
Background=Color.White,
}
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "这是一个仿office菜单",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =officMenu
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
officMenu.AddTabHeader("开始", true);
officMenu.AddTabHeader("插入", false);
officMenu.AddTabHeader("页面", false);
officMenu.OfficeMenuList = officeMenuHelper.GetOfficeMenuList("开始");
officMenu.CreatMenu("开始");
officMenu.OnTabMenuClick += OfficMenu_OnTabMenuClick; ;
officMenu.OnTabHeadMenuClick += OfficMenu_OnTabHeadMenuClick;
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "这是一个可拖拽的Tab菜单",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =tabBarControl
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "一款模仿苹果程序邬的菜单",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =macmenu
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "这是一个流程图控件",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =new MindControl
{
Width=500,
Height=340,
MindNode=MindNode
}
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(
new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Image,
DateTime = DateTime.Now,
Information = "https://b0.bdstatic.com/a3dc2283f738942f0253834688a56413.jpg@h_1280",
}
},
SendReceiveType = EChatType.Send,
User = new UserInfo()
{
NickName = "张三",
HeadImage = "https://q6.itc.cn/q_70/images03/20240308/f5c4defaf1c8400aa54dc1e1b6535ebd.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.File,
DateTime = DateTime.Now,
Information = "CPF源码",
},
},
SendReceiveType = EChatType.Send,
User = new UserInfo()
{
NickName = "张三",
HeadImage = "https://q6.itc.cn/q_70/images03/20240308/f5c4defaf1c8400aa54dc1e1b6535ebd.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "这是一条图文消息",
},
new MessageModel
{
MsgType = EMsgType.Image,
DateTime = DateTime.Now,
Information = "https://img2.baidu.com/it/u=3202947311,1179654885&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500",
}
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "头像选择",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information = new PictrueCropper
{
MarginLeft = 35,
MarginTop = 20,
SourceImg = "res://CPFUIDemo/Resources/拿铁.jpeg",
Width = 300,
Height = 300
}
}
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "简洁、直观、强悍的netcore跨平台UI开发框架\r\n框架理念和WPF类似,但是没有Xaml,直接用CSS和C#代码描述。\r\n全面支持国产化,支持国产Linux + 龙芯、飞腾、兆芯、海光等CPU平台",
}
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information = new StackPanel{
Height=50,
Orientation=Orientation.Horizontal,
Children =
{
new LedNumber
{
ForeColor=Color.Red,
Width=18,
Height=30,
LineWidth=4,
Value=Hour1,
MarginRight=15,
Bindings =
{
{nameof(LedNumber.Value),nameof(Hour1),this,BindingMode.TwoWay }
}
},
new LedNumber
{
ForeColor=Color.Red,
Width=18,
Height=30,
LineWidth=4,
Value=Hour2,
MarginRight=15,
Bindings =
{
{nameof(LedNumber.Value),nameof(Hour2),this,BindingMode.TwoWay }
}
},
new LedNumber
{
ForeColor=Color.Red,
Width=5,
Height=30,
LineWidth=4,
Value=':',
MarginRight=15,
},
new LedNumber
{
ForeColor=Color.Red,
Width=18,
Height=30,
LineWidth=4,
Value=Minute1,
MarginRight=15,
Bindings =
{
{nameof(LedNumber.Value),nameof(Minute1),this,BindingMode.TwoWay}
}
},
new LedNumber
{
ForeColor=Color.Red,
Width=18,
Height=30,
LineWidth=4,
Value=Minute2,
MarginRight=15,
Bindings =
{
{nameof(LedNumber.Value),nameof(Minute2),this,BindingMode.TwoWay}
}
},
new LedNumber
{
ForeColor=Color.Red,
Width=5,
Height=30,
LineWidth=4,
Value=':',
MarginRight=15,
},
new LedNumber
{
ForeColor=Color.Red,
Width=18,
Height=30,
LineWidth=4,
Value=Minute1,
MarginRight=15,
Bindings =
{
{nameof(LedNumber.Value),nameof(Second1),this,BindingMode.TwoWay }
}
},
new LedNumber
{
ForeColor=Color.Red,
Width=18,
Height=30,
LineWidth=4,
Value=Minute2,
MarginRight=15,
Bindings =
{
{nameof(LedNumber.Value),nameof(Second2),this,BindingMode.TwoWay}
}
},
}
},
}
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
chatBox.AddMessage(new MessagesInfo()
{
Data =
{
new MessageModel
{
MsgType = EMsgType.Text,
DateTime = DateTime.Now,
Information = "这是一条自定义控件消息",
},
new MessageModel
{
MsgType = EMsgType.Custom,
DateTime = DateTime.Now,
Information =new StackPanel
{
Orientation= Orientation.Horizontal,
Children =
{
new TextBlock{ Text="是否打开:"},
new Switch{
OffColor=Color.Silver,
Width=45,Height=20
},
}
}
},
},
SendReceiveType = EChatType.Receive,
User = new UserInfo()
{
NickName = "BinGoo",
HeadImage = "https://q1.itc.cn/q_70/images03/20240320/fcf023d835c54f78bac6c7efc98fbb4c.jpeg"
}
});
CreatMacMenu();
}
#if !DesignMode //用户代码写到这里,设计器下不执行,防止设计器出错
protected override void OnInitialized()
{
base.OnInitialized();
DispatcherTimer m_Timer = new DispatcherTimer();
m_Timer.Interval = TimeSpan.FromSeconds(1);
m_Timer.Tick += M_Timer_Tick; ;
m_Timer.IsEnabled = false;
m_Timer.Start();
CreatTabBar();
CreatIMListbox();
CreatIpadView();
}
private void M_Timer_Tick(object sender, EventArgs e)
{
string hour = DateTime.Now.Hour.ToString("D2");
string minute = DateTime.Now.Minute.ToString("D2");
string second = DateTime.Now.Second.ToString("D2");
Hour1 = hour[0];
Hour2 = hour[1];
Minute1 = minute[0];
Minute2 = minute[1];
Second1 = second[0];
Second2 = second[1];
Invalidate();
}
//用户代码
#endif
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/nect/CPFUI.git
git@gitee.com:nect/CPFUI.git
nect
CPFUI
CPFUI
master

搜索帮助