星火微课系统客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:control="clr-namespace:ComeCapture.Controls"
  5. xmlns:converter="clr-namespace:ComeCapture.Converters"
  6. xmlns:sys="clr-namespace:System;assembly=mscorlib">
  7. <SolidColorBrush x:Key="BaseColor" Color="#2ecc71" />
  8. <SolidColorBrush x:Key="ToolButtonBorder" Color="#9EA0A1" />
  9. <SolidColorBrush x:Key="ToolButtonHoverBackground" Color="#DEE3E9" />
  10. <SolidColorBrush x:Key="ToolColor" Color="#478cde" />
  11. <SolidColorBrush x:Key="StackPanelColor" Color="#EAEEF5" />
  12. <sys:Double x:Key="Small">2</sys:Double>
  13. <sys:Double x:Key="Medium">5</sys:Double>
  14. <sys:Double x:Key="Large">8</sys:Double>
  15. <!--<converter:ToolConverter x:Key="ToolConverter" />
  16. <converter:SizeConverter x:Key="SizeConverter" />
  17. <converter:ColorConverter x:Key="ColorConverter" />-->
  18. <converter:ToolConverter x:Key="ToolConverter"/>
  19. <converter:SizeConverter x:Key="SizeConverter"/>
  20. <converter:ColorConverter x:Key="ColorConverter"/>
  21. <!-- 移动滑块 -->
  22. <Style x:Key="MoveThumb" TargetType="{x:Type control:ZoomThumb}">
  23. <Setter Property="Template">
  24. <Setter.Value>
  25. <ControlTemplate TargetType="{x:Type control:ZoomThumb}">
  26. <Rectangle
  27. Fill="Transparent"
  28. SnapsToDevicePixels="True"
  29. Stroke="LimeGreen"
  30. StrokeThickness="1" />
  31. </ControlTemplate>
  32. </Setter.Value>
  33. </Setter>
  34. </Style>
  35. <!-- 拉伸滑块 -->
  36. <Style x:Key="ZoomThumb" TargetType="{x:Type control:ZoomThumb}">
  37. <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type control:MainImage}}, Path=ZoomThumbVisibility}" />
  38. <Setter Property="Margin" Value="-3" />
  39. <Setter Property="Template">
  40. <Setter.Value>
  41. <ControlTemplate TargetType="{x:Type control:ZoomThumb}">
  42. <Border
  43. Width="6"
  44. Height="6"
  45. Background="{StaticResource BaseColor}" />
  46. </ControlTemplate>
  47. </Setter.Value>
  48. </Setter>
  49. </Style>
  50. <!-- 截图区域 -->
  51. <Style TargetType="{x:Type control:MainImage}">
  52. <Setter Property="Visibility" Value="Collapsed" />
  53. <Setter Property="Template">
  54. <Setter.Value>
  55. <ControlTemplate TargetType="{x:Type control:MainImage}">
  56. <Grid>
  57. <Grid.ColumnDefinitions>
  58. <ColumnDefinition Width="*" />
  59. <ColumnDefinition Width="*" />
  60. <ColumnDefinition Width="*" />
  61. </Grid.ColumnDefinitions>
  62. <Grid.RowDefinitions>
  63. <RowDefinition Height="*" />
  64. <RowDefinition Height="*" />
  65. <RowDefinition Height="*" />
  66. </Grid.RowDefinitions>
  67. <control:ZoomThumb
  68. Grid.RowSpan="3"
  69. Grid.ColumnSpan="3"
  70. Cursor="{Binding RelativeSource={RelativeSource AncestorType=control:MainImage}, Path=MoveCursor}"
  71. Direction="Move"
  72. Style="{StaticResource MoveThumb}" />
  73. <control:ZoomThumb
  74. HorizontalAlignment="Left"
  75. VerticalAlignment="Top"
  76. Cursor="SizeNWSE"
  77. Direction="LeftTop"
  78. Style="{StaticResource ZoomThumb}" />
  79. <control:ZoomThumb
  80. Grid.Row="1"
  81. HorizontalAlignment="Left"
  82. Cursor="SizeWE"
  83. Direction="LeftMiddle"
  84. Style="{StaticResource ZoomThumb}" />
  85. <control:ZoomThumb
  86. Grid.Row="2"
  87. HorizontalAlignment="Left"
  88. VerticalAlignment="Bottom"
  89. Cursor="SizeNESW"
  90. Direction="LeftBottom"
  91. Style="{StaticResource ZoomThumb}" />
  92. <control:ZoomThumb
  93. Grid.Column="1"
  94. VerticalAlignment="Top"
  95. Cursor="SizeNS"
  96. Direction="MiddleTop"
  97. Style="{StaticResource ZoomThumb}" />
  98. <control:ZoomThumb
  99. Grid.Row="2"
  100. Grid.Column="1"
  101. VerticalAlignment="Bottom"
  102. Cursor="SizeNS"
  103. Direction="MiddleBottom"
  104. Style="{StaticResource ZoomThumb}" />
  105. <control:ZoomThumb
  106. Grid.Column="2"
  107. HorizontalAlignment="Right"
  108. VerticalAlignment="Top"
  109. Cursor="SizeNESW"
  110. Direction="RightTop"
  111. Style="{StaticResource ZoomThumb}" />
  112. <control:ZoomThumb
  113. Grid.Row="1"
  114. Grid.Column="2"
  115. HorizontalAlignment="Right"
  116. Cursor="SizeWE"
  117. Direction="RightMiddle"
  118. Style="{StaticResource ZoomThumb}" />
  119. <control:ZoomThumb
  120. Grid.Row="2"
  121. Grid.Column="2"
  122. HorizontalAlignment="Right"
  123. VerticalAlignment="Bottom"
  124. Cursor="SizeNWSE"
  125. Direction="RightBottom"
  126. Style="{StaticResource ZoomThumb}" />
  127. </Grid>
  128. </ControlTemplate>
  129. </Setter.Value>
  130. </Setter>
  131. </Style>
  132. <!-- 按钮 -->
  133. <Style x:Key="BaseButton" TargetType="{x:Type ButtonBase}">
  134. <Setter Property="BorderBrush" Value="Transparent" />
  135. <Setter Property="Background" Value="Transparent" />
  136. <Setter Property="Template">
  137. <Setter.Value>
  138. <ControlTemplate TargetType="{x:Type control:ToolButton}">
  139. <Border
  140. Background="{TemplateBinding Background}"
  141. BorderBrush="{TemplateBinding BorderBrush}"
  142. BorderThickness="1"
  143. CornerRadius="1">
  144. <ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
  145. </Border>
  146. <ControlTemplate.Triggers>
  147. <Trigger Property="IsMouseOver" Value="True">
  148. <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
  149. <Setter Property="Background" Value="{StaticResource ToolButtonHoverBackground}" />
  150. </Trigger>
  151. <Trigger Property="IsChecked" Value="True">
  152. <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
  153. <Setter Property="Background" Value="{StaticResource ToolButtonHoverBackground}" />
  154. </Trigger>
  155. </ControlTemplate.Triggers>
  156. </ControlTemplate>
  157. </Setter.Value>
  158. </Setter>
  159. </Style>
  160. <!-- 工具按钮 -->
  161. <Style
  162. x:Key="ToolButton"
  163. BasedOn="{StaticResource BaseButton}"
  164. TargetType="{x:Type control:ToolButton}">
  165. <Setter Property="Margin" Value="3" />
  166. <Setter Property="Width" Value="24" />
  167. <Setter Property="Height" Value="19" />
  168. <Setter Property="IsImageEditBar" Value="True" />
  169. <Setter Property="GroupName" Value="Tools" />
  170. </Style>
  171. <!-- 尺寸按钮 -->
  172. <Style
  173. x:Key="SizeButton"
  174. BasedOn="{StaticResource BaseButton}"
  175. TargetType="{x:Type control:ToolButton}">
  176. <Setter Property="Margin" Value="1,5" />
  177. <Setter Property="Width" Value="24" />
  178. <Setter Property="Height" Value="25" />
  179. </Style>
  180. <!-- 颜色按钮 -->
  181. <Style x:Key="ColorButton" TargetType="{x:Type control:ToolButton}">
  182. <Setter Property="Width" Value="16" />
  183. <Setter Property="Height" Value="16" />
  184. <Setter Property="BorderBrush" Value="Transparent" />
  185. <Setter Property="Template">
  186. <Setter.Value>
  187. <ControlTemplate TargetType="{x:Type control:ToolButton}">
  188. <Border
  189. Background="{TemplateBinding Background}"
  190. BorderBrush="{TemplateBinding BorderBrush}"
  191. BorderThickness="1"
  192. CornerRadius="1">
  193. <ContentControl
  194. HorizontalAlignment="Stretch"
  195. VerticalAlignment="Stretch"
  196. Content="{TemplateBinding Content}"
  197. ContentTemplate="{TemplateBinding ContentTemplate}" />
  198. </Border>
  199. <ControlTemplate.Triggers>
  200. <Trigger Property="IsMouseOver" Value="True">
  201. <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
  202. <Setter Property="Background" Value="White" />
  203. </Trigger>
  204. <Trigger Property="IsChecked" Value="True">
  205. <Setter Property="BorderBrush" Value="{StaticResource ToolButtonBorder}" />
  206. <Setter Property="Background" Value="White" />
  207. </Trigger>
  208. </ControlTemplate.Triggers>
  209. </ControlTemplate>
  210. </Setter.Value>
  211. </Setter>
  212. </Style>
  213. <!-- 工具栏 -->
  214. <Style TargetType="{x:Type control:ImageEditBar}">
  215. <Setter Property="Width" Value="270" />
  216. <Setter Property="Height" Value="25" />
  217. <Setter Property="Visibility" Value="Collapsed" />
  218. <Setter Property="Background" Value="{StaticResource StackPanelColor}" />
  219. <Setter Property="Cursor" Value="Arrow" />
  220. <Setter Property="Canvas.Left" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasLeft}" />
  221. <Setter Property="Canvas.Top" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasTop}" />
  222. <Setter Property="Template">
  223. <Setter.Value>
  224. <ControlTemplate TargetType="{x:Type control:ImageEditBar}">
  225. <StackPanel
  226. Width="60"
  227. Height="{TemplateBinding Height}"
  228. HorizontalAlignment="Right"
  229. Background="{TemplateBinding Background}"
  230. Orientation="Horizontal">
  231. <!--<control:ToolButton Tool="Rectangle" ToolTip="矩形工具" Style="{StaticResource ToolButton}">
  232. <Rectangle Width="17" Height="14" Stroke="{StaticResource ToolColor}" StrokeThickness="2" Fill="White" />
  233. </control:ToolButton>
  234. <control:ToolButton Tool="Ellipse" ToolTip="椭圆工具" Style="{StaticResource ToolButton}">
  235. <Ellipse Width="17" Height="14" Stroke="{StaticResource ToolColor}" StrokeThickness="2" Fill="White" />
  236. </control:ToolButton>
  237. <control:ToolButton Tool="Arrow" ToolTip="箭头工具" Style="{StaticResource ToolButton}">
  238. <Image Width="18" Height="15" Source="/ComeCapture;component/Resources/箭头.png" />
  239. </control:ToolButton>
  240. <control:ToolButton Tool="Line" ToolTip="画刷工具" Style="{StaticResource ToolButton}">
  241. <Image Width="18" Height="15" Source="/ComeCapture;component/Resources/笔刷.png" />
  242. </control:ToolButton>
  243. <control:ToolButton Tool="Text" ToolTip="文字工具" Style="{StaticResource ToolButton}">
  244. <TextBlock Text="A" FontSize="19" TextAlignment="Center" Margin="0,-4,0,0" FontWeight="Bold" Foreground="{StaticResource ToolColor}" />
  245. </control:ToolButton>
  246. <control:ToolButton Tool="Revoke" ToolTip="撤销编辑" Style="{StaticResource ToolButton}">
  247. <Image Margin="0,-1,0,1" Width="18" Height="15" Source="/ComeCapture;component/Resources/后退.png" />
  248. </control:ToolButton>
  249. <control:ToolButton Tool="Save" ToolTip="保存" Style="{StaticResource ToolButton}">
  250. <Image Margin="0,1,0,-1" Width="18" Height="15" Source="/ComeCapture;component/Resources/保存.png" />
  251. </control:ToolButton>-->
  252. <control:ToolButton Cursor="Hand"
  253. Style="{StaticResource ToolButton}"
  254. Tool="Cancel"
  255. ToolTip="退出截图">
  256. <Grid Width="17" Height="14">
  257. <Path
  258. Data="M 4,2 L 15,13"
  259. Stroke="Red"
  260. StrokeThickness="4" />
  261. <Path
  262. Data="M 4,13 L 15,2"
  263. Stroke="Red"
  264. StrokeThickness="4" />
  265. </Grid>
  266. </control:ToolButton>
  267. <control:ToolButton Cursor="Hand"
  268. Style="{StaticResource ToolButton}"
  269. Tool="OK"
  270. ToolTip="完成截图">
  271. <Grid Width="17" Height="14">
  272. <Path
  273. Data="M 2,7 L 7,12 L 16,2"
  274. Stroke="Green"
  275. StrokeThickness="4" />
  276. </Grid>
  277. </control:ToolButton>
  278. </StackPanel>
  279. </ControlTemplate>
  280. </Setter.Value>
  281. </Setter>
  282. </Style>
  283. <!-- 尺寸颜色栏基础样式 -->
  284. <Style x:Key="BaseSizeColor" TargetType="{x:Type StackPanel}">
  285. <Setter Property="Width" Value="270" />
  286. <Setter Property="Height" Value="35" />
  287. <Setter Property="Orientation" Value="Horizontal" />
  288. <Setter Property="Visibility" Value="Collapsed" />
  289. <Setter Property="Background" Value="{StaticResource StackPanelColor}" />
  290. </Style>
  291. <!-- 颜色板Item -->
  292. <Style x:Key="ColorBoxItem" TargetType="{x:Type ListBoxItem}">
  293. <Setter Property="Template">
  294. <Setter.Value>
  295. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  296. <ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
  297. </ControlTemplate>
  298. </Setter.Value>
  299. </Setter>
  300. </Style>
  301. <!-- 颜色板 -->
  302. <Style x:Key="ColorBarStyle" TargetType="{x:Type ListBox}">
  303. <Setter Property="BorderThickness" Value="0" />
  304. <Setter Property="Background" Value="Transparent" />
  305. <Setter Property="ItemsSource" Value="{x:Static control:SizeColorBar.ColorBars}" />
  306. <Setter Property="ItemContainerStyle" Value="{StaticResource ColorBoxItem}" />
  307. <Setter Property="ItemsPanel">
  308. <Setter.Value>
  309. <ItemsPanelTemplate>
  310. <UniformGrid
  311. Height="32"
  312. Columns="9"
  313. Rows="2" />
  314. </ItemsPanelTemplate>
  315. </Setter.Value>
  316. </Setter>
  317. </Style>
  318. <!-- 尺寸颜色栏 -->
  319. <Style TargetType="{x:Type control:SizeColorBar}">
  320. <Setter Property="Canvas.Left" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasLeft}" />
  321. <Setter Property="Canvas.Top" Value="{Binding RelativeSource={RelativeSource Self}, Path=CanvasTop}" />
  322. <Setter Property="Template">
  323. <Setter.Value>
  324. <ControlTemplate TargetType="{x:Type control:SizeColorBar}">
  325. <Grid>
  326. <control:RectangleTool
  327. x:Name="PART_RectangleTool"
  328. Style="{StaticResource BaseSizeColor}"
  329. Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Rectangle}">
  330. <control:ToolButton
  331. GroupName="RectangleTool"
  332. IsChecked="{Binding ElementName=PART_RectangleTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
  333. Style="{StaticResource SizeButton}">
  334. <Ellipse
  335. Width="{StaticResource Small}"
  336. Height="{StaticResource Small}"
  337. Fill="{StaticResource ToolColor}" />
  338. </control:ToolButton>
  339. <control:ToolButton
  340. GroupName="RectangleTool"
  341. IsChecked="{Binding ElementName=PART_RectangleTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
  342. Style="{StaticResource SizeButton}">
  343. <Ellipse
  344. Width="{StaticResource Medium}"
  345. Height="{StaticResource Medium}"
  346. Fill="{StaticResource ToolColor}" />
  347. </control:ToolButton>
  348. <control:ToolButton
  349. GroupName="RectangleTool"
  350. IsChecked="{Binding ElementName=PART_RectangleTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
  351. Style="{StaticResource SizeButton}">
  352. <Ellipse
  353. Width="{StaticResource Large}"
  354. Height="{StaticResource Large}"
  355. Fill="{StaticResource ToolColor}" />
  356. </control:ToolButton>
  357. <Grid
  358. Width="29"
  359. Height="29"
  360. Margin="5,0,5,0"
  361. Background="White">
  362. <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
  363. <Canvas
  364. Width="25"
  365. Height="25"
  366. Background="{Binding ElementName=PART_RectangleTool, Path=LineBrush}" />
  367. </Border>
  368. </Grid>
  369. <ListBox Style="{StaticResource ColorBarStyle}">
  370. <ListBox.ItemTemplate>
  371. <DataTemplate>
  372. <control:ToolButton
  373. GroupName="RectangleColor"
  374. LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
  375. Style="{StaticResource ColorButton}">
  376. <Rectangle
  377. Width="12"
  378. Height="12"
  379. Fill="{Binding}"
  380. Stroke="{StaticResource ToolButtonBorder}"
  381. StrokeThickness="1" />
  382. </control:ToolButton>
  383. </DataTemplate>
  384. </ListBox.ItemTemplate>
  385. </ListBox>
  386. </control:RectangleTool>
  387. <control:EllipseTool
  388. x:Name="PART_EllipseTool"
  389. Style="{StaticResource BaseSizeColor}"
  390. Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Ellipse}">
  391. <control:ToolButton
  392. GroupName="EllipseTool"
  393. IsChecked="{Binding ElementName=PART_EllipseTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
  394. Style="{StaticResource SizeButton}">
  395. <Ellipse
  396. Width="{StaticResource Small}"
  397. Height="{StaticResource Small}"
  398. Fill="{StaticResource ToolColor}" />
  399. </control:ToolButton>
  400. <control:ToolButton
  401. GroupName="EllipseTool"
  402. IsChecked="{Binding ElementName=PART_EllipseTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
  403. Style="{StaticResource SizeButton}">
  404. <Ellipse
  405. Width="{StaticResource Medium}"
  406. Height="{StaticResource Medium}"
  407. Fill="{StaticResource ToolColor}" />
  408. </control:ToolButton>
  409. <control:ToolButton
  410. GroupName="EllipseTool"
  411. IsChecked="{Binding ElementName=PART_EllipseTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
  412. Style="{StaticResource SizeButton}">
  413. <Ellipse
  414. Width="{StaticResource Large}"
  415. Height="{StaticResource Large}"
  416. Fill="{StaticResource ToolColor}" />
  417. </control:ToolButton>
  418. <Grid
  419. Width="29"
  420. Height="29"
  421. Margin="5,0"
  422. Background="White">
  423. <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
  424. <Canvas
  425. Width="25"
  426. Height="25"
  427. Background="{Binding ElementName=PART_EllipseTool, Path=LineBrush}" />
  428. </Border>
  429. </Grid>
  430. <ListBox Style="{StaticResource ColorBarStyle}">
  431. <ListBox.ItemTemplate>
  432. <DataTemplate>
  433. <control:ToolButton
  434. GroupName="EllipseColor"
  435. LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
  436. Style="{StaticResource ColorButton}">
  437. <Rectangle
  438. Width="12"
  439. Height="12"
  440. Fill="{Binding}"
  441. Stroke="{StaticResource ToolButtonBorder}"
  442. StrokeThickness="1" />
  443. </control:ToolButton>
  444. </DataTemplate>
  445. </ListBox.ItemTemplate>
  446. </ListBox>
  447. </control:EllipseTool>
  448. <control:ArrowTool
  449. x:Name="PART_ArrowTool"
  450. Style="{StaticResource BaseSizeColor}"
  451. Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Arrow}">
  452. <control:ToolButton
  453. GroupName="ArrowTool"
  454. IsChecked="{Binding ElementName=PART_ArrowTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
  455. Style="{StaticResource SizeButton}">
  456. <Ellipse
  457. Width="{StaticResource Small}"
  458. Height="{StaticResource Small}"
  459. Fill="{StaticResource ToolColor}" />
  460. </control:ToolButton>
  461. <control:ToolButton
  462. GroupName="ArrowTool"
  463. IsChecked="{Binding ElementName=PART_ArrowTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
  464. Style="{StaticResource SizeButton}">
  465. <Ellipse
  466. Width="{StaticResource Medium}"
  467. Height="{StaticResource Medium}"
  468. Fill="{StaticResource ToolColor}" />
  469. </control:ToolButton>
  470. <control:ToolButton
  471. GroupName="ArrowTool"
  472. IsChecked="{Binding ElementName=PART_ArrowTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
  473. Style="{StaticResource SizeButton}">
  474. <Ellipse
  475. Width="{StaticResource Large}"
  476. Height="{StaticResource Large}"
  477. Fill="{StaticResource ToolColor}" />
  478. </control:ToolButton>
  479. <Grid
  480. Width="29"
  481. Height="29"
  482. Margin="5,0"
  483. Background="White">
  484. <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
  485. <Canvas
  486. Width="25"
  487. Height="25"
  488. Background="{Binding ElementName=PART_ArrowTool, Path=LineBrush}" />
  489. </Border>
  490. </Grid>
  491. <ListBox Style="{StaticResource ColorBarStyle}">
  492. <ListBox.ItemTemplate>
  493. <DataTemplate>
  494. <control:ToolButton
  495. GroupName="ArrowColor"
  496. LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
  497. Style="{StaticResource ColorButton}">
  498. <Rectangle
  499. Width="12"
  500. Height="12"
  501. Fill="{Binding}"
  502. Stroke="{StaticResource ToolButtonBorder}"
  503. StrokeThickness="1" />
  504. </control:ToolButton>
  505. </DataTemplate>
  506. </ListBox.ItemTemplate>
  507. </ListBox>
  508. </control:ArrowTool>
  509. <control:LineTool
  510. x:Name="PART_LineTool"
  511. Style="{StaticResource BaseSizeColor}"
  512. Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Line}">
  513. <control:ToolButton
  514. GroupName="LineTool"
  515. IsChecked="{Binding ElementName=PART_LineTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Small}}"
  516. Style="{StaticResource SizeButton}">
  517. <Ellipse
  518. Width="{StaticResource Small}"
  519. Height="{StaticResource Small}"
  520. Fill="{StaticResource ToolColor}" />
  521. </control:ToolButton>
  522. <control:ToolButton
  523. GroupName="LineTool"
  524. IsChecked="{Binding ElementName=PART_LineTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Medium}}"
  525. Style="{StaticResource SizeButton}">
  526. <Ellipse
  527. Width="{StaticResource Medium}"
  528. Height="{StaticResource Medium}"
  529. Fill="{StaticResource ToolColor}" />
  530. </control:ToolButton>
  531. <control:ToolButton
  532. GroupName="LineTool"
  533. IsChecked="{Binding ElementName=PART_LineTool, Path=LineThickness, Converter={StaticResource SizeConverter}, ConverterParameter={StaticResource Large}}"
  534. Style="{StaticResource SizeButton}">
  535. <Ellipse
  536. Width="{StaticResource Large}"
  537. Height="{StaticResource Large}"
  538. Fill="{StaticResource ToolColor}" />
  539. </control:ToolButton>
  540. <Grid
  541. Width="29"
  542. Height="29"
  543. Margin="5,0"
  544. Background="White">
  545. <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
  546. <Canvas
  547. Width="25"
  548. Height="25"
  549. Background="{Binding ElementName=PART_LineTool, Path=LineBrush}" />
  550. </Border>
  551. </Grid>
  552. <ListBox Style="{StaticResource ColorBarStyle}">
  553. <ListBox.ItemTemplate>
  554. <DataTemplate>
  555. <control:ToolButton
  556. GroupName="LineColor"
  557. LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
  558. Style="{StaticResource ColorButton}">
  559. <Rectangle
  560. Width="12"
  561. Height="12"
  562. Fill="{Binding}"
  563. Stroke="{StaticResource ToolButtonBorder}"
  564. StrokeThickness="1" />
  565. </control:ToolButton>
  566. </DataTemplate>
  567. </ListBox.ItemTemplate>
  568. </ListBox>
  569. </control:LineTool>
  570. <control:TextTool
  571. x:Name="PART_TextTool"
  572. Style="{StaticResource BaseSizeColor}"
  573. Visibility="{Binding RelativeSource={RelativeSource AncestorType=control:SizeColorBar}, Path=Selected, Converter={StaticResource ToolConverter}, ConverterParameter=Text}">
  574. <TextBlock
  575. Width="24"
  576. Height="30"
  577. Margin="3,2"
  578. FontSize="23"
  579. FontWeight="Bold"
  580. Foreground="{StaticResource ToolColor}"
  581. Text="A"
  582. TextAlignment="Center" />
  583. <ComboBox
  584. Width="42"
  585. Height="21"
  586. Margin="0,7,6,7"
  587. DisplayMemberPath="Key"
  588. ItemsSource="{x:Static control:TextTool.FontSizes}"
  589. SelectedItem="12"
  590. SelectedValue="{Binding ElementName=PART_TextTool, Path=FontSize}"
  591. SelectedValuePath="Key"
  592. Style="{x:Null}" />
  593. <Grid
  594. Width="29"
  595. Height="29"
  596. Margin="5,0"
  597. Background="White">
  598. <Border BorderBrush="{StaticResource ToolButtonBorder}" BorderThickness="1">
  599. <Canvas
  600. Width="25"
  601. Height="25"
  602. Background="{Binding ElementName=PART_TextTool, Path=LineBrush}" />
  603. </Border>
  604. </Grid>
  605. <ListBox Style="{StaticResource ColorBarStyle}">
  606. <ListBox.ItemTemplate>
  607. <DataTemplate>
  608. <control:ToolButton
  609. GroupName="TextColor"
  610. LineColor="{Binding ., Converter={StaticResource ColorConverter}}"
  611. Style="{StaticResource ColorButton}">
  612. <Rectangle
  613. Width="12"
  614. Height="12"
  615. Fill="{Binding}"
  616. Stroke="{StaticResource ToolButtonBorder}"
  617. StrokeThickness="1" />
  618. </control:ToolButton>
  619. </DataTemplate>
  620. </ListBox.ItemTemplate>
  621. </ListBox>
  622. </control:TextTool>
  623. </Grid>
  624. </ControlTemplate>
  625. </Setter.Value>
  626. </Setter>
  627. </Style>
  628. <!-- 文字输入框 -->
  629. <Style TargetType="{x:Type control:TextBoxControl}">
  630. <Setter Property="Template">
  631. <Setter.Value>
  632. <ControlTemplate TargetType="{x:Type control:TextBoxControl}">
  633. <Grid FocusManager.FocusedElement="{Binding ElementName=PART_TextBox}">
  634. <Border
  635. Width="{Binding ElementName=PART_TextBox, Path=Width}"
  636. Height="{Binding ElementName=PART_TextBox, Path=Height}"
  637. BorderThickness="3">
  638. <Border.BorderBrush>
  639. <LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat" StartPoint="0,5" EndPoint="5,0">
  640. <LinearGradientBrush.GradientStops>
  641. <GradientStop Offset="0" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
  642. <GradientStop Offset="0.2" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
  643. <GradientStop Offset="0.4" Color="Transparent" />
  644. <GradientStop Offset="0.6" Color="Transparent" />
  645. <GradientStop Offset="0.8" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
  646. <GradientStop Offset="1" Color="{Binding RelativeSource={RelativeSource AncestorType=control:TextBoxControl}, Path=BorderColor}" />
  647. </LinearGradientBrush.GradientStops>
  648. </LinearGradientBrush>
  649. </Border.BorderBrush>
  650. <TextBox
  651. Name="PART_TextBox"
  652. MinWidth="30"
  653. AcceptsReturn="True"
  654. Background="Transparent"
  655. BorderThickness="0"
  656. FontSize="{TemplateBinding FontSize}"
  657. Foreground="{TemplateBinding Foreground}"
  658. TextWrapping="Wrap" />
  659. </Border>
  660. </Grid>
  661. <ControlTemplate.Triggers>
  662. <Trigger Property="IsMouseOver" Value="True">
  663. <Setter Property="BorderColor" Value="Blue" />
  664. </Trigger>
  665. <Trigger Property="MyFocus" Value="True">
  666. <Setter Property="BorderColor" Value="Blue" />
  667. </Trigger>
  668. </ControlTemplate.Triggers>
  669. </ControlTemplate>
  670. </Setter.Value>
  671. </Setter>
  672. </Style>
  673. </ResourceDictionary>