WatermarkDialog.xaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <Window x:Class="ComPDFKit.Controls.PDFControl.WatermarkDialog"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControl"
  7. xmlns:common="clr-namespace:ComPDFKit.Controls.Common"
  8. mc:Ignorable="d"
  9. Height="612" Width="900"
  10. Loaded="Window_Loaded" x:Name="watermarkDialog"
  11. ShowInTaskbar="False"
  12. ResizeMode="NoResize">
  13. <Window.Resources>
  14. <ResourceDictionary>
  15. <common:SecurityResourceConverter x:Key="SecurityResourceConverter"/>
  16. <common:StringToVisibilityConverter x:Key="StringToVisibilityConverter"></common:StringToVisibilityConverter>
  17. <ResourceDictionary.MergedDictionaries>
  18. <ResourceDictionary Source="../../Asset/Styles/RadioButtonStyle.xaml"></ResourceDictionary>
  19. <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
  20. <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
  21. </ResourceDictionary.MergedDictionaries>
  22. </ResourceDictionary>
  23. </Window.Resources>
  24. <Grid Margin="12">
  25. <Grid.RowDefinitions>
  26. <RowDefinition></RowDefinition>
  27. <RowDefinition Height="auto"></RowDefinition>
  28. </Grid.RowDefinitions>
  29. <Grid.ColumnDefinitions>
  30. <ColumnDefinition Width="auto"></ColumnDefinition>
  31. <ColumnDefinition/>
  32. </Grid.ColumnDefinitions>
  33. <Grid Width="248" Margin="0,0,0,56">
  34. <local:WatermarkPreviewControl x:Name="PreviewControl"></local:WatermarkPreviewControl>
  35. </Grid>
  36. <Grid Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,0,56" Grid.RowSpan="2">
  37. <Grid.RowDefinitions>
  38. <RowDefinition></RowDefinition>
  39. <RowDefinition></RowDefinition>
  40. </Grid.RowDefinitions>
  41. <Grid Height="228">
  42. <Border BorderThickness="1" BorderBrush="#33000000" Margin="32,10,0,0" VerticalAlignment="Stretch" >
  43. <Grid>
  44. <Grid.RowDefinitions>
  45. <RowDefinition></RowDefinition>
  46. <RowDefinition Height="auto"></RowDefinition>
  47. </Grid.RowDefinitions>
  48. <Grid Margin="20,20,0,0">
  49. <Grid.RowDefinitions>
  50. <RowDefinition Height="auto"></RowDefinition>
  51. <RowDefinition Height="auto"></RowDefinition>
  52. <RowDefinition Height="auto"></RowDefinition>
  53. <RowDefinition Height="auto"></RowDefinition>
  54. </Grid.RowDefinitions>
  55. <RadioButton x:Name="TextRdo" IsChecked="True" GroupName="WatermarkType" Checked="TypeRdo_Checked">
  56. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_TextWatermark}"></TextBlock>
  57. </RadioButton>
  58. <TextBox Grid.Row="1" Height="28" Width="438" Text="{Binding WatermarkText, UpdateSourceTrigger=PropertyChanged}" Margin="32,6,0,0" HorizontalAlignment="Left" VerticalContentAlignment="Center" IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}"></TextBox>
  59. <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="32,6,0,0" Height="30">
  60. <ComboBox x:Name="FontFamilyCmb" Style="{StaticResource ComboBoxStyle1}" Width="242" Margin="0,0,20,0" SelectionChanged="FontFamilyCmb_SelectionChanged" IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}">
  61. </ComboBox>
  62. <ComboBox x:Name="FontStyleCmb" Style="{StaticResource ComboBoxStyle1}" Width="90" Margin="0,0,20,0" SelectionChanged="FontStyleCmb_SelectionChanged" IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}"></ComboBox>
  63. <ComboBox x:Name="FontSizeCmb" Style="{StaticResource ComboBoxStyle1}" Width="66" Margin="0,0,20,0" SelectionChanged="FontSizeCmb_SelectionChanged" IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}">
  64. <ComboBoxItem Tag="24" >24</ComboBoxItem>
  65. <ComboBoxItem Tag="48" IsSelected="True">48</ComboBoxItem>
  66. <ComboBoxItem Tag="72" >72</ComboBoxItem>
  67. <ComboBoxItem Tag="96" >96</ComboBoxItem>
  68. <ComboBoxItem Tag="120" >120</ComboBoxItem>
  69. <ComboBoxItem Tag="144" >144</ComboBoxItem>
  70. <ComboBoxItem Tag="168" >168</ComboBoxItem>
  71. <ComboBoxItem Tag="192" >192</ComboBoxItem>
  72. <ComboBoxItem Tag="216" >216</ComboBoxItem>
  73. <ComboBoxItem Tag="240" >240</ComboBoxItem>
  74. <ComboBoxItem Tag="264" >264</ComboBoxItem>
  75. <ComboBoxItem Tag="288" >288</ComboBoxItem>
  76. </ComboBox>
  77. </StackPanel>
  78. <StackPanel Orientation="Horizontal" Grid.Row="3" Margin="32,0,0,0">
  79. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_FontColor}" VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
  80. <common:ColorPickerControl x:Name="ColorPickerControl" ColorChanged="ColorPickerControl_ColorChanged" IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}"></common:ColorPickerControl>
  81. </StackPanel>
  82. </Grid>
  83. <Grid Margin="20,20,0,10" Grid.Row="1">
  84. <Grid.RowDefinitions>
  85. <RowDefinition Height="auto"></RowDefinition>
  86. <RowDefinition Height="auto"></RowDefinition>
  87. </Grid.RowDefinitions>
  88. <RadioButton x:Name="ImageRdo" Grid.Row="0" GroupName="WatermarkType" Checked="TypeRdo_Checked">
  89. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_ImageWatermark}"></TextBlock>
  90. </RadioButton>
  91. <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="32,6,0,0" Height="28">
  92. <Button x:Name="ImagePathBtn" Style="{StaticResource ImagePathButtonStyle}" Width="296" Margin="0,0,20,0" Click="ImagePathBtn_Click" IsEnabled="{Binding Path=IsChecked, ElementName=ImageRdo}">
  93. <Grid Margin="5,0,10,0">
  94. <TextBlock x:Name="PathTxt" Text="{Binding ImagePath}" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Microsoft YaHei"></TextBlock>
  95. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Watermark}" VerticalAlignment="Center" HorizontalAlignment="Left" FontFamily="Microsoft YaHei" Visibility="{Binding ElementName=PathTxt, Path=Text, Converter={StaticResource StringToVisibilityConverter}}"></TextBlock>
  96. <Path VerticalAlignment="Center" HorizontalAlignment="Right" Data="M12.6172,14L15.8906,7.44531C15.9635,7.29948,16,7.14844,16,6.99219C16,6.85677,15.974,6.72917,15.9219,6.60938C15.8698,6.48958,15.7982,6.38411,15.707,6.29297C15.6159,6.20182,15.5091,6.13021,15.3867,6.07812C15.2643,6.02604,15.1354,6,15,6H13V4C13,3.85938,12.974,3.72917,12.9219,3.60938C12.8698,3.48958,12.7982,3.38411,12.707,3.29297C12.6159,3.20182,12.5104,3.13021,12.3906,3.07812C12.2708,3.02604,12.1406,3,12,3H6.25C6.08854,3,5.94661,2.97526,5.82422,2.92578C5.70182,2.8763,5.58724,2.8151,5.48047,2.74219C5.3737,2.66927,5.26823,2.58854,5.16406,2.5C5.0599,2.41146,4.94141,2.33073,4.80859,2.25781C4.67578,2.1849,4.52474,2.1237,4.35547,2.07422C4.1862,2.02474,3.98438,2,3.75,2H1C0.859375,2,0.729167,2.02604,0.609375,2.07812C0.489583,2.13021,0.384115,2.20182,0.292969,2.29297C0.201823,2.38411,0.130208,2.48958,0.078125,2.60938C0.0260417,2.72917,0,2.85938,0,3V14H12.6172ZM1,11.3828V3H3.75C3.91146,3,4.05339,3.02474,4.17578,3.07422C4.29818,3.1237,4.41276,3.1849,4.51953,3.25781C4.6263,3.33073,4.73177,3.41146,4.83594,3.5C4.9401,3.58854,5.05859,3.66927,5.19141,3.74219C5.32422,3.8151,5.47526,3.8763,5.64453,3.92578C5.8138,3.97526,6.01562,4,6.25,4H12V6H4.3125C4.11979,6,3.94401,6.04948,3.78516,6.14844C3.6263,6.2474,3.5026,6.38281,3.41406,6.55469L1,11.3828ZM1.3125,13H12L15,7H4.3125L1.3125,13Z" Fill="Black"/>
  97. </Grid>
  98. </Button>
  99. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Watermark}" VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
  100. <common:NumericUpDownControl x:Name="ScaleNumericControl" Width="80" Text="{Binding ImageScale, Mode=TwoWay}" Maximum="500" Minimum="10" Unit="%" IsEnabled="{Binding Path=IsChecked, ElementName=ImageRdo}"></common:NumericUpDownControl>
  101. </StackPanel>
  102. </Grid>
  103. </Grid>
  104. </Border>
  105. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Title_Watermark}" Margin="50,3,0,0" Background="#fff" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" FontWeight="DemiBold" FontFamily="Microsoft YaHei"></TextBlock>
  106. </Grid>
  107. <Grid Grid.Row="1" Margin="0,20,0,0">
  108. <Border BorderThickness="1" BorderBrush="#33000000" Margin="32,10,0,0" VerticalAlignment="Stretch" >
  109. <Grid Margin="20">
  110. <Grid.ColumnDefinitions>
  111. <ColumnDefinition></ColumnDefinition>
  112. <ColumnDefinition Width="242"></ColumnDefinition>
  113. </Grid.ColumnDefinitions>
  114. <Grid>
  115. <Grid.RowDefinitions>
  116. <RowDefinition></RowDefinition>
  117. <RowDefinition></RowDefinition>
  118. <RowDefinition Height="auto"></RowDefinition>
  119. <RowDefinition></RowDefinition>
  120. </Grid.RowDefinitions>
  121. <Grid.ColumnDefinitions>
  122. <ColumnDefinition Width="auto"></ColumnDefinition>
  123. <ColumnDefinition></ColumnDefinition>
  124. </Grid.ColumnDefinitions>
  125. <TextBlock HorizontalAlignment="Right" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Rotation}" VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
  126. <common:CPDFRotationControl Height="32" Width="186" Grid.Column="1" HorizontalAlignment="Left" RotationChanged="CPDFRotationControl_RotationChanged"></common:CPDFRotationControl>
  127. <TextBlock HorizontalAlignment="Right" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Opacity}" VerticalAlignment="Center" Margin="0,0,8,0" Grid.Row="1"></TextBlock>
  128. <common:CPDFOpacityControl Height="32" Width="200" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="1" OpacityChanged="CPDFOpacityControl_OpacityChanged"></common:CPDFOpacityControl>
  129. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Layout}" HorizontalAlignment="Right" Grid.Row="2" Margin="0,8,8,0"></TextBlock>
  130. <Grid Grid.Row="2" Grid.Column="1" Height="64">
  131. <Grid.RowDefinitions>
  132. <RowDefinition></RowDefinition>
  133. <RowDefinition></RowDefinition>
  134. </Grid.RowDefinitions>
  135. <RadioButton x:Name="FrontRdo" IsChecked="True" Checked="LocationRdo_Checked">
  136. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_Front}"></TextBlock>
  137. </RadioButton>
  138. <RadioButton x:Name="BehindRdo" Grid.Row="1" Checked="LocationRdo_Checked">
  139. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_Behind}"></TextBlock>
  140. </RadioButton>
  141. </Grid>
  142. <TextBlock HorizontalAlignment="Right" Grid.Row="3" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_PageRange}" VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
  143. <common:WritableComboBoxControl IsEnabled="{Binding CanChangeRange}" Height="32" Width="175" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left"></common:WritableComboBoxControl>
  144. </Grid>
  145. <Grid Grid.Column="1" Width="242">
  146. <Grid.RowDefinitions>
  147. <RowDefinition Height="auto"></RowDefinition>
  148. <RowDefinition></RowDefinition>
  149. </Grid.RowDefinitions>
  150. <common:CPDFLocationControl x:Name="CPDFLocationControl" SelectedTagIndex="{Binding ElementName=watermarkDialog, Path=SelectedTag, Mode=TwoWay}" HorizOffsetChanged="CPDFLocationControl_HorizOffsetChanged" VertOffsetChanged="CPDFLocationControl_VertOffsetChanged" HorizontalAlignment="Left" Width="242"></common:CPDFLocationControl>
  151. <common:CPDFTileControl x:Name="CPDFTileControl" Grid.Row="1" Height="72" VerticalAlignment="Bottom" HorizontalSpacingChanged="CPDFTileControl_HorizontalSpacingChanged" VerticalSpacingChanged="CPDFTileControl_VerticalSpacingChanged" FullScreenChanged="CPDFTileControl_FullScreenChanged"></common:CPDFTileControl>
  152. </Grid>
  153. </Grid>
  154. </Border>
  155. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Title_WatermarkSettings}" Margin="50,3,0,0" Background="#fff" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" FontWeight="DemiBold" FontFamily="Microsoft YaHei"></TextBlock>
  156. </Grid>
  157. </Grid>
  158. <Grid Grid.Row="1" Grid.ColumnSpan="3">
  159. <StackPanel Orientation="Horizontal" Margin="0,12,0,12" HorizontalAlignment="Right">
  160. <Button x:Name="ConfirmBtn" Height="32" Width="112" Margin="0,0,12,0" Click="ConfirmBtn_Click">
  161. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Button_OK}"></TextBlock>
  162. </Button>
  163. <Button x:Name="CancelBtn" Height="32" Width="112" Click="CancelBtn_Click">
  164. <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Button_Cancel}"></TextBlock>
  165. </Button>
  166. </StackPanel>
  167. </Grid>
  168. </Grid>
  169. </Window>