Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 753ff7b4f1 | |||
| 1edfe486cb | |||
| 7190993f11 | |||
| 249289144f |
@@ -0,0 +1,14 @@
|
||||
<EgtFloating:EgtFloatingPanel x:Class="PrintPanelV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
|
||||
IsTopDockable="True" IsBottomDockable="False" IsLeftDockable="False"
|
||||
IsRightDockable="False" Style="{StaticResource ToolBar_EgtFloatingPanel}">
|
||||
|
||||
<Button ToolTip="{Binding PrintToolTip}"
|
||||
Style="{StaticResource ToolBar_Button}"
|
||||
Command="{Binding PrintCommand}">
|
||||
<Image Source="/Resources/InstrumentPanel/Print.png" Stretch="Uniform"/>
|
||||
</Button>
|
||||
|
||||
</EgtFloating:EgtFloatingPanel>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class PrintPanelV
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,84 @@
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Public Class PrintPanelVM
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdPrint As ICommand
|
||||
|
||||
Public ReadOnly Property PrintToolTip As String
|
||||
Get
|
||||
Return "Print shading" & vbCrLf & "Print hidden line (Shift)"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "PrintCommand"
|
||||
|
||||
Public ReadOnly Property PrintCommand As ICommand
|
||||
Get
|
||||
If m_cmdPrint Is Nothing Then
|
||||
m_cmdPrint = New Command(AddressOf Print)
|
||||
End If
|
||||
Return m_cmdPrint
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Print(ByVal param As Object)
|
||||
Dim SM_Select As SM = SM.SHADING
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) > 0 Then
|
||||
SM_Select = SM.HIDDENLINE
|
||||
EgtSetLineAttribs(3)
|
||||
End If
|
||||
Dim printDlg As New PrintDialog
|
||||
Dim sPath = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\Image.png"
|
||||
If printDlg.ShowDialog() Then
|
||||
' Recupero le dimensioni dell'area di stampa
|
||||
Dim dW As Double = printDlg.PrintableAreaWidth
|
||||
Dim dH As Double = printDlg.PrintableAreaHeight
|
||||
Try
|
||||
' Creo l'immagine da allegare
|
||||
' EgtZoom(ZM.ALL, True)
|
||||
' Prendo l'immagine per la stampa
|
||||
Dim colWhite As New Color3d(255, 255, 255)
|
||||
Dim nImgW As Integer = GetWidthDimProjectV()
|
||||
Dim nImgH As Integer = GetHeightDimProjectV()
|
||||
If Not EgtGetImage(SM_Select, colWhite, colWhite, nImgW, nImgH, sPath) Then
|
||||
' Error in creating the print image
|
||||
EgtOutLog(EgtMsg(50181))
|
||||
EgtSetLineAttribs(1)
|
||||
Return
|
||||
End If
|
||||
EgtSetLineAttribs(1)
|
||||
'Metodo complesso di stampa che permette di rilasciare il file :
|
||||
'carico la bitmap e la metto in uno stream in memoria
|
||||
Dim stream As System.IO.Stream = New System.IO.MemoryStream()
|
||||
Dim bitmap As System.Drawing.Bitmap = New System.Drawing.Bitmap(sPath)
|
||||
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
|
||||
bitmap.Dispose()
|
||||
' la sposto in una BitmapImage
|
||||
Dim bitImage As New System.Windows.Media.Imaging.BitmapImage()
|
||||
bitImage.BeginInit()
|
||||
bitImage.StreamSource = stream
|
||||
bitImage.EndInit()
|
||||
' la sposto in un Visual Control
|
||||
Dim tmpImg As New Image
|
||||
tmpImg.BeginInit()
|
||||
tmpImg.Source = bitImage
|
||||
'tmpImg.Margin = New Thickness(-100)
|
||||
tmpImg.Stretch = Stretch.Uniform
|
||||
' ruoto a seconda dell'aspetto della pagina
|
||||
'If (dH > dW And nImgH < nImgW) Or (dH < dW And nImgH > nImgW) Then
|
||||
' tmpImg.LayoutTransform = New RotateTransform(-90)
|
||||
'End If
|
||||
tmpImg.EndInit()
|
||||
' eseguo la stampa
|
||||
printDlg.PrintVisual(tmpImg, "Parts Layout")
|
||||
Catch
|
||||
' Rrror in executing print
|
||||
EgtOutLog(EgtMsg(50182))
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' PrintCommand
|
||||
|
||||
End Class
|
||||
@@ -213,7 +213,11 @@
|
||||
<Compile Include="EgtStoneLib\VeinMatchingWindow.xaml.vb">
|
||||
<DependentUpon>VeinMatchingWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="InstrumentPanel\PrintPanelV.xaml.vb">
|
||||
<DependentUpon>PrintPanelV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="InstrumentPanel\MyInstrumentPanelVM.vb" />
|
||||
<Compile Include="InstrumentPanel\PrintPanelVM.vb" />
|
||||
<Compile Include="MachinePanel\MyMachinePanelVM.vb" />
|
||||
<Compile Include="MyMachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||
<Compile Include="MachinePanel\MachinePanelV.xaml.vb">
|
||||
@@ -389,6 +393,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="InstrumentPanel\PrintPanelV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MachinePanel\MachinePanelV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -691,6 +699,9 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\TopCommandBar\DxfOut.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\InstrumentPanel\Print.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagOFFICE\OmagOFFICER32.exe
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<OmagOFFICE:ShowPanelV DataContext="{StaticResource ShowPanelVM}"/>
|
||||
<OmagOFFICE:ViewPanelV DataContext="{StaticResource ViewPanelVM}"/>
|
||||
<OmagOFFICE:InstrumentPanelV DataContext="{StaticResource InstrumentPanelVM}"/>
|
||||
<OmagOFFICE:PrintPanelV DataContext="{StaticResource PrintPanelVM}"/>
|
||||
<OmagOFFICE:VeinMatchPanelV DataContext="{StaticResource VeinMatchPanelVM}"/>
|
||||
<OmagOFFICE:MachinePanelV DataContext="{StaticResource MachinePanelVM}"/>
|
||||
</EgtFloating:EgtFloatingTray>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Public Class ProjectV
|
||||
|
||||
Private Sub LoadPage() Handles Me.Loaded
|
||||
OmagOFFICEMap.SetRefProjectV(Me)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 637 B |
@@ -18,6 +18,7 @@
|
||||
<EgtWPFLib5:ShowPanelVM x:Key="ShowPanelVM"/>
|
||||
<EgtWPFLib5:ViewPanelVM x:Key="ViewPanelVM"/>
|
||||
<EgtWPFLib5:InstrumentPanelVM x:Key="InstrumentPanelVM"/>
|
||||
<OmagOFFICE:PrintPanelVM x:Key="PrintPanelVM"/>
|
||||
<OmagOFFICE:MyMachinePanelVM x:Key="MachinePanelVM"/>
|
||||
<OmagOFFICE:VeinMatchPanelVM x:Key="VeinMatchPanelVM"/>
|
||||
<OmagOFFICE:OptionPanelVM x:Key="OptionPanelVM"/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtPHOTOLib
|
||||
Imports EgtUILib
|
||||
|
||||
Module OmagOFFICEMap
|
||||
|
||||
@@ -229,6 +230,43 @@ Module OmagOFFICEMap
|
||||
Return Not IsNothing(m_refSimulTabVM)
|
||||
End Function
|
||||
|
||||
|
||||
Private m_refProjectV As ProjectV
|
||||
Friend Sub SetRefProjectV(ProjectV As ProjectV)
|
||||
m_refProjectV = ProjectV
|
||||
End Sub
|
||||
|
||||
Private m_WidthProjectV As Integer = 2000
|
||||
Friend Sub SetWidthDimProjectV(Width As Integer)
|
||||
m_WidthProjectV = Width
|
||||
End Sub
|
||||
Friend Function GetWidthDimProjectV() As Integer
|
||||
If Not IsNothing(m_refProjectV) Then
|
||||
Try
|
||||
m_WidthProjectV = CInt(m_refProjectV.ActualWidth)
|
||||
Catch ex As Exception
|
||||
EgtOutLog(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return m_WidthProjectV
|
||||
End Function
|
||||
|
||||
Private m_HeightProjectV As Integer = 1000
|
||||
Friend Sub SetHeightDimProjectV(Eight As Integer)
|
||||
m_HeightProjectV = Eight
|
||||
End Sub
|
||||
|
||||
Friend Function GetHeightDimProjectV() As Integer
|
||||
If Not IsNothing(m_refProjectV) Then
|
||||
Try
|
||||
m_HeightProjectV = CInt(m_refProjectV.ActualHeight)
|
||||
Catch ex As Exception
|
||||
EgtOutLog(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return m_HeightProjectV
|
||||
End Function
|
||||
|
||||
#End Region ' Set
|
||||
|
||||
#Region "Init"
|
||||
|
||||
Reference in New Issue
Block a user