mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-05 08:46:34 +08:00
放大缩小
This commit is contained in:
@@ -58,7 +58,8 @@ namespace AIStudio.Wpf.DiagramDesigner.Demo
|
||||
new MenuItemViewModel(){Title = "Svg"},
|
||||
new MenuItemViewModel(){Title = "CustomDefinedNode"},
|
||||
new MenuItemViewModel(){Title = "PortlessLinks"},
|
||||
new MenuItemViewModel(){Title = "GradientNode"},
|
||||
new MenuItemViewModel(){Title = "GradientNode"},
|
||||
new MenuItemViewModel(){Title = "Rotate" },
|
||||
}
|
||||
},
|
||||
new MenuItemViewModel(){Title = "Links",
|
||||
@@ -72,7 +73,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Demo
|
||||
new MenuItemViewModel(){Title = "PathGenerators"},
|
||||
}
|
||||
},
|
||||
new MenuItemViewModel(){Title = "Ports",
|
||||
new MenuItemViewModel(){Title = "Ports",
|
||||
Children=new List<MenuItemViewModel>
|
||||
{
|
||||
new MenuItemViewModel(){Title = "ColoredPort"},
|
||||
@@ -86,6 +87,16 @@ namespace AIStudio.Wpf.DiagramDesigner.Demo
|
||||
new MenuItemViewModel(){Title = "CustomDefinedGroup"},
|
||||
new MenuItemViewModel(){Title = "CustomShortcutGroup"},
|
||||
}
|
||||
},
|
||||
new MenuItemViewModel(){Title = "Texts",
|
||||
Children=new List<MenuItemViewModel>
|
||||
{
|
||||
new MenuItemViewModel(){Title = "Text"},
|
||||
new MenuItemViewModel(){Title = "Alignment"},
|
||||
new MenuItemViewModel(){Title = "FontSize"},
|
||||
new MenuItemViewModel(){Title = "ColorText"},
|
||||
new MenuItemViewModel(){Title = "OutlineText"},
|
||||
}
|
||||
},
|
||||
new MenuItemViewModel(){Title = "Customization",
|
||||
Children=new List<MenuItemViewModel>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels.Nodes
|
||||
{
|
||||
class RotateViewModel : BaseViewModel
|
||||
{
|
||||
public RotateViewModel()
|
||||
{
|
||||
Title = "Rotate";
|
||||
Info = "A simple example of AIStudio.Wpf.DiagramDesigner.";
|
||||
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
DiagramViewModel.ColorViewModel = new ColorViewModel();
|
||||
DiagramViewModel.ColorViewModel.FillColor.Color = System.Windows.Media.Colors.Orange;
|
||||
|
||||
DefaultDesignerItemViewModel node1 = new DefaultDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 50, Text = "1" };
|
||||
node1.ShowRotate = true;
|
||||
node1.Angle = 45;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node1);
|
||||
|
||||
DefaultDesignerItemViewModel node2 = new DefaultDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 300, Text = "2" };
|
||||
node2.ShowRotate = true;
|
||||
node2.ScaleX = 1.5;
|
||||
node2.ScaleY = 1.5;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node2);
|
||||
|
||||
DefaultDesignerItemViewModel node3 = new DefaultDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 50, Text = "3" };
|
||||
node3.ShowRotate = true;
|
||||
node3.ScaleX = -1;
|
||||
node3.ScaleY = -1;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node3);
|
||||
|
||||
ConnectionViewModel connector1 = new ConnectionViewModel(DiagramViewModel, node1.RightConnector, node2.LeftConnector, DrawMode.ConnectingLineSmooth, RouterMode.RouterNormal);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
||||
|
||||
ConnectionViewModel connector2 = new ConnectionViewModel(DiagramViewModel, node2.RightConnector, node3.RightConnector, DrawMode.ConnectingLineStraight, RouterMode.RouterOrthogonal);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
||||
|
||||
DiagramViewModel.ClearSelectedItemsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
|
||||
{
|
||||
class AlignmentViewModel : BaseViewModel
|
||||
{
|
||||
public AlignmentViewModel()
|
||||
{
|
||||
Title = "Text Alignment";
|
||||
Info = "A text node of AIStudio.Wpf.DiagramDesigner.";
|
||||
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
DiagramViewModel.ColorViewModel = new ColorViewModel();
|
||||
|
||||
TextDesignerItemViewModel node1 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 50, ItemWidth = 230, Text = "竹外桃花三两枝,春江水暖鸭先知。\r\n蒌蒿满地芦芽短,正是河豚欲上时。" };
|
||||
node1.FontViewModel.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
node1.FontViewModel.VerticalAlignment = VerticalAlignment.Top;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node1);
|
||||
|
||||
TextDesignerItemViewModel node2 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 50, ItemWidth = 200, Text = "解落三秋叶,能开二月花。\r\n过江千尺浪,入竹万竿斜。" };
|
||||
node2.FontViewModel.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
node2.FontViewModel.VerticalAlignment = VerticalAlignment.Top;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node2);
|
||||
|
||||
TextDesignerItemViewModel node3 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 150, ItemWidth = 200, Text = "一节复一节,千枝攒万叶。\r\n我自不开花,免撩蜂与蝶。" };
|
||||
node3.FontViewModel.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
node3.FontViewModel.VerticalAlignment = VerticalAlignment.Bottom;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node3);
|
||||
|
||||
TextDesignerItemViewModel node4 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 150, ItemWidth = 200, Text = "独坐幽篁里,弹琴复长啸。\r\n深林人不知,明月来相照。" };
|
||||
node4.FontViewModel.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
node4.FontViewModel.VerticalAlignment = VerticalAlignment.Bottom;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node4);
|
||||
|
||||
DiagramViewModel.ClearSelectedItemsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels.Texts
|
||||
{
|
||||
class ColorTextViewModel : BaseViewModel
|
||||
{
|
||||
public ColorTextViewModel()
|
||||
{
|
||||
Title = "Color Text";
|
||||
Info = "A text node of AIStudio.Wpf.DiagramDesigner.";
|
||||
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
DiagramViewModel.ColorViewModel = new ColorViewModel();
|
||||
|
||||
TextDesignerItemViewModel node1 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 50, ItemWidth = 230, Text = "竹外桃花三两枝,春江水暖鸭先知。\r\n蒌蒿满地芦芽短,正是河豚欲上时。" };
|
||||
node1.FontViewModel.FontColor = System.Windows.Media.Colors.Red;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node1);
|
||||
|
||||
TextDesignerItemViewModel node2 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 50, ItemWidth = 200, Text = "解落三秋叶,能开二月花。\r\n过江千尺浪,入竹万竿斜。" };
|
||||
node2.FontViewModel.TextEffectColor = System.Windows.Media.Colors.Orange;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node2);
|
||||
|
||||
TextDesignerItemViewModel node3 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 150, ItemWidth = 200, ItemHeight=100, Text = "一节复一节,千枝攒万叶。\r\n我自不开花,免撩蜂与蝶。\r\n\r\n暂未实现,敬请期待" };
|
||||
node3.FontViewModel.HighlightColor = System.Windows.Media.Colors.Green;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node3);
|
||||
|
||||
TextDesignerItemViewModel node4 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 150, ItemWidth = 200, Text = "独坐幽篁里,弹琴复长啸。\r\n深林人不知,明月来相照。" };
|
||||
node4.FontViewModel.FontColor = System.Windows.Media.Colors.White;
|
||||
node4.ColorViewModel.FillColor.Color = System.Windows.Media.Colors.Blue;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node4);
|
||||
|
||||
DiagramViewModel.ClearSelectedItemsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels.Texts
|
||||
{
|
||||
class FontSizeViewModel : BaseViewModel
|
||||
{
|
||||
public FontSizeViewModel()
|
||||
{
|
||||
Title = "Text Alignment";
|
||||
Info = "A text node of AIStudio.Wpf.DiagramDesigner.";
|
||||
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
DiagramViewModel.ColorViewModel = new ColorViewModel();
|
||||
|
||||
TextDesignerItemViewModel node1 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 30, Top = 50, ItemWidth = 260, Text = "竹外桃花三两枝,春江水暖鸭先知。\r\n蒌蒿满地芦芽短,正是河豚欲上时。" };
|
||||
node1.FontViewModel.FontSize = 15;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node1);
|
||||
|
||||
TextDesignerItemViewModel node2 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 50, ItemWidth = 200, Text = "解落三秋叶,能开二月花。\r\n过江千尺浪,入竹万竿斜。" };
|
||||
node2.FontViewModel.FontWeight = FontWeights.Bold;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node2);
|
||||
|
||||
TextDesignerItemViewModel node3 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 150, ItemWidth = 200, Text = "一节复一节,千枝攒万叶。\r\n我自不开花,免撩蜂与蝶。" };
|
||||
node3.FontViewModel.FontStretch = FontStretches.Expanded;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node3);
|
||||
|
||||
TextDesignerItemViewModel node4 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 150, ItemWidth = 200, Text = "独坐幽篁里,弹琴复长啸。\r\n深林人不知,明月来相照。" };
|
||||
node4.FontViewModel.FontFamily = "宋体";
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node4);
|
||||
|
||||
DiagramViewModel.ClearSelectedItemsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using AIStudio.Wpf.DiagramDesigner.Additionals.Extensions.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels.Texts
|
||||
{
|
||||
class OutlineTextViewModel : BaseViewModel
|
||||
{
|
||||
public OutlineTextViewModel()
|
||||
{
|
||||
Title = "Text";
|
||||
Info = "A text node of AIStudio.Wpf.DiagramDesigner.";
|
||||
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
DiagramViewModel.ColorViewModel = new ColorViewModel();
|
||||
|
||||
OutLineTextDesignerItemViewModel node1 = new OutLineTextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 50, ItemWidth = 600, ItemHeight = 100, Text = "竹外桃花三两枝,春江水暖鸭先知。\r\n蒌蒿满地芦芽短,正是河豚欲上时。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node1);
|
||||
|
||||
OutLineTextDesignerItemViewModel node2 = new OutLineTextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 160, ItemWidth = 500, ItemHeight = 100, Text = "解落三秋叶,能开二月花。\r\n过江千尺浪,入竹万竿斜。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node2);
|
||||
|
||||
OutLineTextDesignerItemViewModel node3 = new OutLineTextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 270, ItemWidth = 500, ItemHeight = 100, Text = "一节复一节,千枝攒万叶。\r\n我自不开花,免撩蜂与蝶。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node3);
|
||||
|
||||
OutLineTextDesignerItemViewModel node4 = new OutLineTextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 380, ItemWidth = 500, ItemHeight = 100, Text = "独坐幽篁里,弹琴复长啸。\r\n深林人不知,明月来相照。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node4);
|
||||
|
||||
DiagramViewModel.ClearSelectedItemsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels.Texts
|
||||
{
|
||||
class TextViewModel : BaseViewModel
|
||||
{
|
||||
public TextViewModel()
|
||||
{
|
||||
Title = "Text";
|
||||
Info = "A text node of AIStudio.Wpf.DiagramDesigner.";
|
||||
|
||||
DiagramViewModel = new DiagramViewModel();
|
||||
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
||||
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
||||
DiagramViewModel.ColorViewModel = new ColorViewModel();
|
||||
|
||||
TextDesignerItemViewModel node1 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 50, ItemWidth=230, Text = "竹外桃花三两枝,春江水暖鸭先知。\r\n蒌蒿满地芦芽短,正是河豚欲上时。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node1);
|
||||
|
||||
TextDesignerItemViewModel node2 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 50, ItemWidth = 200, Text = "解落三秋叶,能开二月花。\r\n过江千尺浪,入竹万竿斜。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node2);
|
||||
|
||||
TextDesignerItemViewModel node3 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 50, Top = 150, ItemWidth = 200, Text = "一节复一节,千枝攒万叶。\r\n我自不开花,免撩蜂与蝶。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node3);
|
||||
|
||||
TextDesignerItemViewModel node4 = new TextDesignerItemViewModel(DiagramViewModel) { Left = 300, Top = 150, ItemWidth = 200, Text = "独坐幽篁里,弹琴复长啸。\r\n深林人不知,明月来相照。" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(node4);
|
||||
|
||||
DiagramViewModel.ClearSelectedItemsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.RotateView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl x:Name="diagram" DataContext="{Binding DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<controls:TitleControl/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// RotateView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class RotateView : UserControl
|
||||
{
|
||||
public RotateView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.AlignmentView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl x:Name="diagram" DataContext="{Binding DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<controls:TitleControl/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// AlignmentView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AlignmentView : UserControl
|
||||
{
|
||||
public AlignmentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.ColorTextView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl x:Name="diagram" DataContext="{Binding DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<controls:TitleControl/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ColorTextView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ColorTextView : UserControl
|
||||
{
|
||||
public ColorTextView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.FontSizeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl x:Name="diagram" DataContext="{Binding DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<controls:TitleControl/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// FontSizeView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class FontSizeView : UserControl
|
||||
{
|
||||
public FontSizeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.OutlineTextView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl x:Name="diagram" DataContext="{Binding DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<controls:TitleControl/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// OutlineTextView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class OutlineTextView : UserControl
|
||||
{
|
||||
public OutlineTextView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
16
AIStudio.Wpf.DiagramDesigner.Demo/Views/Texts/TextView.xaml
Normal file
16
AIStudio.Wpf.DiagramDesigner.Demo/Views/Texts/TextView.xaml
Normal file
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.Demo.Views.TextView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Demo.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl x:Name="diagram" DataContext="{Binding DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<controls:TitleControl/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Demo.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// TextView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TextView : UserControl
|
||||
{
|
||||
public TextView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,24 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
base.OnPreviewKeyDown(e);
|
||||
|
||||
|
||||
e.Handled = DiagramViewModel.ExecuteShortcut(e);
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseWheel(e);
|
||||
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl) == false
|
||||
&& Keyboard.IsKeyDown(Key.RightCtrl) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newZoomValue = DiagramViewModel.ZoomValue + (e.Delta > 0 ? 0.1 : -0.1);
|
||||
|
||||
DiagramViewModel.ZoomValue = Math.Max(Math.Min(newZoomValue, 10), 0.5);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
double ZoomValue
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
System.Windows.Point CurrentPoint
|
||||
{
|
||||
get; set;
|
||||
@@ -271,7 +274,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
DiagramOption DiagramOption
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//用于wpf大小与物理像素之间转换
|
||||
double ScreenScale
|
||||
|
||||
Reference in New Issue
Block a user