2016/11/24

同梱スキン - 落書き.xaml


全画面スキンテスト
ブログの画像作成用に適当に作ったスキン
全画面スキンはちょっとした設定ミスでPC操作が効かなくなるため十分注意すること
スキン作成者向けオプション-デスクトップにzeKeyツールを表示する
にチェックを入れておくことを推奨
入れ忘れて操作不能になった場合 すべてキーボード操作で[Ctrl]+[Alt]+[Del]でタスクマネージャを起動しzeKeyを終了する



  1. <!-- zeKey skinfile https://ze-key.blogspot.jp/ -->
  2. <!-- 改造する場合は慎重にお願いします 全面にかぶさるためPC操作が出来なくなってしまうことがあります -->
  3. <z:Keyboard xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:z="clr-namespace:zeKey.Skin;assembly=zeKey"
  6. Width="{Binding Display.Width,
  7. FallbackValue=300}"
  8. Height="{Binding Display.Height,
  9. FallbackValue=200}"
  10. Left="0"
  11. Top="0">
  12. <z:Keyboard.SkinInfo>
  13. <z:SkinInfo Title="落書き InkCanvasテスト"
  14. Author="T.Naga"
  15. License="改変自由"
  16. Version="0.1.0">
  17. <z:SkinInfo.Information>
  18. <StackPanel>
  19. <TextBlock TextWrapping="Wrap">
  20. ディスプレイ全面が透明なキャンバスになり落書きができます<Run Text="&#10;" />
  21. <LineBreak />
  22. 使い方: 右上にメニューがあります<Run Text="&#10;" />
  23. [落書き]トグルボタンを押しこむと落書きモード<Run Text="&#10;" />
  24. ドロップダウンリストでペン選択<Run Text="&#10;" />
  25. [消去]ボタンで全消去<Run Text="&#10;" />
  26. [終了]ボタンでスキンを閉じる<Run Text="&#10;" />
  27. <LineBreak />
  28. 注意:<Run Text="&#10;" />
  29. ・落書きモード中は他のウィンドウの操作はできません 操作したい時は落書きモードを解除します<Run Text="&#10;" />
  30. ・落書きモード中でなくても色のついた部分は操作できません<Run Text="&#10;" />
  31. ・後から開いたスキンは上にかぶります<Run Text="&#10;" />
  32. ・他に最前面ウィンドウがあると下になる場合があります<Run Text="&#10;" />
  33. <LineBreak />
  34. InkCanvasにはもっといろいろな機能があるんですが コマンドを用意するのが面倒なので全消去機能のみ<Run Text="&#10;" />
  35. ペンはResourcesに追加すればいくらでも増やせます<Run Text="&#10;" />
  36. <LineBreak />
  37. 詳しい説明は
  38. <z:Hyperlink NavigateUri="https://ze-key.blogspot.jp/">ブログ</z:Hyperlink>
  39. を参照してください
  40. </TextBlock>
  41. </StackPanel>
  42. </z:SkinInfo.Information>
  43. </z:SkinInfo>
  44. </z:Keyboard.SkinInfo>
  45. <z:Keyboard.Resources>
  46. <x:Array x:Key="Pens" Type="DrawingAttributes">
  47. <!-- ペン -->
  48. <DrawingAttributes Width="3"
  49. Height="3"
  50. FitToCurve="true"
  51. Color="Black" />
  52. <DrawingAttributes Width="5"
  53. Height="5"
  54. FitToCurve="true"
  55. IsHighlighter="True"
  56. Color="Blue" />
  57. <DrawingAttributes Width="5"
  58. Height="5"
  59. FitToCurve="true"
  60. IsHighlighter="True"
  61. Color="Green" />
  62. <DrawingAttributes Width="5"
  63. Height="5"
  64. FitToCurve="true"
  65. IsHighlighter="True"
  66. Color="Red" />
  67. <DrawingAttributes Width="10"
  68. Height="10"
  69. StylusTip="Rectangle"
  70. Color="White" />
  71. </x:Array>
  72. <DataTemplate DataType="{x:Type DrawingAttributes}">
  73. <Border Height="20">
  74. <Border Width="50" Height="{Binding Path=Height}">
  75. <Border.Background>
  76. <SolidColorBrush Color="{Binding Path=Color}" />
  77. </Border.Background>
  78. </Border>
  79. </Border>
  80. </DataTemplate>
  81. </z:Keyboard.Resources>
  82. <Grid>
  83. <InkCanvas x:Name="Ink"
  84. Cursor="Pen"
  85. DefaultDrawingAttributes="{Binding ElementName=Combo,
  86. Path=SelectedItem}"
  87. UseCustomCursor="True">
  88. <InkCanvas.Style>
  89. <Style TargetType="{x:Type InkCanvas}">
  90. <Setter Property="Background" Value="{x:Null}" />
  91. <Setter Property="IsHitTestVisible" Value="False" />
  92. <Style.Triggers>
  93. <DataTrigger Binding="{Binding ElementName=Toggle, Path=IsChecked}" Value="true">
  94. <Setter Property="Background" Value="#01FFFFFF" />
  95. <Setter Property="IsHitTestVisible" Value="True" />
  96. </DataTrigger>
  97. </Style.Triggers>
  98. </Style>
  99. </InkCanvas.Style>
  100. </InkCanvas>
  101. <StackPanel HorizontalAlignment="Right"
  102. VerticalAlignment="Top"
  103. Orientation="Horizontal">
  104. <StackPanel.Background>
  105. <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" />
  106. </StackPanel.Background>
  107. <ToggleButton x:Name="Toggle"
  108. Margin="5"
  109. Content="落書き"
  110. Focusable="False" />
  111. <ComboBox Name="Combo"
  112. Width="50"
  113. Margin="5"
  114. ItemsSource="{StaticResource Pens}"
  115. SelectedIndex="0" />
  116. <Button Margin="5"
  117. Command="{Binding InkCanvasStrokesClearCommand}"
  118. CommandParameter="{Binding ElementName=Ink}"
  119. Content="消去" />
  120. <Button Margin="5"
  121. Command="{Binding CloseCommand}"
  122. Content="終了" />
  123. </StackPanel>
  124. </Grid>
  125. </z:Keyboard>

0 件のコメント :

コメントを投稿