3030using WinBrush = System . Windows . Media . Brush ;
3131using Button = System . Windows . Controls . Button ;
3232using MessageBox = System . Windows . MessageBox ;
33- using Image = System . Drawing . Image ;
34- using Brushes = System . Drawing . Brushes ;
33+ using SystemDrawingImage = System . Drawing . Image ; // 重命名 System.Drawing.Image
34+ using SystemDrawingBrushes = System . Drawing . Brushes ; // 重命名 System.Drawing.Brushes
35+ using WpfImage = System . Windows . Controls . Image ;
36+ using Binding = System . Windows . Data . Binding ; // 为 WPF Image 添加别名
3537
3638namespace ShowWrite
3739{
@@ -890,12 +892,12 @@ private DataTemplate CreatePhotoListItemTemplate()
890892 stackPanelFactory . SetValue ( StackPanel . OrientationProperty , System . Windows . Controls . Orientation . Horizontal ) ;
891893 stackPanelFactory . SetValue ( StackPanel . MarginProperty , new Thickness ( 6 ) ) ;
892894
893- // 创建缩略图
894- var imageFactory = new FrameworkElementFactory ( typeof ( Image ) ) ;
895- imageFactory . SetValue ( Image . WidthProperty , 70.0 ) ;
896- imageFactory . SetValue ( Image . HeightProperty , 52.0 ) ;
897- imageFactory . SetBinding ( Image . SourceProperty , new System . Windows . Data . Binding ( "Thumbnail" ) ) ;
898- imageFactory . SetValue ( Image . StretchProperty , Stretch . UniformToFill ) ;
895+ // 创建缩略图 - 使用 WpfImage 别名
896+ var imageFactory = new FrameworkElementFactory ( typeof ( WpfImage ) ) ;
897+ imageFactory . SetValue ( WpfImage . WidthProperty , 70.0 ) ;
898+ imageFactory . SetValue ( WpfImage . HeightProperty , 52.0 ) ;
899+ imageFactory . SetBinding ( WpfImage . SourceProperty , new System . Windows . Data . Binding ( "Thumbnail" ) ) ;
900+ imageFactory . SetValue ( WpfImage . StretchProperty , Stretch . UniformToFill ) ;
899901
900902 // 创建右侧信息面板
901903 var infoPanelFactory = new FrameworkElementFactory ( typeof ( StackPanel ) ) ;
@@ -904,30 +906,30 @@ private DataTemplate CreatePhotoListItemTemplate()
904906
905907 // 时间戳
906908 var timestampFactory = new FrameworkElementFactory ( typeof ( TextBlock ) ) ;
907- timestampFactory . SetValue ( TextBlock . ForegroundProperty , Brushes . White ) ;
909+ timestampFactory . SetValue ( TextBlock . ForegroundProperty , System . Windows . Media . Brushes . White ) ; // 使用 WPF Brushes
908910 timestampFactory . SetValue ( TextBlock . FontWeightProperty , FontWeights . Bold ) ;
909911 timestampFactory . SetBinding ( TextBlock . TextProperty , new System . Windows . Data . Binding ( "Timestamp" ) ) ;
910912
911913 // 笔迹数
912914 var strokesFactory = new FrameworkElementFactory ( typeof ( TextBlock ) ) ;
913- strokesFactory . SetValue ( TextBlock . ForegroundProperty , Brushes . LightGray ) ;
915+ strokesFactory . SetValue ( TextBlock . ForegroundProperty , System . Windows . Media . Brushes . LightGray ) ; // 使用 WPF Brushes
914916 strokesFactory . SetValue ( TextBlock . FontSizeProperty , 12.0 ) ;
915- strokesFactory . SetBinding ( TextBlock . TextProperty , new System . Windows . Data . Binding ( "Strokes.Count" )
917+ strokesFactory . SetBinding ( TextBlock . TextProperty , new Binding ( "Strokes.Count" )
916918 {
917919 StringFormat = "笔迹数: {0}"
918920 } ) ;
919921
920922 // 选中状态提示文字
921923 var selectedTipFactory = new FrameworkElementFactory ( typeof ( TextBlock ) ) ;
922- selectedTipFactory . SetValue ( TextBlock . ForegroundProperty , Brushes . Yellow ) ;
924+ selectedTipFactory . SetValue ( TextBlock . ForegroundProperty , System . Windows . Media . Brushes . Yellow ) ; // 使用 WPF Brushes
923925 selectedTipFactory . SetValue ( TextBlock . FontSizeProperty , 11.0 ) ;
924926 selectedTipFactory . SetValue ( TextBlock . FontWeightProperty , FontWeights . SemiBold ) ;
925927 selectedTipFactory . SetValue ( TextBlock . MarginProperty , new Thickness ( 0 , 5 , 0 , 0 ) ) ;
926928
927929 // 使用多重绑定和值转换器来确定是否显示提示文字
928930 var multiBinding = new MultiBinding ( ) ;
929- multiBinding . Bindings . Add ( new System . Windows . Data . Binding ( "." ) ) ; // 当前项
930- multiBinding . Bindings . Add ( new System . Windows . Data . Binding ( "CurrentPhoto" ) { Source = this } ) ;
931+ multiBinding . Bindings . Add ( new Binding ( "." ) ) ; // 当前项
932+ multiBinding . Bindings . Add ( new Binding ( "CurrentPhoto" ) { Source = this } ) ;
931933 multiBinding . Converter = new PhotoSelectedTipConverter ( ) ;
932934
933935 selectedTipFactory . SetBinding ( TextBlock . TextProperty , multiBinding ) ;
@@ -945,32 +947,6 @@ private DataTemplate CreatePhotoListItemTemplate()
945947 return dataTemplate ;
946948 }
947949
948- /// <summary>
949- /// 照片选择状态提示转换器
950- /// </summary>
951- public class PhotoSelectedTipConverter : IMultiValueConverter
952- {
953- public object Convert ( object [ ] values , Type targetType , object parameter , System . Globalization . CultureInfo culture )
954- {
955- if ( values . Length >= 2 )
956- {
957- var currentItem = values [ 0 ] as PhotoWithStrokes ;
958- var currentPhoto = values [ 1 ] as PhotoWithStrokes ;
959-
960- if ( currentItem != null && currentPhoto != null && currentItem == currentPhoto )
961- {
962- return "再次点击返回直播" ;
963- }
964- }
965- return string . Empty ;
966- }
967-
968- public object [ ] ConvertBack ( object value , Type [ ] targetTypes , object parameter , System . Globalization . CultureInfo culture )
969- {
970- throw new NotImplementedException ( ) ;
971- }
972- }
973-
974950 /// <summary>
975951 /// 照片列表选择变更事件 - 修改版:支持点击已选中项返回直播
976952 /// </summary>
@@ -1072,7 +1048,7 @@ private void BackToLive_Click(object sender, RoutedEventArgs e)
10721048
10731049 #endregion
10741050
1075- private void VideoArea_MouseMove ( object sender , WinMouseEventArgs e )
1051+ private void VideoArea_MouseMove ( object sender , System . Windows . Input . MouseEventArgs e )
10761052 {
10771053 if ( _isPerspectiveCorrectionMode ) return ;
10781054 _panZoomManager . HandleMouseMove ( e , _drawingManager . CurrentMode ) ;
@@ -1133,70 +1109,6 @@ private void VideoArea_ManipulationDelta(object sender, ManipulationDeltaEventAr
11331109
11341110 #endregion
11351111
1136- #region 照片悬浮窗定位方法
1137-
1138- /// <summary>
1139- /// 照片悬浮窗打开事件
1140- /// </summary>
1141- private void PhotoPopup_Opened ( object sender , EventArgs e )
1142- {
1143- RepositionPhotoPopup ( ) ;
1144- }
1145-
1146- /// <summary>
1147- /// 重新定位照片悬浮窗到右下角
1148- /// </summary>
1149- private void RepositionPhotoPopup ( )
1150- {
1151- try
1152- {
1153- if ( PhotoPopup == null || ! PhotoPopup . IsOpen ) return ;
1154-
1155- // 获取屏幕工作区尺寸
1156- double screenWidth = SystemParameters . WorkArea . Width ;
1157- double screenHeight = SystemParameters . WorkArea . Height ;
1158-
1159- // 获取窗口位置和尺寸
1160- double windowLeft = this . Left ;
1161- double windowTop = this . Top ;
1162- double windowWidth = this . ActualWidth ;
1163- double windowHeight = this . ActualHeight ;
1164-
1165- // 如果窗口是最大化的,使用窗口的尺寸而不是屏幕尺寸
1166- if ( this . WindowState == WindowState . Maximized )
1167- {
1168- windowLeft = 0 ;
1169- windowTop = 0 ;
1170- windowWidth = SystemParameters . PrimaryScreenWidth ;
1171- windowHeight = SystemParameters . PrimaryScreenHeight ;
1172- }
1173-
1174- // Popup尺寸
1175- double popupWidth = 400 ; // 与XAML中Border的Width一致
1176- double popupHeight = 500 ; // 与XAML中Border的Height一致
1177-
1178- // 计算右下角位置
1179- double left = windowLeft + windowWidth - popupWidth - 10 ; // 右侧留10像素边距
1180- double top = windowTop + windowHeight - popupHeight - 70 - 10 ; // 底部留10像素边距,减去70像素的工具栏高度
1181-
1182- // 确保不会超出屏幕边界
1183- if ( top < 0 ) top = 10 ;
1184- if ( left < 0 ) left = 10 ;
1185-
1186- // 设置Popup位置
1187- PhotoPopup . HorizontalOffset = left ;
1188- PhotoPopup . VerticalOffset = top ;
1189-
1190- Logger . Debug ( "MainWindow" , $ "照片悬浮窗位置已更新: ({ left } , { top } )") ;
1191- }
1192- catch ( Exception ex )
1193- {
1194- Logger . Error ( "MainWindow" , $ "重新定位照片悬浮窗失败: { ex . Message } ", ex ) ;
1195- }
1196- }
1197-
1198- #endregion
1199-
12001112 #region 梯形校正功能模块
12011113
12021114 // ==================== 梯形校正核心功能 ====================
@@ -1683,7 +1595,7 @@ private void CorrectionCanvas_MouseDown(object sender, MouseButtonEventArgs e)
16831595 /// <summary>
16841596 /// 校正画布鼠标移动事件(修复版)
16851597 /// </summary>
1686- private void CorrectionCanvas_MouseMove ( object sender , WinMouseEventArgs e )
1598+ private void CorrectionCanvas_MouseMove ( object sender , System . Windows . Input . MouseEventArgs e )
16871599 {
16881600 try
16891601 {
0 commit comments