Protected Overrides Sub OnDoubleClick(ByVal e As System.EventArgs)
MyBase.OnDoubleClick(e)
Dim pnt As Point = MousePosition
pnt = PointToClient(pnt)
If pnt.Y > 50 And pnt.Y < Me.Height - 44 Then
Dim mday As String = m_iDay.ToString
Form1.Txtsaveyrmnth.Visible = True
Dim rect As ActRect = FindActiveRectByPoint(pnt)
Dim [date] As New DateTime(m_iYear, m_iMonth, 1, 0, 0, 0)
Dim strMonth As String = [date].ToString("MMMM")
Value = DateTime.MinValue
Dim path As String = Application.StartupPath & "\Saves\" & m_iYear.ToString & " " & strMonth & "\" & Form1.TextBox1.Text
Form1.Txtsaveyrmnth.Text = "\Saves\" & m_iYear.ToString & " " & strMonth & "\" & Form1.TextBox1.Text
If File.Exists(path) Then
Dim str As New StreamReader(path)
'txtBox.Text = str.ReadToEnd
Dim line As String
Dim textAll As String = ""
Dim LastLine As Boolean = False
Do Until LastLine
line = str.ReadLine()
If line Is Nothing Then
LastLine = True
Else
textAll = textAll & line & vbCrLf 'Chr(13) + chr(10)
End If
Loop
Form1.Txtnone.Text = textAll
str.Close()
Application.DoEvents()
Form1.Txtnone.Focus()
Form1.Txtnone.Select(Form1.Txtnone.TextLength, 0)
Else
Form1.Txtnone.Text = ""
Application.DoEvents()
Form1.Txtnone.Focus()
Form1.Txtnone.Select(Form1.Txtnone.TextLength, 0)
End If
End If
End Sub
Sub OnPaintmemtext(ByVal pevent As PaintEventArgs)
Dim g As Graphics = pevent.Graphics
Dim [date] As New DateTime(m_iYear, m_iMonth, 1, 0, 0, 0)
Dim rcDay As New Rectangle
Dim sdde2 As Font
Dim GridDeltay As Integer = (Me.Height - 83) / DEF_COLUMNS_COUNT
Dim GridDeltax As Integer = (Me.Width - 33) / DEF_ROWS_COUNT
Dim strMonth As String = [date].ToString("MMMM")
Dim path As String = Application.StartupPath & "\Saves\" & m_iYear.ToString & " " & strMonth
If GridDeltay > GridDeltax Then
Dim s2 As Double = CDbl(Math.Round(GridDeltax)) * 0.14
Dim s_f2 As Single = CSng(s2)
sdde2 = New Font("Tahoma", s_f2, FontStyle.Bold)
Else
Dim s2 As Double = CDbl(Math.Round(GridDeltay)) * 0.14
Dim s_f2 As Single = CSng(s2)
sdde2 = New Font("Tahoma", s_f2, FontStyle.Bold)
End If
If Not Value = DateTime.MinValue Then 'None mode, Input Text file
Dim yrmnth As New IO.DirectoryInfo(path)
If yrmnth.Exists Then
Dim fold As System.IO.DirectoryInfo
fold = New System.IO.DirectoryInfo("Saves\" + m_iYear.ToString + " " & strMonth)
Dim foldi As IO.FileInfo() = fold.GetFiles("**.*")
Dim foldg As IO.FileInfo
For Each foldg In foldi
Dim objStreamReader As StreamReader
Dim strLine As String
objStreamReader = New StreamReader(path + "\" + foldg.ToString)
strLine = objStreamReader.ReadLine
If Not strLine = Nothing Then
If strLine.Length > 9 Then
strLine = strLine.Substring(0, 8) ' max 9
End If
End If
rcDay = FindActiveRectByTag(CInt(foldg.Name)).Rect
g.DrawString(strLine, sdde2, Brushes.Green, rcDay, OneLineNoTrimming2)
objStreamReader.Close()
Next
End If
End If
End Sub
Comments