421 lines
16 KiB
VB.net
421 lines
16 KiB
VB.net
Imports System
|
|
Public Class C_Epole
|
|
'Structure Str_Alllabels '레이블들을 저장한다.
|
|
' Dim ctl As CEpole.C_label
|
|
' Dim desc As String
|
|
'End Structure
|
|
Enum E_DesignMode
|
|
Shape = 1
|
|
Text = 0
|
|
End Enum
|
|
|
|
Enum E_PatternType
|
|
None = 0
|
|
Length = 1
|
|
Character = 2
|
|
End Enum
|
|
Enum E_LineType
|
|
Union = 0
|
|
Separate = 1
|
|
sum = 2
|
|
None = -1
|
|
End Enum
|
|
Enum E_PaperOrient
|
|
세로 = 0
|
|
가로 = 1
|
|
End Enum
|
|
Enum E_useNotUse
|
|
사용 = 1
|
|
사용안함 = 0
|
|
End Enum
|
|
Enum E_Dummytype
|
|
현재복사 = 0
|
|
다음출력 = 1
|
|
End Enum
|
|
|
|
|
|
Public Enum EQR_Incoding
|
|
AlphaNumeric
|
|
Numeric
|
|
[Byte]
|
|
End Enum
|
|
|
|
Public Enum EQR_Version
|
|
v1
|
|
v2
|
|
v3
|
|
v4
|
|
v5
|
|
v6
|
|
v7
|
|
v8
|
|
v9
|
|
v10
|
|
v11
|
|
v12
|
|
v13
|
|
v14
|
|
v15
|
|
v16
|
|
v17
|
|
v18
|
|
v19
|
|
v20
|
|
v21
|
|
v22
|
|
v23
|
|
v24
|
|
v25
|
|
v26
|
|
v27
|
|
v28
|
|
v29
|
|
v30
|
|
v31
|
|
v32
|
|
v33
|
|
v34
|
|
v35
|
|
v36
|
|
v37
|
|
v38
|
|
v39
|
|
v40
|
|
End Enum
|
|
|
|
Public Enum EQR_CLEVE
|
|
L
|
|
M
|
|
Q
|
|
H
|
|
End Enum
|
|
|
|
Structure S_FullLable
|
|
Dim Desc As String '//레이블의설명
|
|
Dim Si As Short '//레이블의 시작인덱스 alllabels 의 오프셋이다.
|
|
Dim Ei As Short '//레이블의 종료인덱스 alllabels 의 오프셋이다.
|
|
Dim text As String '//전체문자열이 들어있음
|
|
Dim Pattern As String '//패턴네임을 적는다.
|
|
Dim Tag As String '//개체태그입력
|
|
Dim LineType As E_LineType '//0혼함 1분리 2통합
|
|
Dim NumType As String '//번호형식 9,9,9 의 형식을 보통띈다.
|
|
Dim LineMaxChar As Short '//한줄에 최대몇자를 기본으로할때 혼합시 줄의 갯수에 사용한다.
|
|
Dim ApplyPattern As E_PatternType '//0없음 1길이 2문자
|
|
Dim Moved As Boolean '//이동했는지
|
|
Dim CheckBox As Windows.Forms.ToolStripMenuItem '//이것과 연계된 체크박스
|
|
' Dim SeparatePattern As Boolean '//개별문자에대한 패턴을 적용할지 여부
|
|
Dim Fixed As Boolean '//고정문자열이있는지
|
|
End Structure
|
|
|
|
Structure SStyle
|
|
Dim Desc As String
|
|
Dim File As String
|
|
Dim Backimg As String
|
|
Dim MarginX As Integer
|
|
Dim MarginY As Integer
|
|
Dim ScaleX As Single
|
|
Dim ScaleY As Single
|
|
Dim PrintFontOffset As Integer
|
|
Dim Viewimage As Boolean
|
|
Dim LandScape As Boolean
|
|
|
|
Dim Dummy As Boolean
|
|
Dim DummyCnt As Short
|
|
Dim Dummytype As Short
|
|
Dim dummmyx As Short
|
|
Dim dummmyy As Short
|
|
|
|
Dim visible As Boolean '//190223
|
|
Dim RowDivCnt As Short '170715
|
|
Dim rowdivx As Short
|
|
Dim rowdivy As Short
|
|
Dim DrawItemRepeat As Boolean
|
|
|
|
Dim picstyle As Short
|
|
Dim CanvasX As Integer
|
|
Dim CanvasY As Integer
|
|
Dim Filter As String
|
|
Dim PATTERNTABLE As DataTable
|
|
Dim FixedStyle As Boolean
|
|
Dim PrintRange As String
|
|
End Structure
|
|
|
|
Structure SCStyle
|
|
Dim Margin As System.Drawing.Point '//인쇄여백
|
|
Dim Scale As System.Drawing.Point '//인쇄확대비율
|
|
Dim Orient As E_PaperOrient '//종이방향
|
|
Dim DummyMargin As System.Drawing.Point
|
|
Dim Dummy As E_useNotUse
|
|
Dim UseBG As E_useNotUse
|
|
Dim PrnBG As E_useNotUse
|
|
Dim Dummytype As E_Dummytype '//현재복사,다음출력
|
|
End Structure
|
|
|
|
Enum e_EventMessage
|
|
Normal = 0
|
|
Parse = 1
|
|
End Enum
|
|
Enum E_PrintRange
|
|
All = 0
|
|
Current = 1
|
|
Custom = 2
|
|
FixedStyle = 3
|
|
End Enum
|
|
Enum E_DrawType
|
|
Box = 0
|
|
Line = 1
|
|
End Enum
|
|
Structure S_Line
|
|
Dim X As Single
|
|
Dim Y As Single
|
|
Dim X2 As Single
|
|
Dim Y2 As Single
|
|
Dim PenColor As Drawing.Color
|
|
Dim PenWidth As Single
|
|
End Structure
|
|
Structure S_Box
|
|
Dim X As Single
|
|
Dim Y As Single
|
|
Dim Width As Single
|
|
Dim Height As Single
|
|
Dim PenColor As Drawing.Color
|
|
Dim PenWidth As Single
|
|
Dim Radius As Single '//휘어짐수치
|
|
End Structure
|
|
Structure S_Circle
|
|
Dim X As Single
|
|
Dim Y As Single
|
|
Dim Width As Single
|
|
Dim Height As Single
|
|
Dim PenColor As Drawing.Color
|
|
Dim PenWidth As Single
|
|
'Dim Radius As Single '//휘어짐수치
|
|
End Structure
|
|
Structure S_Image
|
|
Dim X As Single
|
|
Dim Y As Single
|
|
Dim Width As Single
|
|
Dim Height As Single
|
|
Dim FileName As String
|
|
End Structure
|
|
|
|
Structure S_QRCode
|
|
Dim X As Single
|
|
Dim Y As Single
|
|
Dim Width As Single
|
|
Dim Height As Single
|
|
Dim QRData As String '//표시하고자하는 데이터를 표시 {필드명} 으로 대체가능
|
|
Dim Encoding As Integer
|
|
Dim Version As Integer
|
|
Dim CLeve As Integer
|
|
Dim Size As Integer
|
|
Dim Format As String '//출력포맷
|
|
Dim fColor As System.Drawing.Color
|
|
Dim bColor As System.Drawing.Color
|
|
End Structure
|
|
|
|
Structure S_DrawShape
|
|
Dim DrawType As E_DrawType
|
|
Dim DrawObject As Object
|
|
Public Sub New(ByVal DT As E_DrawType, ByVal Obj As Object, ByVal oldtype As Boolean)
|
|
DrawType = DT
|
|
DrawObject = Obj
|
|
End Sub
|
|
End Structure
|
|
Public Shared Function Get_SavePatternString(ByVal 저장대상 As String, ByVal pc As Boolean, ByVal cp As String, ByVal pl As Boolean, ByVal pstr As String, ByVal plen As Short, _
|
|
ByVal pchr As String) As System.Text.StringBuilder
|
|
|
|
If pc Then cp = "[문자패턴]"
|
|
If pl Then cp &= "[길이패턴]"
|
|
If cp = "" Then cp = "[패턴없음]"
|
|
|
|
Dim Msg As New System.Text.StringBuilder("(" & 저장대상 & ")" & " 패턴을 저장합니다")
|
|
'//문자패턴이 적용되어있다면 문자패턴으로 적용할 것을 궎장하며 그렇지 않은 경우에는 길이패턴이나 문자패턴을 적절히 권장한다.
|
|
'//길이가 5자리이하이고 특수문자(-,;)등이 없는경우에 길이패턴 적용을 권유한다.
|
|
Msg.AppendLine()
|
|
Msg.AppendLine("패턴 저장방법에는 길이,문자가 있습니다")
|
|
Msg.AppendLine("패턴우선순위 : 문자패턴 -> 길이패턴")
|
|
Msg.AppendLine()
|
|
Msg.AppendLine("현재적용된 패턴 : " & cp)
|
|
|
|
If pc Then
|
|
Msg.AppendLine()
|
|
Msg.AppendLine(">> 현재 문자패턴이 적용되어있습니다" & vbCrLf & ">> 문자패턴은 가장우선되는 패턴방식입니다")
|
|
Msg.AppendLine(">> 저장시에는 [문자패턴]으로 저장하시기 바랍니다.")
|
|
Msg.AppendLine(">> [길이패턴]으로 저장하는것은 의미가 없습니다")
|
|
ElseIf pl Then
|
|
Msg.AppendLine()
|
|
Msg.AppendLine(">> 현재 길이패턴이 적용되어있습니다" & vbCrLf & ">> 패턴은 길이,문자 둘다 저장이 가능합니다")
|
|
Else
|
|
Msg.AppendLine()
|
|
Msg.AppendLine(">> 적용된 패턴이없습니다")
|
|
Msg.AppendLine(">> 문자수(길이)가 적은 문자의경우 [길이패턴] 저장을 권장합니다")
|
|
End If
|
|
Msg.AppendLine()
|
|
Msg.AppendLine("길이패턴이란? (문자의 길이가 같을떄 적용)")
|
|
Msg.AppendLine(" 선택된문자는 " & pstr & " 이며 길이는 = " & plen & " 입니다")
|
|
Msg.AppendLine(" 저장을 하면 " & 저장대상 & " 의 길이가 " & plen & vbCrLf & " 인 문자가 오면 패턴이 적용됩니다")
|
|
|
|
Msg.AppendLine()
|
|
Msg.AppendLine("문자패턴이란? (같은 형태의 문자일때 적용)")
|
|
Msg.AppendLine(" 선택된문자는 " & pstr & " 이며 형태는 = " & pchr & " 입니다")
|
|
Msg.AppendLine(" 저장을 하면 " & 저장대상 & " 의 형태가 " & pchr & vbCrLf & " 인 문자가 오면 패턴이 적용됩니다")
|
|
Msg.AppendLine(" * 1=숫자,0=알파벳문자,H=한글문자,;=특수문자(;),-=특수문자(-)")
|
|
|
|
Msg.AppendLine()
|
|
Msg.AppendLine("패턴우선순위란? (패턴이 중복적용되었을때 높은우선순위가 적용)")
|
|
Msg.AppendLine(" 길이,문자 패턴이 둘다 적용되어있을경우 우선순위가 높은")
|
|
Msg.AppendLine(" 문자패턴이 최종적으로 적용이 됩니다.(길이패턴은 무시됨)")
|
|
|
|
Msg.AppendLine()
|
|
Msg.AppendLine("# 길이패턴으로 저장하시겠습니까?")
|
|
Msg.AppendLine("# 예) 길이저장 , 아니오) 문자저장 , 취소) 취소")
|
|
If pc Then Msg.AppendLine("# 문자패턴이 적용되었으므로 [길이패턴] 저장은 의미가 없습니다")
|
|
Return Msg
|
|
End Function
|
|
|
|
Public Shared Sub GetAllsection(ByRef stylelist() As SStyle, ByVal FILENAME As String, ByVal CurIdx As Short, ByVal OldType As Boolean)
|
|
'//이제 OLD는 사용하징낳는다 3월14일 변경한다.
|
|
If OldType = False Then
|
|
FileToDataTable.ReadFile_New(stylelist, FILENAME, CurIdx)
|
|
Else
|
|
'MsgBox("구파일" & FILENAME)
|
|
FileToDataTable.ReadFile_OLD(stylelist, FILENAME, CurIdx)
|
|
End If
|
|
End Sub
|
|
|
|
Public Shared Function PATTERN_ENC(ByVal SRCSTR As String, Optional hsave As Boolean = False) As String
|
|
Dim MSG As New System.Text.StringBuilder
|
|
For Each A As Char In SRCSTR.ToCharArray '//모든문자의 숫자번호를 판별한다.
|
|
|
|
If hsave Then
|
|
If A = ";" Then '//구분자라면
|
|
MSG.Append(";")
|
|
ElseIf A = "H" Then '//h문자별도 처리해줌
|
|
MSG.Append("Z")
|
|
ElseIf A = "-" Then
|
|
MSG.Append("-")
|
|
ElseIf Char.IsNumber(A) Then
|
|
MSG.Append("1")
|
|
ElseIf Asc(A) < 0 Then
|
|
MSG.Append("H")
|
|
Else
|
|
MSG.Append("0")
|
|
End If
|
|
Else
|
|
If A = ";" Then '//구분자라면
|
|
MSG.Append(";")
|
|
ElseIf A = "-" Then
|
|
MSG.Append("-")
|
|
ElseIf Char.IsNumber(A) Then
|
|
MSG.Append("1")
|
|
ElseIf Asc(A) < 0 Then
|
|
MSG.Append("H")
|
|
Else
|
|
MSG.Append("0")
|
|
End If
|
|
End If
|
|
|
|
Next
|
|
Return MSG.ToString
|
|
End Function
|
|
|
|
Public Shared Function GetPrintersName() As ArrayList
|
|
Dim value As Drawing.Printing.PrinterSettings.StringCollection = System.Drawing.Printing.PrinterSettings.InstalledPrinters
|
|
Dim Retval As New ArrayList
|
|
For i As Integer = 0 To value.Count - 1
|
|
Retval.Add(value(i))
|
|
Next
|
|
Return Retval
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' 데이터와 출력장수(전체,현재,범위,고정스타일)를 판단하여 T,F 반환한다.
|
|
''' </summary>
|
|
''' <param name="Dv"></param>
|
|
''' <param name="CurrPos"></param>
|
|
''' <param name="PrintArray"></param>
|
|
''' <param name="RangeType"></param>
|
|
''' <param name="UserRange"></param>
|
|
''' <returns></returns>
|
|
''' <remarks></remarks>
|
|
Public Shared Function Set_PrnRange(ByRef Dv As DataView, ByVal CurrPos As Integer, ByRef PrintArray() As Integer, ByVal RangeType As E_PrintRange, ByVal UserRange As String) As Boolean '//범위내의 페이지번호와 일치하는 번호를 찾아서 배열에 할당한다.
|
|
Dim Number As Integer = 0
|
|
Dim FindNum As Boolean = False
|
|
'printindex = 0 '//배열의 첫번으로 출력을 준비한다.
|
|
|
|
ReDim PrintArray(0)
|
|
PrintArray(0) = 1
|
|
|
|
If RangeType = E_PrintRange.Custom AndAlso UserRange = "" Then RangeType = E_PrintRange.Current
|
|
|
|
' MsgBox("rane : " & Dv.Count & "curpos:" & CurrPos)
|
|
|
|
Select Case RangeType
|
|
Case E_PrintRange.FixedStyle '//고정스타일이라면 userrange 에 할당된 숫자만큼 버퍼를 생성한다.
|
|
If IsNumeric(UserRange) = False Then
|
|
MsgBox("출력장수에 숫자만 입력하세요", MsgBoxStyle.Critical, "확인")
|
|
Return False
|
|
End If
|
|
ReDim PrintArray(Val(UserRange) - 1)
|
|
For i As Integer = 0 To Val(UserRange) - 1
|
|
PrintArray(i) = CurrPos
|
|
Next
|
|
Case E_PrintRange.All
|
|
ReDim PrintArray(Dv.Count - 1)
|
|
For i As Integer = 0 To Dv.Count - 1
|
|
PrintArray(i) = i
|
|
Next
|
|
Case E_PrintRange.Current
|
|
' MsgBox("현재")
|
|
ReDim PrintArray(0)
|
|
PrintArray(0) = CurrPos '/현재카운트보다 1작다 배열은 0부터 시작하기떄문에
|
|
Case E_PrintRange.Custom
|
|
Dim buff As String = UserRange
|
|
ReDim PrintArray(0) : PrintArray(0) = -1
|
|
'//먼저 -가 있나없나 판단해서 한페이지용인지 범위용인지 구분한다.
|
|
If buff.IndexOf("-") >= 0 Then '//범위이다.
|
|
Dim SubBuff() As String = buff.Split("-")
|
|
Dim Sttnum As Integer = CInt(SubBuff(0)) '//시작
|
|
Dim endnum As Integer = CInt(SubBuff(1)) '//종료값
|
|
|
|
For SI As Integer = 0 To endnum - Sttnum '//범위갯수만큼 돈다
|
|
FindNum = False
|
|
Number = CInt(Sttnum + SI) '//페이지만 적엇을 것이므로
|
|
For ni As Integer = 0 To Dv.Count - 1 '//현재뷰의 모든데이터를 가지고 검색한다 좌->우 순차검색
|
|
If Number = Dv(ni).Row("번호") Then
|
|
If PrintArray(0) = -1 Then '//처음데이터이므로
|
|
PrintArray(0) = ni
|
|
Else '//처음이아니므로 배열을 증가시키고 기입한다.
|
|
ReDim Preserve PrintArray(PrintArray.GetUpperBound(0) + 1) '//배열1증가
|
|
PrintArray(PrintArray.GetUpperBound(0)) = ni
|
|
End If
|
|
FindNum = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
Next
|
|
|
|
Else '//페이지번호만 적었을때다
|
|
If IsNumeric(buff) Then
|
|
Number = CInt(buff) '//페이지만 적엇을 것이므로
|
|
For ni As Integer = 0 To Dv.Count - 1 '//현재뷰의 모든데이터를 가지고 검색한다 좌->우 순차검색
|
|
If Number = Dv(ni).Row("번호") Then
|
|
PrintArray(0) = ni
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
MsgBox("범위(-)를 제외하고 숫자만 입력하세요", MsgBoxStyle.Critical, "입력오류")
|
|
End If
|
|
End If
|
|
End Select
|
|
If PrintArray(0) = -1 Then '//배열에 아무것도 없다면
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
End Class
|