|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699 |
- <ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:control="clr-namespace:ComeCapture.Controls"
- xmlns:converter="clr-namespace:ComeCapture.Converters"
- xmlns:sys="clr-namespace:System;assembly=mscorlib">
-
- <SolidColorBrush x:Key="BaseColor" Color="#2ecc71" />
- <SolidColorBrush x:Key="ToolButtonBorder" Color="#9EA0A1" />
- <SolidColorBrush x:Key="ToolButtonHoverBackground" Color="#DEE3E9" />
- <SolidColorBrush x:Key="ToolColor" Color="#478cde" />
- <SolidColorBrush x:Key="StackPanelColor" Color="#EAEEF5" />
-
- <sys:Double x:Key="Small">2</sys:Double>
- <sys:Double x:Key="Medium">5</sys:Double>
- <sys:Double x:Key="Large">8</sys:Double>
-
- <!--<converter:ToolConverter x:Key="ToolConverter" />
- <converter:SizeConverter x:Key="SizeConverter" />
- <converter:ColorConverter x:Key="ColorConverter" />-->
-
- <converter:ToolConverter x:Key="ToolConverter"/>
- <converter:SizeConverter x:Key="SizeConverter"/>
- <converter:ColorConverter x:Key="ColorConverter"/>
-
- <!-- 移动滑块 -->
- <Style x:Key="MoveThumb" TargetType="{x:Type control:ZoomThumb}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:ZoomThumb}">
- <Rectangle
- Fill="Transparent"
- SnapsToDevicePixels="True"
- Stroke="LimeGreen"
- StrokeThickness="1" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 拉伸滑块 -->
- <Style x:Key="ZoomThumb" TargetType="{x:Type control:ZoomThumb}">
- <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type control:MainImage}}, Path=ZoomThumbVisibility}" />
- <Setter Property="Margin" Value="-3" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:ZoomThumb}">
- <Border
- Width="6"
- Height="6"
- Background="{StaticResource BaseColor}" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 截图区域 -->
- <Style TargetType="{x:Type control:MainImage}">
- <Setter Property="Visibility" Value="Collapsed" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:MainImage}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <control:ZoomThumb
- Grid.RowSpan="3"
- Grid.ColumnSpan="3"
- Cursor="{Binding RelativeSource={RelativeSource AncestorType=control:MainImage}, Path=MoveCursor}"
- Direction="Move"
- Style="{StaticResource MoveThumb}" />
- <control:ZoomThumb
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- Cursor="SizeNWSE"
- Direction="LeftTop"
- Style="{StaticResource ZoomThumb}" />
- <control:ZoomThumb
- Grid.Row="1"
- HorizontalAlignment="Left"
- Cursor="SizeWE"
- Direction="LeftMiddle"
- Style="{StaticResource ZoomThumb}" />
- <control:ZoomThumb
- Grid.Row="2"
- HorizontalAlignment="Left"
- VerticalAlignment="Bottom"
- Cursor="SizeNESW"
- Direction="LeftBottom"
- Style="{StaticResource ZoomThumb}" />
- <control:ZoomThumb
- Grid.Column="1"
- VerticalAlignment="Top"
- Cursor="SizeNS"
- Direction="MiddleTop"
- Style="{StaticResource ZoomThumb}" />
- <control:ZoomThumb
- Grid.Row="2"
- Grid.Column="1"
- VerticalAlignment="Bottom"
- Cursor="SizeNS"
- Direction="MiddleBottom"
- Style="{StaticResource ZoomThumb}" />
- <control:ZoomThumb
- Grid.Column="2"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Cursor="SizeNESW"
- Direction="RightTop"
- Style="{StaticResource ZoomThumb}" />
- <control:ZoomThumb
- Grid.Row="1"
- Grid.Column="2"
- HorizontalAlignment="Right"
- Cursor="SizeWE"
- Direction="RightMiddle"
- Style="{StaticResource ZoomThumb}" />
- <control:ZoomThumb
- Grid.Row="2"
- Grid.Column="2"
- HorizontalAlignment="Right"
- VerticalAlignment="Bottom"
- Cursor="SizeNWSE"
- Direction="RightBottom"
- Style="{StaticResource ZoomThumb}" />
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 按钮 -->
- <Style x:Key="BaseButton" TargetType="{x:Type ButtonBase}">
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:ToolButton}">
- <Border
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="1"
- CornerRadius="1">
- <ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
- <Setter Property="Background" Value="{StaticResource ToolButtonHoverBackground}" />
- </Trigger>
- <Trigger Property="IsChecked" Value="True">
- <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
- <Setter Property="Background" Value="{StaticResource ToolButtonHoverBackground}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 工具按钮 -->
- <Style
- x:Key="ToolButton"
- BasedOn="{StaticResource BaseButton}"
- TargetType="{x:Type control:ToolButton}">
- <Setter Property="Margin" Value="3" />
- <Setter Property="Width" Value="24" />
- <Setter Property="Height" Value="19" />
- <Setter Property="IsImageEditBar" Value="True" />
- <Setter Property="GroupName" Value="Tools" />
- </Style>
-
- <!-- 尺寸按钮 -->
- <Style
- x:Key="SizeButton"
- BasedOn="{StaticResource BaseButton}"
- TargetType="{x:Type control:ToolButton}">
- <Setter Property="Margin" Value="1,5" />
- <Setter Property="Width" Value="24" />
- <Setter Property="Height" Value="25" />
- </Style>
-
- <!-- 颜色按钮 -->
- <Style x:Key="ColorButton" TargetType="{x:Type control:ToolButton}">
- <Setter Property="Width" Value="16" />
- <Setter Property="Height" Value="16" />
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:ToolButton}">
- <Border
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="1"
- CornerRadius="1">
- <ContentControl
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Content="{TemplateBinding Content}"
- ContentTemplate="{TemplateBinding ContentTemplate}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
- <Setter Property="Background" Value="White" />
- </Trigger>
- <Trigger Property="IsChecked" Value="True">
- <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
- <Setter Property="Background" Value="White" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 工具栏 -->
- <Style TargetType="{x:Type control:ImageEditBar}">
- <Setter Property="Width" Value="270" />
- <Setter Property="Height" Value="25" />
- <Setter Property="Visibility" Value="Collapsed" />
- <Setter Property="Background" Value="{StaticResource StackPanelColor}" />
- <Setter Property="Cursor" Value="Arrow" />
- <Setter Property="Canvas.Left" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasLeft}" />
- <Setter Property="Canvas.Top" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasTop}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:ImageEditBar}">
- <StackPanel
- Width="60"
- Height="{TemplateBinding Height}"
- HorizontalAlignment="Right"
- Background="{TemplateBinding Background}"
- Orientation="Horizontal">
- <!--<control:ToolButton Tool="Rectangle" ToolTip="矩形工具" Style="{StaticResource ToolButton}">
- <Rectangle Width="17" Height="14" Stroke="{StaticResource ToolColor}" StrokeThickness="2" Fill="White" />
- </control:ToolButton>
- <control:ToolButton Tool="Ellipse" ToolTip="椭圆工具" Style="{StaticResource ToolButton}">
- <Ellipse Width="17" Height="14" Stroke="{StaticResource ToolColor}" StrokeThickness="2" Fill="White" />
- </control:ToolButton>
- <control:ToolButton Tool="Arrow" ToolTip="箭头工具" Style="{StaticResource ToolButton}">
- <Image Width="18" Height="15" Source="/ComeCapture;component/Resources/箭头.png" />
- </control:ToolButton>
- <control:ToolButton Tool="Line" ToolTip="画刷工具" Style="{StaticResource ToolButton}">
- <Image Width="18" Height="15" Source="/ComeCapture;component/Resources/笔刷.png" />
- </control:ToolButton>
- <control:ToolButton Tool="Text" ToolTip="文字工具" Style="{StaticResource ToolButton}">
- <TextBlock Text="A" FontSize="19" TextAlignment="Center" Margin="0,-4,0,0" FontWeight="Bold" Foreground="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton Tool="Revoke" ToolTip="撤销编辑" Style="{StaticResource ToolButton}">
- <Image Margin="0,-1,0,1" Width="18" Height="15" Source="/ComeCapture;component/Resources/后退.png" />
- </control:ToolButton>
- <control:ToolButton Tool="Save" ToolTip="保存" Style="{StaticResource ToolButton}">
- <Image Margin="0,1,0,-1" Width="18" Height="15" Source="/ComeCapture;component/Resources/保存.png" />
- </control:ToolButton>-->
- <control:ToolButton Cursor="Hand"
- Style="{StaticResource ToolButton}"
- Tool="Cancel"
- ToolTip="退出截图">
- <Grid Width="17" Height="14">
- <Path
- Data="M 4,2 L 15,13"
- Stroke="Red"
- StrokeThickness="4" />
- <Path
- Data="M 4,13 L 15,2"
- Stroke="Red"
- StrokeThickness="4" />
- </Grid>
- </control:ToolButton>
- <control:ToolButton Cursor="Hand"
- Style="{StaticResource ToolButton}"
- Tool="OK"
- ToolTip="完成截图">
- <Grid Width="17" Height="14">
- <Path
- Data="M 2,7 L 7,12 L 16,2"
- Stroke="Green"
- StrokeThickness="4" />
- </Grid>
- </control:ToolButton>
- </StackPanel>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 尺寸颜色栏基础样式 -->
- <Style x:Key="BaseSizeColor" TargetType="{x:Type StackPanel}">
- <Setter Property="Width" Value="270" />
- <Setter Property="Height" Value="35" />
- <Setter Property="Orientation" Value="Horizontal" />
- <Setter Property="Visibility" Value="Collapsed" />
- <Setter Property="Background" Value="{StaticResource StackPanelColor}" />
- </Style>
-
- <!-- 颜色板Item -->
- <Style x:Key="ColorBoxItem" TargetType="{x:Type ListBoxItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListBoxItem}">
- <ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 颜色板 -->
- <Style x:Key="ColorBarStyle" TargetType="{x:Type ListBox}">
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="ItemsSource" Value="{x:Static control:SizeColorBar.ColorBars}" />
- <Setter Property="ItemContainerStyle" Value="{StaticResource ColorBoxItem}" />
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <UniformGrid
- Height="32"
- Columns="9"
- Rows="2" />
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 尺寸颜色栏 -->
- <Style TargetType="{x:Type control:SizeColorBar}">
- <Setter Property="Canvas.Left" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasLeft}" />
- <Setter Property="Canvas.Top" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasTop}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:SizeColorBar}">
- <Grid>
-
- <control:RectangleTool
- x:Name="PART_RectangleTool"
- Style="{StaticResource BaseSizeColor}"
- Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Rectangle}">
- <control:ToolButton
- GroupName="RectangleTool"
- IsChecked="{Binding ElementName=PART_RectangleTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Small}"
- Height="{StaticResource Small}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="RectangleTool"
- IsChecked="{Binding ElementName=PART_RectangleTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Medium}"
- Height="{StaticResource Medium}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="RectangleTool"
- IsChecked="{Binding ElementName=PART_RectangleTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Large}"
- Height="{StaticResource Large}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <Grid
- Width="29"
- Height="29"
- Margin="5,0,5,0"
- Background="White">
- <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
- <Canvas
- Width="25"
- Height="25"
- Background="{Binding ElementName=PART_RectangleTool, Path=LineBrush}" />
- </Border>
- </Grid>
- <ListBox Style="{StaticResource ColorBarStyle}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <control:ToolButton
- GroupName="RectangleColor"
- LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
- Style="{StaticResource ColorButton}">
- <Rectangle
- Width="12"
- Height="12"
- Fill="{Binding}"
- Stroke="{StaticResource ToolButtonBorder}"
- StrokeThickness="1" />
- </control:ToolButton>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </control:RectangleTool>
-
- <control:EllipseTool
- x:Name="PART_EllipseTool"
- Style="{StaticResource BaseSizeColor}"
- Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Ellipse}">
- <control:ToolButton
- GroupName="EllipseTool"
- IsChecked="{Binding ElementName=PART_EllipseTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Small}"
- Height="{StaticResource Small}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="EllipseTool"
- IsChecked="{Binding ElementName=PART_EllipseTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Medium}"
- Height="{StaticResource Medium}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="EllipseTool"
- IsChecked="{Binding ElementName=PART_EllipseTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Large}"
- Height="{StaticResource Large}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
-
- <Grid
- Width="29"
- Height="29"
- Margin="5,0"
- Background="White">
- <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
- <Canvas
- Width="25"
- Height="25"
- Background="{Binding ElementName=PART_EllipseTool, Path=LineBrush}" />
- </Border>
- </Grid>
- <ListBox Style="{StaticResource ColorBarStyle}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <control:ToolButton
- GroupName="EllipseColor"
- LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
- Style="{StaticResource ColorButton}">
- <Rectangle
- Width="12"
- Height="12"
- Fill="{Binding}"
- Stroke="{StaticResource ToolButtonBorder}"
- StrokeThickness="1" />
- </control:ToolButton>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </control:EllipseTool>
-
- <control:ArrowTool
- x:Name="PART_ArrowTool"
- Style="{StaticResource BaseSizeColor}"
- Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Arrow}">
- <control:ToolButton
- GroupName="ArrowTool"
- IsChecked="{Binding ElementName=PART_ArrowTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Small}"
- Height="{StaticResource Small}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="ArrowTool"
- IsChecked="{Binding ElementName=PART_ArrowTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Medium}"
- Height="{StaticResource Medium}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="ArrowTool"
- IsChecked="{Binding ElementName=PART_ArrowTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Large}"
- Height="{StaticResource Large}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
-
- <Grid
- Width="29"
- Height="29"
- Margin="5,0"
- Background="White">
- <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
- <Canvas
- Width="25"
- Height="25"
- Background="{Binding ElementName=PART_ArrowTool, Path=LineBrush}" />
- </Border>
- </Grid>
- <ListBox Style="{StaticResource ColorBarStyle}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <control:ToolButton
- GroupName="ArrowColor"
- LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
- Style="{StaticResource ColorButton}">
- <Rectangle
- Width="12"
- Height="12"
- Fill="{Binding}"
- Stroke="{StaticResource ToolButtonBorder}"
- StrokeThickness="1" />
- </control:ToolButton>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </control:ArrowTool>
-
- <control:LineTool
- x:Name="PART_LineTool"
- Style="{StaticResource BaseSizeColor}"
- Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Line}">
- <control:ToolButton
- GroupName="LineTool"
- IsChecked="{Binding ElementName=PART_LineTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Small}"
- Height="{StaticResource Small}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="LineTool"
- IsChecked="{Binding ElementName=PART_LineTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Medium}"
- Height="{StaticResource Medium}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
- <control:ToolButton
- GroupName="LineTool"
- IsChecked="{Binding ElementName=PART_LineTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
- Style="{StaticResource SizeButton}">
- <Ellipse
- Width="{StaticResource Large}"
- Height="{StaticResource Large}"
- Fill="{StaticResource ToolColor}" />
- </control:ToolButton>
-
- <Grid
- Width="29"
- Height="29"
- Margin="5,0"
- Background="White">
- <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
- <Canvas
- Width="25"
- Height="25"
- Background="{Binding ElementName=PART_LineTool, Path=LineBrush}" />
- </Border>
- </Grid>
- <ListBox Style="{StaticResource ColorBarStyle}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <control:ToolButton
- GroupName="LineColor"
- LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
- Style="{StaticResource ColorButton}">
- <Rectangle
- Width="12"
- Height="12"
- Fill="{Binding}"
- Stroke="{StaticResource ToolButtonBorder}"
- StrokeThickness="1" />
- </control:ToolButton>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </control:LineTool>
-
- <control:TextTool
- x:Name="PART_TextTool"
- Style="{StaticResource BaseSizeColor}"
- Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Text}">
- <TextBlock
- Width="24"
- Height="30"
- Margin="3,2"
- FontSize="23"
- FontWeight="Bold"
- Foreground="{StaticResource ToolColor}"
- Text="A"
- TextAlignment="Center" />
- <ComboBox
- Width="42"
- Height="21"
- Margin="0,7,6,7"
- DisplayMemberPath="Key"
- ItemsSource="{x:Static control:TextTool.FontSizes}"
- SelectedItem="12"
- SelectedValue="{Binding ElementName=PART_TextTool, Path=FontSize}"
- SelectedValuePath="Key"
- Style="{x:Null}" />
-
- <Grid
- Width="29"
- Height="29"
- Margin="5,0"
- Background="White">
- <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
- <Canvas
- Width="25"
- Height="25"
- Background="{Binding ElementName=PART_TextTool, Path=LineBrush}" />
- </Border>
- </Grid>
- <ListBox Style="{StaticResource ColorBarStyle}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <control:ToolButton
- GroupName="TextColor"
- LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
- Style="{StaticResource ColorButton}">
- <Rectangle
- Width="12"
- Height="12"
- Fill="{Binding}"
- Stroke="{StaticResource ToolButtonBorder}"
- StrokeThickness="1" />
- </control:ToolButton>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </control:TextTool>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!-- 文字输入框 -->
- <Style TargetType="{x:Type control:TextBoxControl}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type control:TextBoxControl}">
- <Grid FocusManager.FocusedElement="{Binding ElementName=PART_TextBox}">
- <Border
- Width="{Binding ElementName=PART_TextBox, Path=Width}"
- Height="{Binding ElementName=PART_TextBox, Path=Height}"
- BorderThickness="3">
- <Border.BorderBrush>
- <LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat" StartPoint="0,5" EndPoint="5,0">
- <LinearGradientBrush.GradientStops>
- <GradientStop Offset="0" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
- <GradientStop Offset="0.2" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
- <GradientStop Offset="0.4" Color="Transparent" />
- <GradientStop Offset="0.6" Color="Transparent" />
- <GradientStop Offset="0.8" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
- <GradientStop Offset="1" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
- </LinearGradientBrush.GradientStops>
- </LinearGradientBrush>
- </Border.BorderBrush>
- <TextBox
- Name="PART_TextBox"
- MinWidth="30"
- AcceptsReturn="True"
- Background="Transparent"
- BorderThickness="0"
- FontSize="{TemplateBinding FontSize}"
- Foreground="{TemplateBinding Foreground}"
- TextWrapping="Wrap" />
- </Border>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderColor" Value="Blue" />
- </Trigger>
- <Trigger Property="MyFocus" Value="True">
- <Setter Property="BorderColor" Value="Blue" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|