|
@@ -42,234 +42,280 @@ namespace PDF_Master.Views.BOTA
|
|
|
|
|
|
private void GridIco_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- Grid grid = e.Source as Grid;
|
|
|
- var args = grid.DataContext as AnnotationHandlerEventArgs;
|
|
|
- AnnotHandlerEventArgs data = args.AnnotHandlerEventArgs;
|
|
|
- TxbMarkupContent.Text = data.MarkupContent;
|
|
|
- TxbContent.Text = data.Content;
|
|
|
- if (data == null)
|
|
|
+ if (e.Source is Grid grid)
|
|
|
{
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- switch (data.EventType)
|
|
|
- {
|
|
|
- case AnnotArgsType.AnnotFreeText:
|
|
|
- BtnAnnotFreeText.Visibility = Visibility.Visible;
|
|
|
- TxbMarkupContent.Foreground = new SolidColorBrush((data as FreeTextAnnotArgs).FontColor);
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotHighlight:
|
|
|
- BtnHighlight.Visibility = Visibility.Visible;
|
|
|
- PathHighlight.Background = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
|
|
|
- //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
|
|
|
- //if (!string.IsNullOrEmpty(TxbMarkupContent.Text))
|
|
|
- //{
|
|
|
- // TxbMarkupContent.Background = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
|
|
|
- //}
|
|
|
-
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotFreehand:
|
|
|
- BtnFreeHand.Visibility = Visibility.Visible;
|
|
|
- PathFreehand.Fill = new SolidColorBrush((data as FreehandAnnotArgs).InkColor);
|
|
|
- ImageContext.Visibility = Visibility.Visible;
|
|
|
-
|
|
|
- TxbMarkupContent.Visibility = Visibility.Collapsed;
|
|
|
-
|
|
|
- SetImageContext(args, data as FreehandAnnotArgs);
|
|
|
-
|
|
|
- //var encoder = new PngBitmapEncoder();
|
|
|
- //encoder.Frames.Add(BitmapFrame.Create((BitmapSource)ImageContext.Source));
|
|
|
- //FileStream file = new FileStream(String.Format($@"C:\Users\oyxh\Desktop\images\PDFText\{data.AnnotIndex}.png"), FileMode.Create);
|
|
|
- //encoder.Save(file);
|
|
|
- //file.Close();
|
|
|
-
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotSquiggly://波浪线
|
|
|
- AnnotSquiggly.Visibility = Visibility.Visible;
|
|
|
- AnnotSquigglycolor.Stroke = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
|
|
|
-
|
|
|
- #region TO DO
|
|
|
-
|
|
|
- //TextDecoration mySquiggly = new TextDecoration();
|
|
|
- //Pen myPen = new Pen();
|
|
|
- //myPen.Brush = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
|
|
|
- //myPen.Brush.Opacity = 0.8;
|
|
|
- //myPen.Thickness = 2;
|
|
|
- //myPen.DashStyle = DashStyles.Dash;
|
|
|
- //mySquiggly.Pen = myPen;
|
|
|
- //mySquiggly.PenThicknessUnit = TextDecorationUnit.FontRecommended;
|
|
|
-
|
|
|
- //TextDecorationCollection myCollection = new TextDecorationCollection();
|
|
|
- //myCollection.Add(mySquiggly);
|
|
|
- //TxbContext.TextDecorations = myCollection;
|
|
|
-
|
|
|
- #endregion TO DO
|
|
|
-
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotStamp:
|
|
|
- BtnAnnotStamp.Visibility = Visibility.Visible;
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotStrikeout://删除线
|
|
|
- BtnAnnotStrikeout.Visibility = Visibility.Visible;
|
|
|
-
|
|
|
- PathStrikeoutyColor.Fill = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
|
|
|
-
|
|
|
- #region to do
|
|
|
-
|
|
|
- //TextDecoration myStrikeout = new TextDecoration();
|
|
|
- //Pen myPen2 = new Pen();
|
|
|
- //myPen2.Brush = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
|
|
|
- //myPen2.Brush.Opacity = 0.8;
|
|
|
- //myPen2.Thickness = 2;
|
|
|
- //myStrikeout.Pen = myPen2;
|
|
|
- //myStrikeout.PenOffset = -4;
|
|
|
- //myStrikeout.PenThicknessUnit = TextDecorationUnit.FontRecommended;
|
|
|
- //TextDecorationCollection myCollection2 = new TextDecorationCollection();
|
|
|
- //myCollection2.Add(myStrikeout);
|
|
|
- ////因为波浪线无法实现 暂时只显示文字 不显示下划线,删除线等
|
|
|
- //TxbMarkupContent.TextDecorations = myCollection2;
|
|
|
-
|
|
|
- #endregion to do
|
|
|
-
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotSticky://便签
|
|
|
- BtnAnnotSticky.Visibility = Visibility;
|
|
|
- PathSticky.Fill = new SolidColorBrush((data as StickyAnnotArgs).Color);
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotUnderline:
|
|
|
- BtnUnderLine.Visibility = Visibility.Visible;
|
|
|
- RectangleUnderline.Fill = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
|
|
|
-
|
|
|
- #region TO DO
|
|
|
-
|
|
|
- //TextDecoration myUnderline = new TextDecoration();
|
|
|
- //Pen myPen1 = new Pen();
|
|
|
- //myPen1.Brush = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
|
|
|
- //myPen1.Brush.Opacity = 0.8;
|
|
|
- //myPen1.Thickness = 2;
|
|
|
- //myUnderline.Pen = myPen1;
|
|
|
- //myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;
|
|
|
- //TextDecorationCollection myCollection1 = new TextDecorationCollection();
|
|
|
- //myCollection1.Add(myUnderline);
|
|
|
- //TxbMarkupContent.TextDecorations = myCollection1;
|
|
|
-
|
|
|
- #endregion TO DO
|
|
|
-
|
|
|
- break;
|
|
|
+ if (grid.DataContext is AnnotationHandlerEventArgs args)
|
|
|
+ {
|
|
|
+ //var args = grid.DataContext as AnnotationHandlerEventArgs;
|
|
|
+ AnnotHandlerEventArgs data = args.AnnotHandlerEventArgs;
|
|
|
|
|
|
- case AnnotArgsType.AnnotLine:
|
|
|
- if ((data as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (data as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
|
|
|
- {
|
|
|
- BtnSharpArrow.Visibility = Visibility.Visible;
|
|
|
- PathArrow.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- PathSharpLine.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
|
|
|
- BtnSharpLine.Visibility = Visibility.Visible;
|
|
|
- }
|
|
|
- ///对于形状注释等只有Note 的处理
|
|
|
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
|
|
|
- {
|
|
|
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
|
|
|
- TxbMarkupContent.Text = "";
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotSquare:
|
|
|
- BtnAnnotSquare.Visibility = Visibility.Visible;
|
|
|
- RectAnnotSquare.Stroke = new SolidColorBrush((data as SquareAnnotArgs).LineColor);
|
|
|
- RectAnnotSquare.Fill = new SolidColorBrush((data as SquareAnnotArgs).BgColor);
|
|
|
- ///对于形状注释等只有Note 的处理
|
|
|
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
|
|
|
+ if (data == null)
|
|
|
{
|
|
|
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
|
|
|
- TxbMarkupContent.Text = "";
|
|
|
+ return;
|
|
|
}
|
|
|
- break;
|
|
|
-
|
|
|
- case AnnotArgsType.AnnotCircle:
|
|
|
- BtnAnnotCircle.Visibility = Visibility.Visible;
|
|
|
- EllipseCircle.Stroke = new SolidColorBrush((data as CircleAnnotArgs).LineColor);
|
|
|
- EllipseCircle.Fill = new SolidColorBrush((data as CircleAnnotArgs).BgColor);
|
|
|
- ///对于形状注释等只有Note 的处理
|
|
|
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
|
|
|
+ TxbMarkupContent.Text = data.MarkupContent;
|
|
|
+ TxbContent.Text = data.Content;
|
|
|
+ switch (data.EventType)
|
|
|
{
|
|
|
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
|
|
|
- TxbMarkupContent.Text = "";
|
|
|
- }
|
|
|
- break;
|
|
|
+ case AnnotArgsType.AnnotFreeText:
|
|
|
+ if (data is FreeTextAnnotArgs freeTextAnnotArgs)
|
|
|
+ {
|
|
|
+ BtnAnnotFreeText.Visibility = Visibility.Visible;
|
|
|
+ TxbMarkupContent.Foreground = new SolidColorBrush(freeTextAnnotArgs.FontColor);
|
|
|
+ }
|
|
|
|
|
|
- case AnnotArgsType.AnnotLink:
|
|
|
- BtnAnnotLink.Visibility = Visibility.Visible;
|
|
|
- if (data is LinkAnnotArgs linkAnnotArgs)
|
|
|
- {
|
|
|
- if (string.IsNullOrEmpty(linkAnnotArgs.Content))
|
|
|
- {
|
|
|
- if (linkAnnotArgs.DestIndex != -1)
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotHighlight:
|
|
|
+ if (data is TextHighlightAnnotArgs textHighlightAnnotArgs)
|
|
|
+ {
|
|
|
+ BtnHighlight.Visibility = Visibility.Visible;
|
|
|
+ PathHighlight.Background = new SolidColorBrush(textHighlightAnnotArgs.Color);
|
|
|
+ //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
|
|
|
+ //if (!string.IsNullOrEmpty(TxbMarkupContent.Text))
|
|
|
+ //{
|
|
|
+ // TxbMarkupContent.Background = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotFreehand:
|
|
|
+ if (data is FreehandAnnotArgs freehandAnnotArgs)
|
|
|
{
|
|
|
- TxbMarkupContent.Text = string.Format($"To Page {linkAnnotArgs.DestIndex + 1}");
|
|
|
+ BtnFreeHand.Visibility = Visibility.Visible;
|
|
|
+ PathFreehand.Fill = new SolidColorBrush(freehandAnnotArgs.InkColor);
|
|
|
+ ImageContext.Visibility = Visibility.Visible;
|
|
|
+
|
|
|
+ TxbMarkupContent.Visibility = Visibility.Collapsed;
|
|
|
+
|
|
|
+ SetImageContext(args, freehandAnnotArgs);
|
|
|
+
|
|
|
+ //var encoder = new PngBitmapEncoder();
|
|
|
+ //encoder.Frames.Add(BitmapFrame.Create((BitmapSource)ImageContext.Source));
|
|
|
+ //FileStream file = new FileStream(String.Format($@"C:\Users\oyxh\Desktop\images\PDFText\{data.AnnotIndex}.png"), FileMode.Create);
|
|
|
+ //encoder.Save(file);
|
|
|
+ //file.Close();
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotSquiggly://波浪线
|
|
|
+ if (data is TextSquigglyAnnotArgs textSquigglyAnnotArgs)
|
|
|
{
|
|
|
- TxbMarkupContent.Text = string.Format($"{linkAnnotArgs.URI}");
|
|
|
+ AnnotSquiggly.Visibility = Visibility.Visible;
|
|
|
+ AnnotSquigglycolor.Stroke = new SolidColorBrush(textSquigglyAnnotArgs.Color);
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- break;
|
|
|
+ #region TO DO
|
|
|
+
|
|
|
+ //TextDecoration mySquiggly = new TextDecoration();
|
|
|
+ //Pen myPen = new Pen();
|
|
|
+ //myPen.Brush = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
|
|
|
+ //myPen.Brush.Opacity = 0.8;
|
|
|
+ //myPen.Thickness = 2;
|
|
|
+ //myPen.DashStyle = DashStyles.Dash;
|
|
|
+ //mySquiggly.Pen = myPen;
|
|
|
+ //mySquiggly.PenThicknessUnit = TextDecorationUnit.FontRecommended;
|
|
|
+
|
|
|
+ //TextDecorationCollection myCollection = new TextDecorationCollection();
|
|
|
+ //myCollection.Add(mySquiggly);
|
|
|
+ //TxbContext.TextDecorations = myCollection;
|
|
|
+
|
|
|
+ #endregion TO DO
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotStamp:
|
|
|
+ BtnAnnotStamp.Visibility = Visibility.Visible;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotStrikeout://删除线
|
|
|
+ if (data is TextStrikeoutAnnotArgs textStrikeoutAnnotArgs)
|
|
|
+ {
|
|
|
+ BtnAnnotStrikeout.Visibility = Visibility.Visible;
|
|
|
+
|
|
|
+ PathStrikeoutyColor.Fill = new SolidColorBrush(textStrikeoutAnnotArgs.Color);
|
|
|
+ }
|
|
|
+
|
|
|
+ #region to do
|
|
|
+
|
|
|
+ //TextDecoration myStrikeout = new TextDecoration();
|
|
|
+ //Pen myPen2 = new Pen();
|
|
|
+ //myPen2.Brush = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
|
|
|
+ //myPen2.Brush.Opacity = 0.8;
|
|
|
+ //myPen2.Thickness = 2;
|
|
|
+ //myStrikeout.Pen = myPen2;
|
|
|
+ //myStrikeout.PenOffset = -4;
|
|
|
+ //myStrikeout.PenThicknessUnit = TextDecorationUnit.FontRecommended;
|
|
|
+ //TextDecorationCollection myCollection2 = new TextDecorationCollection();
|
|
|
+ //myCollection2.Add(myStrikeout);
|
|
|
+ ////因为波浪线无法实现 暂时只显示文字 不显示下划线,删除线等
|
|
|
+ //TxbMarkupContent.TextDecorations = myCollection2;
|
|
|
+
|
|
|
+ #endregion to do
|
|
|
+
|
|
|
+ break;
|
|
|
|
|
|
- default:
|
|
|
- break;
|
|
|
+ case AnnotArgsType.AnnotSticky://便签
|
|
|
+ if (data is StickyAnnotArgs stickyAnnotArgs)
|
|
|
+ {
|
|
|
+ BtnAnnotSticky.Visibility = Visibility;
|
|
|
+ PathSticky.Fill = new SolidColorBrush(stickyAnnotArgs.Color);
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotUnderline:
|
|
|
+ if (data is TextUnderlineAnnotArgs textUnderlineAnnotArgs)
|
|
|
+ {
|
|
|
+ BtnUnderLine.Visibility = Visibility.Visible;
|
|
|
+ RectangleUnderline.Fill = new SolidColorBrush(textUnderlineAnnotArgs.Color);
|
|
|
+ }
|
|
|
+
|
|
|
+ #region TO DO
|
|
|
+
|
|
|
+ //TextDecoration myUnderline = new TextDecoration();
|
|
|
+ //Pen myPen1 = new Pen();
|
|
|
+ //myPen1.Brush = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
|
|
|
+ //myPen1.Brush.Opacity = 0.8;
|
|
|
+ //myPen1.Thickness = 2;
|
|
|
+ //myUnderline.Pen = myPen1;
|
|
|
+ //myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;
|
|
|
+ //TextDecorationCollection myCollection1 = new TextDecorationCollection();
|
|
|
+ //myCollection1.Add(myUnderline);
|
|
|
+ //TxbMarkupContent.TextDecorations = myCollection1;
|
|
|
+
|
|
|
+ #endregion TO DO
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotLine:
|
|
|
+ if (data is LineAnnotArgs lineAnnotArgs)
|
|
|
+ {
|
|
|
+ if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
|
|
|
+ {
|
|
|
+ BtnSharpArrow.Visibility = Visibility.Visible;
|
|
|
+ PathArrow.Fill = new SolidColorBrush(lineAnnotArgs.LineColor);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PathSharpLine.Fill = new SolidColorBrush(lineAnnotArgs.LineColor);
|
|
|
+ BtnSharpLine.Visibility = Visibility.Visible;
|
|
|
+ }
|
|
|
+ ///对于形状注释等只有Note 的处理
|
|
|
+ if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
|
|
|
+ {
|
|
|
+ TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
|
|
|
+ TxbMarkupContent.Text = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotSquare:
|
|
|
+ if (data is SquareAnnotArgs squareAnnotArgs)
|
|
|
+ {
|
|
|
+ BtnAnnotSquare.Visibility = Visibility.Visible;
|
|
|
+ RectAnnotSquare.Stroke = new SolidColorBrush(squareAnnotArgs.LineColor);
|
|
|
+ RectAnnotSquare.Fill = new SolidColorBrush(squareAnnotArgs.BgColor);
|
|
|
+ ///对于形状注释等只有Note 的处理
|
|
|
+ if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
|
|
|
+ {
|
|
|
+ TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
|
|
|
+ TxbMarkupContent.Text = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotCircle:
|
|
|
+ if (data is CircleAnnotArgs circleAnnotArgs)
|
|
|
+ {
|
|
|
+ BtnAnnotCircle.Visibility = Visibility.Visible;
|
|
|
+ EllipseCircle.Stroke = new SolidColorBrush(circleAnnotArgs.LineColor);
|
|
|
+ EllipseCircle.Fill = new SolidColorBrush(circleAnnotArgs.BgColor);
|
|
|
+ ///对于形状注释等只有Note 的处理
|
|
|
+ if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
|
|
|
+ {
|
|
|
+ TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
|
|
|
+ TxbMarkupContent.Text = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotLink:
|
|
|
+ BtnAnnotLink.Visibility = Visibility.Visible;
|
|
|
+ if (data is LinkAnnotArgs linkAnnotArgs)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(linkAnnotArgs.Content))
|
|
|
+ {
|
|
|
+ if (linkAnnotArgs.DestIndex != -1)
|
|
|
+ {
|
|
|
+ TxbMarkupContent.Text = string.Format($"To Page {linkAnnotArgs.DestIndex + 1}");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TxbMarkupContent.Text = string.Format($"{linkAnnotArgs.URI}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void SetImageContext(AnnotationHandlerEventArgs args, FreehandAnnotArgs freehandAnnotArgs)
|
|
|
{
|
|
|
+ if (args == null && freehandAnnotArgs == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
double width = args.WriteableBitmap.Width;
|
|
|
double height = args.WriteableBitmap.Height;
|
|
|
|
|
|
CPDFDocument doc = args.Document;
|
|
|
- CPDFPage docPage = doc.PageAtIndex(args.PageIndex, false);
|
|
|
- if (docPage != null)
|
|
|
+ if (doc != null)
|
|
|
{
|
|
|
- double maxWidth = docPage.PageSize.Width;
|
|
|
- double maxHeight = docPage.PageSize.Height;
|
|
|
- ImageContext.MaxHeight = maxHeight;
|
|
|
-
|
|
|
- if (width > 180)
|
|
|
+ CPDFPage docPage = doc.PageAtIndex(args.PageIndex, false);
|
|
|
+ if (docPage != null)
|
|
|
{
|
|
|
- ImageContext.Stretch = Stretch.Uniform;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (height >= maxHeight/2)
|
|
|
+ double maxWidth = docPage.PageSize.Width;
|
|
|
+ double maxHeight = docPage.PageSize.Height;
|
|
|
+ ImageContext.MaxHeight = maxHeight;
|
|
|
+
|
|
|
+ if (width > 180)
|
|
|
{
|
|
|
- //ImageContext.MaxHeight = 900;
|
|
|
- ImageContext.Stretch = Stretch.None;
|
|
|
+ ImageContext.Stretch = Stretch.Uniform;
|
|
|
}
|
|
|
-
|
|
|
- if (height < maxHeight/2)
|
|
|
+ else
|
|
|
{
|
|
|
- if (height <= 20)
|
|
|
+ if (height >= maxHeight / 2)
|
|
|
{
|
|
|
- ImageContext.MinHeight = height;
|
|
|
- ImageContext.Height = 30;
|
|
|
-
|
|
|
+ //ImageContext.MaxHeight = 900;
|
|
|
+ ImageContext.Stretch = Stretch.None;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (height < maxHeight / 2)
|
|
|
+ {
|
|
|
+ if (height <= 20)
|
|
|
+ {
|
|
|
+ ImageContext.MinHeight = height;
|
|
|
+ ImageContext.Height = 30;
|
|
|
+ }
|
|
|
+ ImageContext.Stretch = Stretch.None;
|
|
|
}
|
|
|
- ImageContext.Stretch = Stretch.None;
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // ImageContext.Stretch = Stretch.Uniform;
|
|
|
+ //}
|
|
|
}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // ImageContext.Stretch = Stretch.Uniform;
|
|
|
- //}
|
|
|
}
|
|
|
}
|
|
|
}
|