From 3d4d3fc5b2ef7fc3904e2e79f0c0896241919958 Mon Sep 17 00:00:00 2001 From: chr <chr@chr.com> Date: 星期五, 30 八月 2024 19:20:52 +0800 Subject: [PATCH] 新增richbox转base64 --- PdmSwPlugin.DrawApprove/.vs/PdmSwPlugin.DrawApprove.csproj.dtbcache.json | 2 CustomRictBox/PdmSwPlugin.UI.csproj | 3 PdmSwPlugin.Common/Style/LinkButton.xaml | 5 PdmSwPlugin.DrawApprove/XamlWindow.xaml.cs | 3 PdmSwPlugin.DrawApprove/DrawApprove.xaml | 65 +++++++++- PdmSwPlugin.DrawApprove/XamlWindow.xaml | 2 .vs/SwPlugin/v17/DocumentLayout.json | 103 +++++----------- CustomRictBox/CustomRichBox.xaml.cs | 135 ++++++++++++++++++++++ 8 files changed, 237 insertions(+), 81 deletions(-) diff --git a/.vs/SwPlugin/v17/DocumentLayout.json b/.vs/SwPlugin/v17/DocumentLayout.json index 9c7062c..874cf31 100644 --- a/.vs/SwPlugin/v17/DocumentLayout.json +++ b/.vs/SwPlugin/v17/DocumentLayout.json @@ -3,24 +3,16 @@ "WorkspaceRootPath": "C:\\Workspace\\PdmSwPlugin2\\", "Documents": [ { - "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|c:\\workspace\\pdmswplugin2\\pdmswplugin.main\\constant\\pluginconst.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\constant\\pluginconst.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|c:\\workspace\\pdmswplugin2\\pdmswplugin.drawapprove\\xamlwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|solutionrelative:pdmswplugin.drawapprove\\xamlwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|c:\\workspace\\pdmswplugin2\\pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|solutionrelative:pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{44BCE7B9-F984-426B-9997-FC1FB1A49CC0}|CustomRictBox\\PdmSwPlugin.UI.csproj|c:\\workspace\\pdmswplugin2\\customrictbox\\customrichbox.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{44BCE7B9-F984-426B-9997-FC1FB1A49CC0}|CustomRictBox\\PdmSwPlugin.UI.csproj|solutionrelative:customrictbox\\customrichbox.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|c:\\workspace\\pdmswplugin2\\pdmswplugin.drawapprove\\drawapprove.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|solutionrelative:pdmswplugin.drawapprove\\drawapprove.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|c:\\workspace\\pdmswplugin2\\pdmswplugin.common\\util\\dmsldfileextentionchecker.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|solutionrelative:pdmswplugin.common\\util\\dmsldfileextentionchecker.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|c:\\workspace\\pdmswplugin2\\pdmsw\\settings\\pluginsetting.xml||{FA3CD31E-987B-443A-9B81-186104E8DAC1}", - "RelativeMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|solutionrelative:pdmsw\\settings\\pluginsetting.xml||{FA3CD31E-987B-443A-9B81-186104E8DAC1}" + "AbsoluteMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|c:\\workspace\\pdmswplugin2\\pdmswplugin.drawapprove\\xamlwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|solutionrelative:pdmswplugin.drawapprove\\xamlwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" } ], "DocumentGroupContainers": [ @@ -30,71 +22,44 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 0, + "SelectedChildIndex": 1, "Children": [ { "$type": "Document", - "DocumentIndex": 0, - "Title": "PluginConst.cs", - "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\Constant\\PluginConst.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.Main\\Constant\\PluginConst.cs", - "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\Constant\\PluginConst.cs", - "RelativeToolTip": "PdmSwPlugin.Main\\Constant\\PluginConst.cs", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAAgAAAAAAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-08-27T02:20:56.948Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "DMSldFileExtentionChecker.cs", - "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Util\\DMSldFileExtentionChecker.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.Common\\Util\\DMSldFileExtentionChecker.cs", - "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Util\\DMSldFileExtentionChecker.cs", - "RelativeToolTip": "PdmSwPlugin.Common\\Util\\DMSldFileExtentionChecker.cs", - "ViewState": "AQIAAAsAAAAAAAAAAAAYwBMAAAA2AAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-08-27T01:56:05.638Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 4, - "Title": "PluginSetting.xml", - "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\PdmSw\\Settings\\PluginSetting.xml", - "RelativeDocumentMoniker": "PdmSw\\Settings\\PluginSetting.xml", - "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\PdmSw\\Settings\\PluginSetting.xml", - "RelativeToolTip": "PdmSw\\Settings\\PluginSetting.xml", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAAcAAAAmAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003576|", - "WhenOpened": "2024-08-27T01:51:40.382Z", - "EditorCaption": "" - }, - { - "$type": "Document", "DocumentIndex": 1, - "Title": "PdmControl.xaml.cs", - "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.PDM\\PdmControl.xaml.cs", - "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml.cs", - "RelativeToolTip": "PdmSwPlugin.PDM\\PdmControl.xaml.cs", - "ViewState": "AQIAAJQCAAAAAAAAAAAYwJ0CAAA1AAAA", + "Title": "CustomRichBox.xaml.cs", + "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\CustomRictBox\\CustomRichBox.xaml.cs", + "RelativeDocumentMoniker": "CustomRictBox\\CustomRichBox.xaml.cs", + "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\CustomRictBox\\CustomRichBox.xaml.cs", + "RelativeToolTip": "CustomRictBox\\CustomRichBox.xaml.cs", + "ViewState": "AQIAAKYBAAAAAAAAAAAYwLQBAAAlAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-08-27T01:28:33.744Z", + "WhenOpened": "2024-08-29T13:03:42.863Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "XamlWindow.xaml.cs", + "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\XamlWindow.xaml.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.DrawApprove\\XamlWindow.xaml.cs", + "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\XamlWindow.xaml.cs", + "RelativeToolTip": "PdmSwPlugin.DrawApprove\\XamlWindow.xaml.cs", + "ViewState": "AQIAAFYAAAAAAAAAAAAlwGMAAAAcAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-08-29T12:51:21.766Z", "EditorCaption": "" }, { "$type": "Document", "DocumentIndex": 2, - "Title": "DrawApprove.xaml.cs", - "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "RelativeToolTip": "PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "ViewState": "AQIAAM8AAAAAAAAAAAAgwLcAAAAAAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-08-26T06:10:46.307Z", + "Title": "XamlWindow.xaml", + "DocumentMoniker": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\XamlWindow.xaml", + "RelativeDocumentMoniker": "PdmSwPlugin.DrawApprove\\XamlWindow.xaml", + "ToolTip": "C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\XamlWindow.xaml", + "RelativeToolTip": "PdmSwPlugin.DrawApprove\\XamlWindow.xaml", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", + "WhenOpened": "2024-08-29T12:51:16.825Z", "EditorCaption": "" } ] diff --git a/CustomRictBox/CustomRichBox.xaml.cs b/CustomRictBox/CustomRichBox.xaml.cs index ae3fec3..08bfa38 100644 --- a/CustomRictBox/CustomRichBox.xaml.cs +++ b/CustomRictBox/CustomRichBox.xaml.cs @@ -1,6 +1,11 @@ 锘縰sing Microsoft.Win32; using System; +using System.ComponentModel; +using System.Diagnostics; using System.IO; +using System.Reflection; +using System.Runtime.InteropServices.ComTypes; +using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; @@ -8,6 +13,7 @@ using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Imaging; +using System.Windows.Media.Media3D; namespace PdmSwPlugin.UI { @@ -285,11 +291,16 @@ { width = picMaxWidth; } + TextPointer pointer = richTextBox.CaretPosition; /// 琛屽唴鎻掑叆鍥剧墖 var insertImg = new Image() { Source = img, Stretch = Stretch.Uniform, Width = width }; var imgContainer = new InlineUIContainer(insertImg); - TextPointer pointer = richTextBox.CaretPosition; pointer.Paragraph.Inlines.Add(imgContainer); + + //string base64 = ImageToBase64(img); + //string imgXaml = $"<Image Source=\"data:image/jpg;base64,{base64}\" />"; + //var imgContainer = new InlineUIContainer(imgXaml); + //pointer.Paragraph.Inlines.Add(imgXaml); /// 涓嬮潰娉ㄩ噴鐨勮繖娈垫槸鐩存帴鎻掑叆鏂版钀界殑鍐欐硶 //var imgContainer = new BlockUIContainer(insertImg); @@ -376,5 +387,127 @@ } } + + + + public void ToBase64Image2() + { + richTextBox.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); + richTextBox.Arrange(new Rect(new Size(richTextBox.ActualWidth, richTextBox.ActualHeight))); + + // Create a DrawingVisual and use a VisualBrush to render the RichTextBox + DrawingVisual visual = new DrawingVisual(); + using (DrawingContext context = visual.RenderOpen()) + { + VisualBrush brush = new VisualBrush(richTextBox); + context.DrawRectangle(brush, null, new Rect(new Size(richTextBox.ActualWidth, richTextBox.ActualHeight))); + } + + // Render the DrawingVisual to a RenderTargetBitmap + RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap( + (int)richTextBox.ActualWidth, + (int)richTextBox.ActualHeight, + 96d, 96d, PixelFormats.Pbgra32); + + renderTargetBitmap.Render(visual); + + // Create a BitmapEncoder to encode the RenderTargetBitmap + PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); + pngEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + using (FileStream stream = new FileStream("C:\\Workspace\\test.png", FileMode.OpenOrCreate)) + { + // Save the encoded PNG image to a memory stream + pngEncoder.Save(stream); + + stream.Flush(); + stream.Close(); + } + + /* using (MemoryStream memoryStream = new MemoryStream()) + { + // Save the encoded PNG image to a memory stream + pngEncoder.Save(memoryStream); + // Convert the memory stream to a byte array + byte[] imageBytes = memoryStream.ToArray(); + // Convert the byte array to a Base64 string + return Convert.ToBase64String(imageBytes); + }*/ + } + + public string ToBase64Image() + { + //string sss = XamlWriter.Save(richTextBox.Document); + //Debug.Print(sss); + // Force a measure and arrange of the RichTextBox to ensure all content is rendered + //richTextBox.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); + //richTextBox.Arrange(new Rect(new Size(richTextBox.ActualWidth, richTextBox.ActualHeight))); + + + //// Render the DrawingVisual to a RenderTargetBitmap + //RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap( + // (int)richTextBox.ActualWidth, + // (int)richTextBox.ActualHeight, + // 96d, 96d, PixelFormats.Pbgra32); + + //FlowDocumentReader reader = new FlowDocumentReader + //{ + // Document = richTextBox.Document + //}; + + //renderTargetBitmap.Render(reader); + + //// Create a BitmapEncoder to encode the RenderTargetBitmap + //PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); + //pngEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + + //using (FileStream stream = new FileStream("C:\\Workspace\\test.png",FileMode.OpenOrCreate)) + //{ + // // Save the encoded PNG image to a memory stream + // pngEncoder.Save(stream); + + // stream.Flush(); + // stream.Close(); + //} + + //string sss = XamlWriter.Save(richTextBox.Document); + //Debug.Print(sss); + // Backup original size + var originalWidth = richTextBox.ExtentWidth; + var originalHeight = richTextBox.ExtentHeight; + + //richTextBox.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); + richTextBox.Arrange(new Rect(new Size(originalWidth, originalHeight))); + + int dpi = 300; + + // Create a RenderTargetBitmap with the new size + RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap( + (int)(originalWidth * dpi / 96), + (int)(originalHeight * dpi / 96), + 300d, 300d, PixelFormats.Default); + + // Render the control to the RenderTargetBitmap + renderTargetBitmap.Render(richTextBox); + + // Create an encoder (PNG in this case) + PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); + pngEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + + + FileStream pngfs = new FileStream("C:\\1.png", FileMode.OpenOrCreate); + + BitmapEncoder be = new PngBitmapEncoder(); + be.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); + + using (MemoryStream ms = new MemoryStream()) + { + be.Save(ms); + byte[] imageBytes = ms.ToArray(); + return Convert.ToBase64String(imageBytes); // 灏嗗瓧鑺傛暟缁勮浆鎹负Base64瀛楃涓� + } + + //be.Save(pngfs); + //pngfs.Close(); + } } } diff --git a/CustomRictBox/PdmSwPlugin.UI.csproj b/CustomRictBox/PdmSwPlugin.UI.csproj index fd0786d..d2f9fd1 100644 --- a/CustomRictBox/PdmSwPlugin.UI.csproj +++ b/CustomRictBox/PdmSwPlugin.UI.csproj @@ -50,6 +50,9 @@ <ErrorReport>prompt</ErrorReport> </PropertyGroup> <ItemGroup> + <Reference Include="HtmlToXamlConverter"> + <HintPath>..\PdmSwPlugin.Util\lib\HtmlToXamlConverter.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> diff --git a/PdmSwPlugin.Common/Style/LinkButton.xaml b/PdmSwPlugin.Common/Style/LinkButton.xaml index bdfa87e..0dd1ec4 100644 --- a/PdmSwPlugin.Common/Style/LinkButton.xaml +++ b/PdmSwPlugin.Common/Style/LinkButton.xaml @@ -5,12 +5,15 @@ </FontFamily> <Style x:Key="LinkButton" TargetType="{x:Type Button}" > + <Style.Resources> + <SolidColorBrush x:Key="TextColor">Blue</SolidColorBrush> + </Style.Resources> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ButtonBase}"> <ContentPresenter x:Name="buttonContent" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontFamily="{StaticResource iconfont}" - TextBlock.Foreground="Blue" + TextBlock.Foreground="{StaticResource TextColor}" Margin="0,0,5,0" VerticalAlignment="Center" HorizontalAlignment="Center" diff --git a/PdmSwPlugin.DrawApprove/.vs/PdmSwPlugin.DrawApprove.csproj.dtbcache.json b/PdmSwPlugin.DrawApprove/.vs/PdmSwPlugin.DrawApprove.csproj.dtbcache.json index f95d680..8f36840 100644 --- a/PdmSwPlugin.DrawApprove/.vs/PdmSwPlugin.DrawApprove.csproj.dtbcache.json +++ b/PdmSwPlugin.DrawApprove/.vs/PdmSwPlugin.DrawApprove.csproj.dtbcache.json @@ -1 +1 @@ -{"RootPath":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove","ProjectFileName":"PdmSwPlugin.DrawApprove.csproj","Configuration":"Debug|x64","FrameworkPath":"","Sources":[{"SourceFile":"RejectWindow.xaml.cs"},{"SourceFile":"ResolveWindow.xaml.cs"},{"SourceFile":"WebWindow.xaml.cs"},{"SourceFile":"XamlWindow.xaml.cs"},{"SourceFile":"DrawApprove.xaml.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\x64\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\DrawApprove.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\RejectWindow.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\ResolveWindow.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\WebWindow.g.cs"}],"References":[{"Reference":"C:\\Workspace\\PdmSwPlugin2\\lib\\log4net.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\bin\\x64\\Debug\\PdmSwPlugin.Common.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":true,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\PresentationCore.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\PresentationFramework.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS\\api\\redist\\SolidWorks.Interop.sldworks.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS\\api\\redist\\SolidWorks.Interop.swconst.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Configuration.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xaml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\bin\\x64\\Debug\\WebKitBrowser.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\WindowsBase.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\bin\\x64\\Debug\\PdmSwPlugin.DrawApprove.dll","OutputItemRelativePath":"PdmSwPlugin.DrawApprove.dll"},{"OutputItemFullPath":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\bin\\x64\\Debug\\PdmSwPlugin.DrawApprove.pdb","OutputItemRelativePath":"PdmSwPlugin.DrawApprove.pdb"}],"CopyToOutputEntries":[]} \ No newline at end of file +{"RootPath":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove","ProjectFileName":"PdmSwPlugin.DrawApprove.csproj","Configuration":"Debug|x64","FrameworkPath":"","Sources":[{"SourceFile":"DrawAuditHisControl.xaml.cs"},{"SourceFile":"RejectWindow.xaml.cs"},{"SourceFile":"ResolveWindow.xaml.cs"},{"SourceFile":"WebWindow.xaml.cs"},{"SourceFile":"XamlWindow.xaml.cs"},{"SourceFile":"DrawApprove.xaml.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\x64\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\DrawAuditHisControl.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\DrawApprove.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\RejectWindow.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\ResolveWindow.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\WebWindow.g.cs"},{"SourceFile":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\obj\\x64\\Debug\\XamlWindow.g.cs"}],"References":[{"Reference":"C:\\Workspace\\PdmSwPlugin2\\lib\\log4net.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\bin\\x64\\Debug\\PdmSwPlugin.Common.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":true,"ProjectPath":""},{"Reference":"C:\\Workspace\\PdmSwPlugin2\\CustomRictBox\\bin\\x64\\Debug\\PdmSwPlugin.UI.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":true,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\PresentationCore.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\PresentationFramework.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS\\api\\redist\\SolidWorks.Interop.sldworks.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS\\api\\redist\\SolidWorks.Interop.swconst.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Configuration.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xaml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\bin\\x64\\Debug\\WebKitBrowser.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\WindowsBase.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\bin\\x64\\Debug\\PdmSwPlugin.DrawApprove.dll","OutputItemRelativePath":"PdmSwPlugin.DrawApprove.dll"},{"OutputItemFullPath":"C:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\bin\\x64\\Debug\\PdmSwPlugin.DrawApprove.pdb","OutputItemRelativePath":"PdmSwPlugin.DrawApprove.pdb"}],"CopyToOutputEntries":[]} \ No newline at end of file diff --git a/PdmSwPlugin.DrawApprove/DrawApprove.xaml b/PdmSwPlugin.DrawApprove/DrawApprove.xaml index fd35c23..60504fb 100644 --- a/PdmSwPlugin.DrawApprove/DrawApprove.xaml +++ b/PdmSwPlugin.DrawApprove/DrawApprove.xaml @@ -46,6 +46,48 @@ </Style.Triggers> </Style> + <Style x:Key="GLink" TargetType="{x:Type Button}" > + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ButtonBase}"> + <ContentPresenter x:Name="buttonContent" TextBlock.FontSize="{TemplateBinding FontSize}" + TextBlock.FontFamily="{StaticResource iconfont}" + TextBlock.Foreground="Green" + Margin="0,0,5,0" + VerticalAlignment="Center" + HorizontalAlignment="Center" + Content="{TemplateBinding Content}"/> + <ControlTemplate.Triggers> + <Trigger Property="IsMouseOver" Value="True"> + <Setter TargetName="buttonContent" Property="TextBlock.Foreground" Value="Purple"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="RLink" TargetType="{x:Type Button}" > + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ButtonBase}"> + <ContentPresenter x:Name="buttonContent" TextBlock.FontSize="{TemplateBinding FontSize}" + TextBlock.FontFamily="{StaticResource iconfont}" + TextBlock.Foreground="Red" + Margin="0,0,5,0" + VerticalAlignment="Center" + HorizontalAlignment="Center" + Content="{TemplateBinding Content}"/> + <ControlTemplate.Triggers> + <Trigger Property="IsMouseOver" Value="True"> + <Setter TargetName="buttonContent" Property="TextBlock.Foreground" Value="Purple"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <treeData:TreeItemDataConverter x:Key="TreeItemDataConverter"/> <ResourceDictionary.MergedDictionaries> @@ -74,7 +116,14 @@ AutoGenerateColumns="False" CanUserAddRows="False" CanUserSortColumns="False" + FontSize="18" CanUserDeleteRows="False"> + <treeData:TreeDataGrid.CellStyle> + <Style TargetType="DataGridCell" > + <Setter Property="TextBox.Margin" Value="0"/> + </Style> + </treeData:TreeDataGrid.CellStyle> + <treeData:TreeDataGrid.Columns> <DataGridTemplateColumn Width="25"> <DataGridTemplateColumn.Header> @@ -99,12 +148,12 @@ </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTextColumn Header="鐢宠浜�" Width="80" IsReadOnly="True" Binding="{Binding Data.requestUser}"/> - <DataGridTextColumn Header="娴佹按鍗曞彿" Width="80" IsReadOnly="True" Binding="{Binding Data.orderCode}"/> - <DataGridTextColumn Header="鍓嶄竴瀹℃牳浜�" Width="80" IsReadOnly="True" Binding="{Binding Data.auditUser}"/> - <DataGridTextColumn Header="鎻愪氦鏃堕棿" Width="130" IsReadOnly="True" Binding="{Binding Data.updateTime}"/> + <DataGridTextColumn Header="鐢宠浜�" Width="100" IsReadOnly="True" Binding="{Binding Data.requestUser}"/> + <DataGridTextColumn Header="娴佹按鍗曞彿" Width="120" IsReadOnly="True" Binding="{Binding Data.orderCode}"/> + <DataGridTextColumn Header="鍓嶄竴瀹℃牳浜�" Width="100" IsReadOnly="True" Binding="{Binding Data.auditUser}"/> + <DataGridTextColumn Header="鎻愪氦鏃堕棿" Width="180" IsReadOnly="True" Binding="{Binding Data.updateTime}"/> - <DataGridTemplateColumn Header="鐘舵��" Width="60" IsReadOnly="True"> + <DataGridTemplateColumn Header="鐘舵��" Width="80" IsReadOnly="True"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Style="{StaticResource statusSlot}" DataContext="{Binding Data}" @@ -113,14 +162,14 @@ </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTemplateColumn Header="鎿嶄綔" Width="200" IsReadOnly="True"> + <DataGridTemplateColumn Header="鎿嶄綔" Width="280" IsReadOnly="True"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Button Style="{StaticResource LinkButton}" DataContext="{Binding Data}" Click="OpenDrw_Click">鎵撳紑宸ョ▼鍥�</Button> <Button Style="{StaticResource LinkButton}" DataContext="{Binding Data}" Click="OpenDoc_Click">鎵撳紑鍥剧焊</Button> - <Button Style="{StaticResource LinkButton}" DataContext="{Binding Data}" Click="Resolve_Click">閫氳繃</Button> - <Button Style="{StaticResource LinkButton}" DataContext="{Binding Data}" Margin="0" Click="Reject_Click">涓嶉�氳繃</Button> + <Button Style="{StaticResource GLink}" DataContext="{Binding Data}" Click="Resolve_Click">閫氳繃</Button> + <Button Style="{StaticResource RLink}" DataContext="{Binding Data}" Margin="0" Click="Reject_Click">涓嶉�氳繃</Button> </StackPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> diff --git a/PdmSwPlugin.DrawApprove/XamlWindow.xaml b/PdmSwPlugin.DrawApprove/XamlWindow.xaml index 09031be..0f4b60f 100644 --- a/PdmSwPlugin.DrawApprove/XamlWindow.xaml +++ b/PdmSwPlugin.DrawApprove/XamlWindow.xaml @@ -18,7 +18,7 @@ <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> - <ctl:CustomRichBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="richBox"/> + <ctl:CustomRichBox HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="richBox"/> <Button Grid.Row="1" Grid.Column="0" Click="Ok_Click">纭畾</Button> <Button Grid.Row="1" Grid.Column="1" Click="Cancel_Click">鍙栨秷</Button> </Grid> diff --git a/PdmSwPlugin.DrawApprove/XamlWindow.xaml.cs b/PdmSwPlugin.DrawApprove/XamlWindow.xaml.cs index 41cb275..2b46a40 100644 --- a/PdmSwPlugin.DrawApprove/XamlWindow.xaml.cs +++ b/PdmSwPlugin.DrawApprove/XamlWindow.xaml.cs @@ -6,6 +6,7 @@ using SolidWorks.Interop.sldworks; using System; using System.ComponentModel; +using System.Diagnostics; using System.Net.Http; using System.Runtime.CompilerServices; using System.Threading.Tasks; @@ -95,6 +96,8 @@ private void Cancel_Click(object sender, RoutedEventArgs e) { + string ss = richBox.ToBase64Image(); + Debug.Print(ss); DialogResult = false; } -- Gitblit v1.9.1