241 lines
8.2 KiB
VB.net
241 lines
8.2 KiB
VB.net
Public Class impctl
|
|
Dim v필드명 As String
|
|
'Dim v_nullvaluevisible As Boolean = True
|
|
|
|
Public Event TimeExpired(ByVal sender As Object, ByVal Status As String)
|
|
''' <summary>
|
|
''' 사용여부
|
|
''' </summary>
|
|
''' <value></value>
|
|
''' <returns></returns>
|
|
''' <remarks></remarks>
|
|
Overloads Property enabled() As Boolean
|
|
Get
|
|
Return Me.ComboBox1.Enabled
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
Me.ComboBox1.Enabled = value
|
|
Me.Label1.Enabled = value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' 데이터가 표시된 포맷을 입력
|
|
''' </summary>
|
|
''' <value></value>
|
|
''' <returns></returns>
|
|
''' <remarks></remarks>
|
|
Public Property 포맷마스크() As String
|
|
Get
|
|
Return Me.TextBox3.Text
|
|
End Get
|
|
Set(ByVal value As String)
|
|
Me.TextBox3.Text = value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' 연결할 필드명입니다.
|
|
''' </summary>
|
|
''' <value></value>
|
|
''' <returns></returns>
|
|
''' <remarks></remarks>
|
|
Public Property 필드명() As String
|
|
Get
|
|
Return v필드명
|
|
End Get
|
|
Set(ByVal value As String)
|
|
v필드명 = value
|
|
End Set
|
|
End Property
|
|
Public Property 제목() As String
|
|
Get
|
|
Return Me.Label1.Text
|
|
End Get
|
|
Set(ByVal value As String)
|
|
Me.Label1.Text = value.Replace("/", vbCrLf)
|
|
End Set
|
|
End Property
|
|
Public Property 문자열자르기() As String
|
|
Get
|
|
Return Me.TextBox2.Text
|
|
End Get
|
|
Set(ByVal value As String)
|
|
Me.TextBox2.Text = value
|
|
End Set
|
|
End Property
|
|
Public Property 열번호() As String
|
|
Get
|
|
Return Me.ComboBox1.Text
|
|
End Get
|
|
Set(ByVal value As String)
|
|
Me.ComboBox1.Text = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Public Function getValue(ByVal Spread As FarPoint.Win.Spread.FpSpread, ByVal RowPos As Integer, Optional ByVal OrgFn As String = "원본파일명", Optional ByVal OrgExt As String = "원본확장자") As String
|
|
Dim SUbidx As Integer
|
|
Dim VALSTR As String
|
|
Dim 파일명 As String
|
|
|
|
If Me.열번호 = "" Then '//즉 없다는뜻이다.
|
|
Return ""
|
|
Else '//있다.
|
|
'//원본파일명과 원본확장가 이 두가지를 처리해야한다.
|
|
|
|
If Me.열번호.Length = 1 Then Return Me.열번호 '//길이 1개짜리는 뭔지모르겟지만 걍 반환
|
|
If Me.열번호.Substring(0, 1) = "#" AndAlso IsNumeric(Me.열번호.Substring(1)) = False Then Return Me.열번호 '//#인데 그 다음이 숫자가 아닐경우는 바로 리턴
|
|
|
|
|
|
If Me.열번호 = "파일명" Then
|
|
VALSTR = OrgFn
|
|
ElseIf Me.열번호 = "확장자" Then
|
|
VALSTR = OrgExt
|
|
ElseIf Me.열번호.Substring(0, 1) <> "#" Then '//열번호도 아니고 원본내용도아니라면 그냥 리턴
|
|
Return Me.열번호
|
|
Else '//이건 열번호를 지정한 경우에해당한다.
|
|
If RowPos > Spread.ActiveSheet.RowCount Then Return "[Err:줄초과]" '//줄번호가 전체 줄번호를 초과할경우
|
|
SUbidx = Me.열번호.Substring(1) '//#을 제외한 컬럼번호만을 가져온다.
|
|
If SUbidx > Spread.ActiveSheet.ColumnCount Then Return "[Err:열초과]" '//지정된 컬럼번호가 전체 컬럼수를 초과할경우
|
|
VALSTR = Spread.ActiveSheet.Cells(RowPos - 1, CInt(SUbidx - 1)).Text
|
|
If VALSTR.Trim = "" Then Return "" '//가져온문자가없으면 리턴
|
|
End If
|
|
|
|
파일명 = VALSTR
|
|
'//이걸로 파일명은 추출했따 이제 자르기만 수행하면된다.
|
|
|
|
If Me.문자열자르기 = "" OrElse Me.문자열자르기 = "0,0" Then '//문자열자르기확인 없다 그대로 리턴
|
|
Return VALSTR
|
|
Else '//문자열자르기가 있으면 잘라서 보내준다.
|
|
Dim DIV(1) As String
|
|
If Me.문자열자르기.IndexOf(",") = -1 Then
|
|
DIV(0) = Me.문자열자르기
|
|
DIV(1) = "0"
|
|
Else
|
|
DIV = Me.문자열자르기.Split(",")
|
|
End If
|
|
|
|
If DIV(1) = "0" Then '//시작부터 끝까지
|
|
Try
|
|
If 파일명.Length < DIV(0) Then
|
|
VALSTR = ""
|
|
Else
|
|
VALSTR = 파일명.Substring(DIV(0) - 1)
|
|
End If
|
|
Catch ex As Exception
|
|
VALSTR = 파일명
|
|
End Try
|
|
Return VALSTR
|
|
|
|
Else '/지정범위
|
|
Try
|
|
VALSTR = 파일명.Substring(DIV(0) - 1, DIV(1))
|
|
Catch ex As Exception
|
|
VALSTR = 파일명
|
|
End Try
|
|
Return VALSTR
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
End Function
|
|
|
|
|
|
Public Sub New()
|
|
|
|
' 이 호출은 Windows Form 디자이너에 필요합니다.
|
|
InitializeComponent()
|
|
|
|
' AddHandler TextBox1.TextChanged, ADDRESS OF
|
|
'AddHandler TextBox1.TextChanged, AddressOf ControlChanged
|
|
' AddHandler Me.DoubleClick, Me.TextBox1.DoubleClick
|
|
'AddHandler Me.TimeExpired, AddressOf timeExp
|
|
|
|
|
|
|
|
End Sub
|
|
Private Sub timeExp(ByVal sender As Object, ByVal stri As String)
|
|
'MsgBox(stri)
|
|
|
|
End Sub
|
|
Private Sub ControlChanged(ByVal sender As Object, ByVal e As System.EventArgs)
|
|
Dim A As TextBox = CType(sender, TextBox)
|
|
If A.Text.Length <= 0 Then Exit Sub
|
|
|
|
Select Case A.Text.Substring(0, 1)
|
|
Case ":"
|
|
If IsNumeric(A.Text.Substring(1)) Then
|
|
A.BackColor = Color.LawnGreen
|
|
Else
|
|
A.BackColor = Color.Tomato
|
|
End If
|
|
Case "?"
|
|
A.BackColor = Color.Gray
|
|
Case "#"
|
|
A.BackColor = Color.SteelBlue
|
|
Case Else
|
|
A.BackColor = Color.White
|
|
End Select
|
|
|
|
End Sub
|
|
|
|
Private Sub UserControl1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick
|
|
RaiseEvent TimeExpired(Me, "sdf")
|
|
End Sub
|
|
|
|
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)
|
|
|
|
RaiseEvent TimeExpired(Me, "sdf")
|
|
End Sub
|
|
|
|
|
|
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Enter
|
|
Me.ComboBox1.SelectAll()
|
|
End Sub
|
|
|
|
|
|
Private Sub TextBox2_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Enter
|
|
Me.TextBox2.SelectAll()
|
|
End Sub
|
|
|
|
Private Sub TextBox2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.GotFocus
|
|
Me.TextBox2.SelectAll()
|
|
' SendKeys.Send("{TAB}")
|
|
End Sub
|
|
|
|
|
|
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
|
|
Me.ComboBox1.SelectAll()
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_STextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged
|
|
'이 컨트롤은 파일관리자용으로 특화된 컨트롤이다.
|
|
'기본적인 입력은 해당 문자열이다
|
|
'#숫자 는 연결시킬 열번호이다. (이것은 푸른색으로한다)
|
|
|
|
Dim A As ComboBox = CType(sender, ComboBox)
|
|
If A.Text.Length <= 0 Then Exit Sub '//입력된 길이가 없다면 리턴
|
|
|
|
|
|
|
|
Select Case A.Text.Substring(0, 1) '//앞자리문자로 구분한다.
|
|
Case "#"
|
|
If Not IsNumeric(A.Text.Substring(1)) Then
|
|
A.BackColor = Color.Tomato
|
|
Else
|
|
A.BackColor = Color.SteelBlue
|
|
End If
|
|
|
|
Case Else
|
|
A.BackColor = Color.White
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
|
|
|
|
End Sub
|
|
End Class
|