Public Class MyFpoint Inherits FarPoint.Win.Spread.FpSpread Private v_AAutoAddrowInLast As ToolStripButton = Nothing Private V_enterToTab As Boolean = False Private V_DeleteKey As Boolean = False Private V_CurrentDel As Boolean = False Private V_FIRSTINDEX As Integer = 0 Private V_NextRowindex As Integer = -1 Private A_Ubound As New ArrayList Private V_SpaceEdit As Boolean = True Private V_sameRHeight As Boolean = True Private V_¼±ÅÃÁÙ¹øÈ£ As Int16 = -1 _ Public Property AAutoAddrowInLast() As ToolStripButton Get Return Me.v_AAutoAddrowInLast End Get Set(ByVal value As ToolStripButton) Me.v_AAutoAddrowInLast = value End Set End Property _ Public Property ¼±ÅÃÁÙ¹øÈ£() As Int16 Get Return V_¼±ÅÃÁÙ¹øÈ£ End Get Set(ByVal value As Int16) V_¼±ÅÃÁÙ¹øÈ£ = value End Set End Property _ Public Property SameRowheight() As Boolean Get Return V_sameRHeight End Get Set(ByVal value As Boolean) V_sameRHeight = value End Set End Property _ Public Property EditFromSpace() As Boolean Get Return V_SpaceEdit End Get Set(ByVal value As Boolean) V_SpaceEdit = value End Set End Property ''' ''' Áߺ¹µÈ µ¥ÀÌÅ͸¦ °Ë»öÇÕ´Ï´Ù. startindex = ½ÃÀÛÇÒ ÁÙ¹øÈ£,endindex = Á¾·áÇÒ ÁÙ¹øÈ£, source °Ë»ö¿øº»ÀÇ ¿­¹øÈ£µé, target °Ë»ö´ë»óÀÇ ¿­¹øÈ£µé ''' °Ë»ö¿Ï·áÈÄ Àüü Áߺ¹µÈ °¹¼ö¸¦ ¸®ÅÏÇÕ´Ï´Ù. ''' ''' ''' ''' ''' ''' ''' Public Function Áߺ¹°Ë»ç(ByVal StartIndex As Integer, ByVal EndIndex As Integer, ByVal Source() As Short, ByVal Tartger() As Short, Optional ByVal CheckColnum As Short = -1, Optional ByVal PBar As ProgressBar = Nothing) As Integer '''''°Ë»ö¹æ¹ýÀº 1¹ø°³Ã¼ºÎÅÍ ¸¶Áö¸·°³Ã¼±îÁö Ç®·çÇÁ¸¦ µ¹¸é¼­ µ¿ÀÏÇÑ ³ðÀ» ã´Â´Ù. Dim ¿øº», ´ë»ó As String 'New System.Text.StringBuilder Dim fcnt As Integer = 0 If Not PBar Is Nothing Then PBar.Value = StartIndex PBar.Minimum = StartIndex PBar.Maximum = EndIndex End If 'NOTICE("Áߺ¹µÇ´Â [ÀüÁÖ¹øÈ£]¸¦ ã´ÂÁßÀÔ´Ï´Ù...", Me.lb_msg) 'Me.Invalidate() For A As Integer = StartIndex To EndIndex ¿øº» = "" For Each T As Short In Source ¿øº» &= Me.ActiveSheet.Cells(A, T).Value Next If ¿øº».ToString <> "" Then For B As Integer = StartIndex To EndIndex If A <> B Then '//°°Àº¶óÀÎÀº ÇÇÇÏ°í ±×·¸Áö ¾ÊÀº ¶óÀÎÀÇ ¹øÈ£¸¦ È®ÀÎÇÑ´Ù. ´ë»ó = "" For Each T As Short In Tartger ´ë»ó &= Me.ActiveSheet.Cells(B, T).Value Next If ¿øº».ToString = ´ë»ó.ToString Then 'MsgBox(¿øº») fcnt += 1 If CheckColnum > -1 Then Me.ActiveSheet.Cells(A, CheckColnum).Value = True Me.ActiveSheet.Cells(B, CheckColnum).Value = True End If End If End If Next End If If Not PBar Is Nothing Then If PBar.Value < PBar.Maximum Then PBar.Value += 1 Me.Invalidate() End If Next Return fcnt 'NOTICE("[ÀüÁÖ¹øÈ£] Áߺ¹°Ë»ç ¿Ï·á(" & fcnt & "°³ÀÇ µ¥ÀÌÅ͸¦ ã¾Ò½À´Ï´Ù)", Me.lb_msg) End Function ''' ''' Áߺ¹µÈ µ¥ÀÌÅ͸¦ °Ë»öÇÕ´Ï´Ù. startindex = ½ÃÀÛÇÒ ÁÙ¹øÈ£,endindex = Á¾·áÇÒ ÁÙ¹øÈ£, source °Ë»ö¿øº»ÀÇ ¿­¹øÈ£µé, target °Ë»ö´ë»óÀÇ ¿­¹øÈ£µé ''' °Ë»ö¿Ï·áÈÄ Àüü Áߺ¹µÈ °¹¼ö¸¦ ¸®ÅÏÇÕ´Ï´Ù. ''' ''' ''' ''' ''' ''' ''' Public Function Áߺ¹°Ë»ç2(ByVal StartIndex As Integer, ByVal EndIndex As Integer, ByVal Source() As Short, ByVal Tartger() As Short, Optional ByVal CheckColnum As Short = -1, Optional ByVal PBar As ProgressBar = Nothing) As Integer '''''°Ë»ö¹æ¹ýÀº 1¹ø°³Ã¼ºÎÅÍ ¸¶Áö¸·°³Ã¼±îÁö Ç®·çÇÁ¸¦ µ¹¸é¼­ µ¿ÀÏÇÑ ³ðÀ» ã´Â´Ù. Dim ¿øº», ´ë»ó As String 'New System.Text.StringBuilder Dim fcnt As Integer = 0 If Not PBar Is Nothing Then PBar.Value = StartIndex PBar.Minimum = StartIndex PBar.Maximum = EndIndex End If For A As Integer = StartIndex To EndIndex ¿øº» = "" For Each T As Short In Source ¿øº» &= Me.ActiveSheet.Cells(A, T).Value Next If ¿øº».Trim.ToString <> "" Then For B As Integer = StartIndex To EndIndex If A <> B Then '//°°Àº¶óÀÎÀº ÇÇÇÏ°í ±×·¸Áö ¾ÊÀº ¶óÀÎÀÇ ¹øÈ£¸¦ È®ÀÎÇÑ´Ù. ´ë»ó = "" For Each T As Short In Tartger ´ë»ó &= Me.ActiveSheet.Cells(B, T).Value Next If ¿øº».Trim.ToString = ´ë»ó.Trim.ToString Then fcnt += 1 If CheckColnum > -1 Then Me.ActiveSheet.Cells(A, CheckColnum).Value = True Me.ActiveSheet.Cells(B, CheckColnum).Value = True End If End If End If Next End If If Not PBar Is Nothing Then If PBar.Value < PBar.Maximum Then PBar.Value += 1 Me.Invalidate() End If Next Return fcnt 'NOTICE("[ÀüÁÖ¹øÈ£] Áߺ¹°Ë»ç ¿Ï·á(" & fcnt & "°³ÀÇ µ¥ÀÌÅ͸¦ ã¾Ò½À´Ï´Ù)", Me.lb_msg) End Function Public Function Áߺ¹°Ë»ç°°ÀºÁÙ(ByVal StartIndex As Integer, ByVal EndIndex As Integer, ByVal Source() As Short, ByVal Tartger() As Short, Optional ByVal CheckColnum As Short = -1, Optional ByVal PBar As ProgressBar = Nothing, Optional ByVal TrueDirection As Boolean = True) As Integer Dim ¿øº», ´ë»ó As String 'New System.Text.StringBuilder Dim fcnt As Integer = 0 Dim Can As Boolean = False If Not PBar Is Nothing Then : PBar.Value = StartIndex : PBar.Minimum = StartIndex : PBar.Maximum = EndIndex : End If For A As Integer = StartIndex To EndIndex ¿øº» = "" : ´ë»ó = "" Can = False For Each T As Short In Source ¿øº» &= Me.ActiveSheet.Cells(A, T).Value Next For Each T As Short In Tartger ´ë»ó &= Me.ActiveSheet.Cells(A, T).Value Next If ¿øº».Trim.ToString <> "" Then If TrueDirection = True Then If ¿øº».Trim.ToString = ´ë»ó.Trim.ToString Then Can = True Else If ¿øº».Trim.ToString <> ´ë»ó.Trim.ToString Then Can = True End If If Can Then fcnt += 1 If CheckColnum > -1 Then Me.ActiveSheet.Cells(A, CheckColnum).Value = True End If End If If Not PBar Is Nothing Then If PBar.Value < PBar.Maximum Then PBar.Value += 1 Me.Invalidate() End If Next Return fcnt End Function Public Function Áߺ¹°Ë»ç°°ÀºÁÙ°ø¶õÆ÷ÇÔ(ByVal StartIndex As Integer, ByVal EndIndex As Integer, ByVal Source() As Short, ByVal Tartger() As Short, Optional ByVal CheckColnum As Short = -1, Optional ByVal PBar As ProgressBar = Nothing, Optional ByVal TrueDirection As Boolean = True) As Integer Dim ¿øº», ´ë»ó As String 'New System.Text.StringBuilder Dim fcnt As Integer = 0 Dim Can As Boolean = False If Not PBar Is Nothing Then : PBar.Value = StartIndex : PBar.Minimum = StartIndex : PBar.Maximum = EndIndex : End If For A As Integer = StartIndex To EndIndex ¿øº» = "" : ´ë»ó = "" Can = False For Each T As Short In Source ¿øº» &= Me.ActiveSheet.Cells(A, T).Text Next For Each T As Short In Tartger ´ë»ó &= Me.ActiveSheet.Cells(A, T).Text Next If TrueDirection = True Then If ¿øº».Trim.ToString = ´ë»ó.Trim.ToString Then Can = True Else If ¿øº».Trim.ToString <> ´ë»ó.Trim.ToString Then Can = True End If If Can Then fcnt += 1 If CheckColnum > -1 Then Me.ActiveSheet.Cells(A, CheckColnum).Value = True End If If Not PBar Is Nothing Then If PBar.Value < PBar.Maximum Then PBar.Value += 1 Me.Invalidate() End If Next Return fcnt End Function ''' ''' »ç¿ëÇÏÁö ¾Ê´Â°É ±ÇÀåÇÕ´Ï´Ù( À̸í·ÉÀº insertNewrow ·Î »ç¿ëÇÏ±æ ±ÇÀåÇÕ´Ï´Ù.) ''' ''' ''' Public Function AddRowsU() As Integer Dim Idx As Integer With Me.ActiveSheet If .RowCount <= 0 Then '//µ¥ÀÌÅͰ¡ ¾Æ¿¡¾ø´Ù¸é Idx = 0 .AddUnboundRows(Idx, 1) .Rows(Idx).Tag = "UNBOUND" .ActiveRowIndex = 0 .ActiveColumnIndex = Me.FIRST_FOCUSINDEX A_Ubound.Add(Idx) Else Idx = IIf(.ActiveRow.Index < 0, 0, .ActiveRow.Index) .AddUnboundRows(Idx, 1) .Rows(Idx).Tag = "UNBOUND" A_Ubound.Add(Idx) End If End With Return Idx End Function ''' ''' ÇöÀçÀ§Ä¡ À§¿¡ »õ·Î¿î ÇàÀ» Ãß°¡ÇÕ´Ï´Ù(¹Ù¿îµå Àû¿ëµÊ) ''' ''' Public Sub Arin_InsertNewRow() If Not Me.Focused Then Me.Focus() Me.ActiveSheet.Rows.Add(Me.ActiveSheet.ActiveRowIndex, 1) Me.ActiveSheet.SetActiveCell(Me.ActiveSheet.ActiveRowIndex, Me.FIRST_FOCUSINDEX) End Sub ''' ''' ¸¶Áö¸·¿¡ »õ·Î¿î ÇàÀ» Ãß°¡ÇÕ´Ï´Ù(¹Ù¿îµå Àû¿ëµÊ) ''' ''' Public Sub Arin_AddNewRow() If Not Me.Focused Then Me.Focus() Me.ActiveSheet.Rows.Add(Me.ActiveSheet.RowCount, 1) Me.ActiveSheet.SetActiveCell(Me.ActiveSheet.RowCount, Me.FIRST_FOCUSINDEX) SendKeys.Send("{ENTER}") End Sub ''' ''' ¸¶Áö¸·¿¡ »õ·Î¿î ÇàÀ» Ãß°¡ÇÕ´Ï´Ù.(¹Ù¿îµåÀû¿ë¾ÈµÊ) ''' ''' Public Sub Arin_AddNewRowU() If Not Me.Focused Then Me.Focus() Dim Idx As Integer Me.ActiveSheet.AddUnboundRows(Me.ActiveSheet.RowCount, 1) Idx = Me.ActiveSheet.RowCount - 1 Me.ActiveSheet.Rows(Idx).Tag = "UNBOUND" Me.ActiveSheet.SetActiveCell(Me.ActiveSheet.RowCount, Me.FIRST_FOCUSINDEX) SendKeys.Send("{ENTER}") End Sub Public Function NewRowsU() As Integer Dim Idx As Integer Me.ActiveSheet.AddUnboundRows(Me.ActiveSheet.RowCount, 1) Idx = Me.ActiveSheet.RowCount - 1 Me.ActiveSheet.Rows(Idx).Tag = "UNBOUND" A_Ubound.Add(Idx) '--¾ð¹Ù¿îµå¸ñ·Ï¿¡ Á¦¿Ü½ÃÄѹö¸°´Ù Return Idx End Function Public Sub Attach_Ubound(Optional ByVal NullChkColnum As Integer = -1) ' MsgBox(A_Ubound.Count) Dim nullVal As Boolean = False For Each A As Integer In A_Ubound Try If Me.ActiveSheet.Rows(CInt(A)).Tag = "UNBOUND" Then '//¾ð¹Ù¿îµåµÈ¿­Àϰæ¿ì¿¡¸¸ If NullChkColnum > -1 Then nullVal = True For z As Integer = NullChkColnum To Me.ActiveSheet.ColumnCount - 1 If Me.ActiveSheet.Cells(A, z).Text <> "" Then 'MsgBox(Me.ActiveSheet.Cells(A, z).Text) nullVal = False Exit For End If Next End If If Not nullVal Then Me.ActiveSheet.AddRowToDataSource(CInt(A), True) End If Catch ex As Exception MsgBox("[Err]Add-Unbound Row" & vbCrLf & ex.Message.ToString) End Try Next A_Ubound.Clear() End Sub _ Public Property NextRow_Index() As Integer Get Return V_NextRowindex End Get Set(ByVal value As Integer) V_NextRowindex = value End Set End Property _ Public Property FIRST_FOCUSINDEX() As Integer Get Return V_FIRSTINDEX End Get Set(ByVal value As Integer) V_FIRSTINDEX = value End Set End Property _ Public Property CurrentDel() As Boolean Get Return V_CurrentDel End Get Set(ByVal value As Boolean) V_CurrentDel = value End Set End Property _ Public Property DeleteKey() As Boolean Get Return V_DeleteKey End Get Set(ByVal value As Boolean) V_DeleteKey = value End Set End Property ''' ''' ÀÔ·ÂµÈ ÁÙ¹øÈ£¿Í ű×=µ¥ÀÌÅÍÇÊµå °¡ ÀÏÄ¡ÇÏ´Â ¼¿À» ¹ÝȯÇÕ´Ï´Ù. ''' ''' ''' ''' ''' ''' Public Function Cells(ByVal index As Integer, ByVal Tag As Object, Optional ByVal Sheetindex As Integer = -1) As FarPoint.Win.Spread.Cell Dim RetVal As FarPoint.Win.Spread.Cell = Nothing If Sheetindex = -1 Then Sheetindex = Me.ActiveSheetIndex For Each SC As FarPoint.Win.Spread.Column In Me.Sheets(Sheetindex).Columns If SC.DataField.ToUpper = Tag.ToString.ToUpper Then RetVal = Me.Sheets(Sheetindex).Cells(index, SC.Index) Exit For End If Next If RetVal Is Nothing Then MsgBox("Can't Find column [" & Tag.ToString & "]", MsgBoxStyle.Critical, "Farpoint function Cells") End If Return RetVal End Function ''' ''' ÇöÀç¼±ÅÃµÈ ÁÙÀÇ ¿­¹øÈ£¿¡ÇØ´çÇÏ´Â ¼¿À» ¹ÝȯÇÕ´Ï´Ù. ''' ''' ''' ''' ''' Public Function Cells(ByVal Columnindex As Integer, Optional ByVal Sheetindex As Integer = -1) As FarPoint.Win.Spread.Cell Dim RetVal As FarPoint.Win.Spread.Cell = Nothing If Sheetindex = -1 Then Sheetindex = Me.ActiveSheetIndex Return Me.Sheets(Sheetindex).Cells(Me.ActiveSheet.ActiveRowIndex, Columnindex) Return RetVal End Function ''' ''' ÇöÀç¼±ÅÃµÈ ¼¿À» ¹ÝȯÇÕ´Ï´Ù ''' ''' ''' Public Function Cells() As FarPoint.Win.Spread.Cell Dim RetVal As FarPoint.Win.Spread.Cell = Nothing Return Me.ActiveSheet.ActiveCell End Function Public Function ActiveCell() As FarPoint.Win.Spread.Cell Dim RetVal As FarPoint.Win.Spread.Cell = Nothing Return Me.ActiveSheet.ActiveCell End Function ''' ''' ÀüÁÙÀÇ ÇöÀç¿­À§Ä¡ ¼¿À» ¹Ýȯ ''' ''' ''' ''' Public Function PreRCells(Optional ByVal FirstrowValueisNothing As Boolean = False) As FarPoint.Win.Spread.Cell If FirstrowValueisNothing AndAlso Me.ActiveRowindex = 0 Then Return Nothing If Me.ActiveRowindex = 0 Then If FirstrowValueisNothing Then Return Nothing Else Return Me.ActiveSheet.ActiveCell End If Else Return Me.ActiveSheet.Cells(Me.ActiveRowindex - 1, Me.ActiveColumnindex) End If End Function ''' ''' ¾Õ¼¿À» ¹Ýȯ ''' ''' ''' ''' Public Function PreCells(Optional ByVal FirstColValueisNothing As Boolean = False) As FarPoint.Win.Spread.Cell If FirstColValueisNothing AndAlso Me.ActiveColumnindex = 0 Then Return Nothing If Me.ActiveColumnindex = 0 Then If FirstColValueisNothing Then Return Nothing Else Return Me.ActiveSheet.ActiveCell End If Else Return Me.ActiveSheet.Cells(Me.ActiveRowindex, Me.ActiveColumnindex - 1) End If End Function ''' ''' ÀÔ·ÂµÈ ÅÂ±×¿Í µ¥ÀÌÅÍÇʵ尡 ÀÏÄ¡ÇÏ´Â ¼¿À» ¹ÝȯÇÕ´Ï´Ù.(ÁÙ¹øÈ£´Â ÇöÀçÁÙ) ''' ''' ''' ''' ''' Public Function Cells(ByVal Tag As Object, Optional ByVal Sheetindex As Integer = -1) As FarPoint.Win.Spread.Cell Dim RetVal As FarPoint.Win.Spread.Cell = Nothing If Sheetindex = -1 Then Sheetindex = Me.ActiveSheetIndex For Each SC As FarPoint.Win.Spread.Column In Me.Sheets(Sheetindex).Columns If SC.DataField.ToUpper = Tag.ToString.ToUpper Then RetVal = Me.Sheets(Sheetindex).Cells(Me.ActiveRowindex, SC.Index) Exit For End If Next If RetVal Is Nothing Then MsgBox("Can't Find column [" & Tag.ToString & "]", MsgBoxStyle.Critical, "Farpoint function Cells") End If Return RetVal End Function ''' ''' Ȱ¼ºÈ­µÈ ¿­Á¦¸ñÁÙÀ» ¹ÝȯÇÕ´Ï´Ù. ''' ''' ''' Public Function ActiveColumn() As FarPoint.Win.Spread.Column Return Me.ActiveSheet.Columns(Me.ActiveColumnindex) End Function ''' ''' ÀÔ·ÂµÈ ÅÂ±×¿Í µ¥ÀÌÅÍÇʵ尡 ÀÏÄ¡ÇÏ´Â ¼¿À» ¹ÝȯÇÕ´Ï´Ù.(ÁÙ¹øÈ£´Â ÇöÀçÁÙ) ''' ''' ''' ''' ''' Public Function CCells(ByVal Tag As Object, Optional ByVal Sheetindex As Integer = -1) As FarPoint.Win.Spread.Cell Dim RetVal As FarPoint.Win.Spread.Cell = Nothing If Sheetindex = -1 Then Sheetindex = Me.ActiveSheetIndex For Each SC As FarPoint.Win.Spread.Column In Me.Sheets(Sheetindex).Columns If SC.DataField.ToUpper = Tag.ToString.ToUpper Then RetVal = Me.Sheets(Sheetindex).Cells(Me.ActiveRowindex, SC.Index) Exit For End If Next If RetVal Is Nothing Then MsgBox("Can't Find column [" & Tag.ToString & "]", MsgBoxStyle.Critical, "Farpoint function Cells") End If Return RetVal End Function ''' ''' Ȱ¼ºÈ­µÈ ÁÙ¹øÈ£¸¦ ¹Ýȯ ''' ''' ''' Public Function ActiveRowindex() As Integer Return Me.ActiveSheet.ActiveRowIndex End Function ''' ''' Ȱ¼ºÈ­µÈ ¿­¹öÈ£¸¦ ¹Ýȯ ''' ''' ''' Public Function ActiveColumnindex() As Integer Return Me.ActiveSheet.ActiveColumnIndex End Function ''' ''' ¿£ÅÍ۸¦ ´©¸£¸é ´ÙÀ½¼¿·ÎÀ̵¿Çϴ Ű¸ÊÀ» ¼³Á¤ÇÕ´Ï´Ù. ''' ''' Public Sub EnterToNextItem() Dim im As New FarPoint.Win.Spread.InputMap im = Me.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused) im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap) im = Me.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused) im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap) End Sub Public Sub NEXT_CELL() If Me.ActiveSheet.ActiveRowIndex <> Me.ActiveSheet.RowCount - 1 Then '//¸¶Áö¸·ÁÙÀÌ ¾Æ´Ï¸é If Me.ActiveSheet.ActiveColumnIndex = Me.ActiveSheet.ColumnCount - 1 Then '/¸¶Áö¸·¿­ÀÌ¸é ´ÙÀ½Á٠÷À¸·Î À̵¿ 'SendKeys.Send("{TAB}") Me.ActiveSheet.ActiveRowIndex += 1 Me.ActiveSheet.ActiveColumnIndex = V_FIRSTINDEX '//ùÀ妽º·Î ¿È±ä´Ù.±âº»°ªÀº 0ÀÌ´Ù. 'Me.ActiveSheet.SetActiveCell(Me.ActiveSheet.ActiveRowIndex + 1, V_FIRSTINDEX) Else 'SendKeys.Send("{TAB}") 'Me.ActiveSheet.SetActiveCell(Me.ActiveSheet.ActiveRowIndex, Me.ActiveSheet.ActiveColumnIndex + 1) 'Me.ActiveSheet.IsSelected(Me.ActiveSheet.ActiveRowIndex, Me.ActiveSheet.ActiveColumnIndex + 1) 'ME.ActiveSheet.SEL Me.ActiveSheet.ActiveColumnIndex += 1 End If Else If Me.ActiveSheet.ActiveColumnIndex <> Me.ActiveSheet.ColumnCount - 1 Then '/¸¶Áö¸·¿­ÀÌ¸é ´ÙÀ½Á٠÷À¸·Î À̵¿ 'Me.ActiveSheet.ActiveRowIndex += 1 Me.ActiveSheet.ActiveColumnIndex += 1 '//ùÀ妽º·Î ¿È±ä´Ù.±âº»°ªÀº 0ÀÌ´Ù. End If End If End Sub Public Sub NEXT_ROW() If Me.ActiveSheet.ActiveRowIndex <> Me.ActiveSheet.RowCount - 1 Then '//¸¶Áö¸·ÁÙÀÌ ¾Æ´Ï¸é Me.ActiveSheet.ActiveRowIndex += 1 Me.ActiveSheet.ActiveColumnIndex = V_FIRSTINDEX '//ùÀ妽º·Î ¿È±ä´Ù.±âº»°ªÀº 0ÀÌ´Ù. End If End Sub Public Sub ItemCheck_Select(Optional ByVal index As Int16 = -1) Dim sheet As FarPoint.Win.Spread.SheetView = Me.ActiveSheet If index = -1 AndAlso Me.¼±ÅÃÁÙ¹øÈ£ <> -1 Then index = ¼±ÅÃÁÙ¹øÈ£ '//ÁöÁ¤µÈ¿­Á¦¸ñÀÌ ÀÕ´ÂÁö sheet.AutoFilterReset(index) '//ÇÊÅÍÀû¿ë½Ã ¸¸Èþ ´À¸®¹Ç·Î ÇÊÅ͸¦ ÇØÁ¦ÇÑ´Ù. For i As Integer = 0 To sheet.RowCount - 1 sheet.Cells(i, index).Value = True Next End Sub Public Sub ItemCheck_Unselect(Optional ByVal index As Int16 = -1) Dim sheet As FarPoint.Win.Spread.SheetView = Me.ActiveSheet If index = -1 AndAlso Me.¼±ÅÃÁÙ¹øÈ£ <> -1 Then index = ¼±ÅÃÁÙ¹øÈ£ '//ÁöÁ¤µÈ¿­Á¦¸ñÀÌ ÀÕ´ÂÁö sheet.AutoFilterReset(index) '//ÇÊÅÍÀû¿ë½Ã ¸¸Èþ ´À¸®¹Ç·Î ÇÊÅ͸¦ ÇØÁ¦ÇÑ´Ù. For i As Integer = 0 To sheet.RowCount - 1 sheet.Cells(i, index).Value = False Next End Sub Public Sub ItemCheck_Reverse(Optional ByVal index As Int16 = -1) Dim sheet As FarPoint.Win.Spread.SheetView = Me.ActiveSheet If index = -1 AndAlso Me.¼±ÅÃÁÙ¹øÈ£ <> -1 Then index = ¼±ÅÃÁÙ¹øÈ£ '//ÁöÁ¤µÈ¿­Á¦¸ñÀÌ ÀÕ´ÂÁö sheet.AutoFilterReset(index) '//ÇÊÅÍÀû¿ë½Ã ¸¸Èþ ´À¸®¹Ç·Î ÇÊÅ͸¦ ÇØÁ¦ÇÑ´Ù. For i As Integer = 0 To sheet.RowCount - 1 sheet.Cells(i, index).Value = IIf(sheet.Cells(i, index).Value = True, False, True) Next End Sub ''' ''' ºäÀÇ ¿­³Êºñ,¿­À̸§(¿É¼Ç),ÁÜÆÑÅ͵îÀ» ÀúÀåÇÕ´Ï´Ù. ''' ''' ''' Public Sub Setting_Save(Optional ByVal ColName As Boolean = True, Optional ByVal Tag As String = "", Optional ByVal FN As String = "") ColSize_Save(Tag, FN) If ColName Then ColName_Save(Tag, FN) CurrentState_Save(Tag, FN) AZOOM_Save(Tag, FN) End Sub ''' ''' ºäÀÇ ¿­³Êºñ,¿­À̸§(¿É¼Ç),ÁÜÆÑÅ͵îÀ» ºÒ·¯¿É´Ï´Ù ''' ''' ''' Public Sub Setting_Load(Optional ByVal ColName As Boolean = True, Optional ByVal Tag As String = "", Optional ByVal FN As String = "") ColSize_Load(Tag, FN) If ColName Then ColName_Load(Tag, FN) CurrentState_Load(Tag, FN) AZOOM_LOAD(Tag, FN) End Sub ''' ''' ÇöÀç ¿­³Êºñ¸¦ Spread.ini ÆÄÀÏ¿¡ ÀúÀåÇÕ´Ï´Ù. ''' ''' Public Sub AZOOM_Save(ByVal tag As String, ByVal fn As String) Dim File As New System.IO.FileInfo(My.Application.Info.DirectoryPath & "\" & fn & "spread.INI") If System.IO.Directory.Exists(File.DirectoryName) = False Then System.IO.Directory.CreateDirectory(File.DirectoryName) Dim a As New MyINI2(File.FullName) a.Write(Me.Parent.Name & "-" & (Me.Name & tag), "ZOOM", Me.ActiveSheet.ZoomFactor) End Sub ''' ''' ÇöÀç ¿­³Êºñ¸¦ Spread.ini ÆÄÀÏ·Î ºÎÅÍ ºÒ·¯¿É´Ï´Ù. ''' ''' Public Sub AZOOM_LOAD(ByVal tag As String, ByVal fn As String) Dim FILEname As String = My.Application.Info.DirectoryPath & "\" & fn & "spread.INI" If Not System.IO.File.Exists(FILEname) Then MsgBox("¿­³Êºñ ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù", MsgBoxStyle.Critical, "¿­³Êºñ¼³Á¤-¿À·ù") ColSize_Save(tag, fn) Return End If 'MsgBox("PARENT" & Me.Parent.Name.ToString & "/" & Me.Parent.Text) Dim a As New MyINI2(FILEname) Me.ActiveSheet.ZoomFactor = a.Read(Me.Parent.Name & "-" & (Me.Name & tag), "ZOOM", 1) End Sub ''' ''' ÇöÀç ¿­³Êºñ¸¦ Spread.ini ÆÄÀÏ¿¡ ÀúÀåÇÕ´Ï´Ù. ''' ''' Public Sub ColSize_Save(ByVal tag As String, ByVal fn As String) Dim File As New System.IO.FileInfo(My.Application.Info.DirectoryPath & "\" & fn & "spread.INI") If System.IO.Directory.Exists(File.DirectoryName) = False Then System.IO.Directory.CreateDirectory(File.DirectoryName) Dim a As New MyINI2(File.FullName) For Each z As FarPoint.Win.Spread.Column In Me.ActiveSheet.Columns a.Write(Me.Parent.Name & "-" & (Me.Name & tag), "COLSIZE" & z.Index.ToString, z.Width) Next End Sub ''' ''' ÇöÀç ¿­³Êºñ¸¦ Spread.ini ÆÄÀÏ·Î ºÎÅÍ ºÒ·¯¿É´Ï´Ù. ''' ''' Public Sub ColSize_Load(ByVal tag As String, ByVal fn As String) Dim FILEname As String = My.Application.Info.DirectoryPath & "\" & fn & "spread.INI" If Not System.IO.File.Exists(FILEname) Then MsgBox("¿­³Êºñ ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù", MsgBoxStyle.Critical, "¿­³Êºñ¼³Á¤-¿À·ù") ColSize_Save(tag, fn) Return End If 'MsgBox("PARENT" & Me.Parent.Name.ToString & "/" & Me.Parent.Text) Dim a As New MyINI2(FILEname) For Each col As FarPoint.Win.Spread.Column In Me.ActiveSheet.Columns 'MsgBox(COL.Index) 'a.Write(Me.Parent.Name, "COLSIZE" & COL.Index.ToString, File, COL.Width) Try col.Width = a.Read(Me.Parent.Name & "-" & (Me.Name & tag), "COLSIZE" & col.Index.ToString) Catch ex As Exception '//¾øÀ»°æ¿ì¿¡´Â ¿¡·¯¸¦ ³»¹Ç·Î ±×³É ³ª°£´Ù End Try Next End Sub Public Sub ColName_Load(ByVal tag As String, ByVal fn As String) Dim FILEname As String = My.Application.Info.DirectoryPath & "\" & fn & "spread.INI" If Not System.IO.File.Exists(FILEname) Then MsgBox("¿­³Êºñ ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù", MsgBoxStyle.Critical, "¿­³Êºñ¼³Á¤-¿À·ù") ColSize_Save(tag, fn) Return End If 'MsgBox("PARENT" & Me.Parent.Name.ToString & "/" & Me.Parent.Text) Dim a As New MyINI2(FILEname) For Each col As FarPoint.Win.Spread.Column In Me.ActiveSheet.Columns 'MsgBox(COL.Index) 'a.Write(Me.Parent.Name, "COLSIZE" & COL.Index.ToString, File, COL.Width) Try col.Label = a.Read(Me.Parent.Name & "-" & Me.Name & tag, "COLNAME" & col.Index.ToString).ToString.Trim(Chr(0)) Catch ex As Exception '//¾øÀ»°æ¿ì¿¡´Â ¿¡·¯¸¦ ³»¹Ç·Î ±×³É ³ª°£´Ù End Try Next End Sub Public Sub ColName_Save(ByVal tag As String, ByVal fn As String) Dim File As New System.IO.FileInfo(My.Application.Info.DirectoryPath & "\" & fn & "spread.INI") If System.IO.Directory.Exists(File.DirectoryName) = False Then System.IO.Directory.CreateDirectory(File.DirectoryName) Dim a As New MyINI2(File.FullName) For Each z As FarPoint.Win.Spread.Column In Me.ActiveSheet.Columns a.Write(Me.Parent.Name & "-" & Me.Name & tag, "COLNAME" & z.Index.ToString, z.Label) Next End Sub ''' ''' [º¸Ãæ¿ä¸Á] :ÁÙ³ôÀ̸¦ ÀúÀå ''' ''' Public Sub CurrentState_Save(ByVal tag As String, ByVal fn As String) Dim File As New System.IO.FileInfo(My.Application.Info.DirectoryPath & "\" & fn & "spread.INI") If System.IO.Directory.Exists(File.DirectoryName) = False Then System.IO.Directory.CreateDirectory(File.DirectoryName) Dim a As New MyINI2(File.FullName) a.Write(Me.Parent.Name & "-" & Me.Name & tag, "RowHeight", Me.ActiveSheet.Rows.Default.Height) End Sub ''' ''' [º¸Ãæ¿ä¸Á] :ÁÙ³ôÀ̸¦ ºÒ·¯¿Â´Ù.(spre.ini) ''' ''' Public Sub CurrentState_Load(ByVal tag As String, ByVal fn As String) Dim FILEname As String = My.Application.Info.DirectoryPath & "\" & fn & "spread.INI" If Not System.IO.File.Exists(FILEname) Then MsgBox("¿­³Êºñ ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù", MsgBoxStyle.Critical, "¿­³Êºñ¼³Á¤-¿À·ù") CurrentState_Save(tag, fn) Return End If Dim a As New MyINI2(My.Application.Info.DirectoryPath & "\" & fn & "spread.INI") Me.ActiveSheet.Rows.Default.Height = a.Read(Me.Parent.Name & "-" & Me.Name & tag, "RowHeight", 20) End Sub Private Sub Delete_itm(Optional ByVal rowindex As Integer = -1, Optional ByVal prompt As Boolean = True) Dim Commit As Boolean = True Dim A As New System.Text.StringBuilder("°æ°í : µ¥ÀÌÅÍ »èÁ¦¸¦ ¼±ÅÃÇß½À´Ï´Ù") A.AppendLine() A.AppendLine("ÇöÀç ¼±ÅÃµÈ ÁÙÀÌ »èÁ¦µË´Ï´Ù") A.AppendLine("°è¼ÓÇϽðڽÀ´Ï±î?") If prompt Then If MsgBox(A.ToString, MsgBoxStyle.Critical + MsgBoxStyle.OkCancel, "¼±ÅÃÁÙ »èÁ¦") <> MsgBoxResult.Ok Then Commit = False End If If Not Commit Then Return '//¸í·ÉÇÁ·ÒÇÁÆ®¿¡¼­ Ãë¼Ò¸¦ ¼±ÅÃÇÞÀ»½Ã¿¡´Â ºüÁ®³ª°£´Ù. Me.ActiveSheet.ActiveRow.Remove() End Sub Private Sub MyFpoint_EditModeOff(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.EditModeOff End Sub ''' ''' ÀüÁÙÀÇ ÇöÀç¿­À§Ä¡ ¼¿À» ¹Ýȯ ''' ''' ''' ''' Public Function CellsPR(Optional ByVal FirstrowValueisNothing As Boolean = False) As FarPoint.Win.Spread.Cell If FirstrowValueisNothing AndAlso Me.ActiveRowindex = 0 Then Return Nothing If Me.ActiveRowindex = 0 Then If FirstrowValueisNothing Then Return Nothing Else Return Me.ActiveSheet.ActiveCell End If Else Return Me.ActiveSheet.Cells(Me.ActiveRowindex - 1, Me.ActiveColumnindex) End If End Function Private Sub CustFP_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown e.Handled = True e.SuppressKeyPress = False Select Case e.KeyCode Case Keys.Enter If e.Control Then Me.Cells.Value = Me.CellsPR.Value Else If Not Me.v_AAutoAddrowInLast Is Nothing Then If Me.ActiveSheet.ActiveRowIndex = Me.ActiveSheet.RowCount - 1 Then '//¸¶Áö¸·ÁÙ¿¡ If Me.V_NextRowindex = Me.ActiveSheet.ActiveColumnIndex Then '//´ÙÀ½Áٷΰ¡¾ÆÁl °æ¿ì¶ó¸é e.Handled = True Me.v_AAutoAddrowInLast.PerformClick() ElseIf Me.ActiveSheet.ActiveColumnIndex = Me.ActiveSheet.ColumnCount - 1 Then '//¸¶Áö¸·¿­À̶ó¸é e.Handled = True Me.v_AAutoAddrowInLast.PerformClick() End If End If Else If Me.V_NextRowindex = Me.ActiveSheet.ActiveColumnIndex Then '//´ÙÀ½Áٷΰ¡¾ÆÁl °æ¿ì¶ó¸é Me.NEXT_ROW() ElseIf Me.ActiveSheet.ActiveColumnIndex = Me.ActiveSheet.ColumnCount - 1 Then '//¸¶Áö¸·¿­À̶ó¸é Me.NEXT_ROW() End If End If End If Case Keys.Delete If e.Shift Then '//½¬ÇÁÆ®°¡ ´­·¯Á®ÀÕÀ»°æ¿ì If Me.V_DeleteKey Then Delete_itm(, True) e.Handled = True Else If Me.V_CurrentDel Then Me.ActiveSheet.ActiveCell.ResetValue() Me.OnEditModeOff(Nothing) e.Handled = True End If End If Case Keys.Space If Me.V_SpaceEdit Then EditMode = True e.Handled = True Case Else '//±×¿Ü´Ù¸¥°ÔÀԷµǾîÀÖÀ»°æ¿ì¿¡´Â editmode ¿¡ µé¾î°¡°ÔµÇ¹Ç·Î ÇѱÛ󸮸¦ À§ÇØ ¹Ù·Î ¿¡µðÆ®¸ðµå·Î µé¾î¿À°ÔÇÑ´Ù. If e.KeyCode >= Keys.NumPad0 AndAlso e.KeyCode <= Keys.NumPad9 Then '//¿ìÃø¼ýÀÚÆÐÆ® ElseIf e.KeyCode >= Keys.D0 AndAlso e.KeyCode <= Keys.D9 Then '//ÀϹݼýÀÚÆÐµå Else If Not e.Alt AndAlso Not e.Control AndAlso Me.ImeMode = Windows.Forms.ImeMode.Hangul Then EditMode = True End If End If End Select End Sub Private Sub CustFP_RowHeightChanged(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.RowHeightChangedEventArgs) Handles Me.RowHeightChanged If Me.V_sameRHeight Then Dim Row As FarPoint.Win.Spread.RowHeightChangeExtents = e.RowList(0) Me.ActiveSheet.Rows.Default.Height = Me.ActiveSheet.Rows(Row.FirstRow).Height End If End Sub End Class