Advertisement
Roland-2

txtcalcntrl sve

Sep 24th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.01 KB | None | 0 0
  1.  Protected Overrides Sub OnDoubleClick(ByVal e As System.EventArgs)
  2.         MyBase.OnDoubleClick(e)
  3.  
  4.         Dim pnt As Point = MousePosition
  5.         pnt = PointToClient(pnt)
  6.  
  7.         If pnt.Y > 50 And pnt.Y < Me.Height - 44 Then
  8.             Dim mday As String = m_iDay.ToString
  9.             Form1.Txtsaveyrmnth.Visible = True
  10.             Dim rect As ActRect = FindActiveRectByPoint(pnt)
  11.             Dim [date] As New DateTime(m_iYear, m_iMonth, 1, 0, 0, 0)
  12.             Dim strMonth As String = [date].ToString("MMMM")
  13.             Value = DateTime.MinValue
  14.             Dim path As String = Application.StartupPath & "\Saves\" & m_iYear.ToString & " " & strMonth & "\" & Form1.TextBox1.Text
  15.  
  16.             Form1.Txtsaveyrmnth.Text = "\Saves\" & m_iYear.ToString & " " & strMonth & "\" & Form1.TextBox1.Text
  17.             If File.Exists(path) Then
  18.                 Dim str As New StreamReader(path)
  19.                 'txtBox.Text = str.ReadToEnd
  20.  
  21.                 Dim line As String
  22.                 Dim textAll As String = ""
  23.                 Dim LastLine As Boolean = False
  24.  
  25.                 Do Until LastLine
  26.                     line = str.ReadLine()
  27.                     If line Is Nothing Then
  28.                         LastLine = True
  29.                     Else
  30.                         textAll = textAll & line & vbCrLf 'Chr(13) + chr(10)
  31.                     End If
  32.                 Loop
  33.                 Form1.Txtnone.Text = textAll
  34.                 str.Close()
  35.                 Application.DoEvents()
  36.                 Form1.Txtnone.Focus()
  37.                 Form1.Txtnone.Select(Form1.Txtnone.TextLength, 0)
  38.  
  39.             Else
  40.                 Form1.Txtnone.Text = ""
  41.                 Application.DoEvents()
  42.                 Form1.Txtnone.Focus()
  43.                 Form1.Txtnone.Select(Form1.Txtnone.TextLength, 0)
  44.             End If
  45.  
  46.         End If
  47.  
  48.  
  49.  
  50.  
  51.  
  52.     End Sub
  53.  
  54.  
  55.  
  56.     Sub OnPaintmemtext(ByVal pevent As PaintEventArgs)
  57.         Dim g As Graphics = pevent.Graphics
  58.  
  59.         Dim [date] As New DateTime(m_iYear, m_iMonth, 1, 0, 0, 0)
  60.  
  61.         Dim rcDay As New Rectangle
  62.  
  63.         Dim sdde2 As Font
  64.  
  65.         Dim GridDeltay As Integer = (Me.Height - 83) / DEF_COLUMNS_COUNT
  66.         Dim GridDeltax As Integer = (Me.Width - 33) / DEF_ROWS_COUNT
  67.  
  68.         Dim strMonth As String = [date].ToString("MMMM")
  69.         Dim path As String = Application.StartupPath & "\Saves\" & m_iYear.ToString & " " & strMonth
  70.  
  71.         If GridDeltay > GridDeltax Then
  72.             Dim s2 As Double = CDbl(Math.Round(GridDeltax)) * 0.14
  73.             Dim s_f2 As Single = CSng(s2)
  74.             sdde2 = New Font("Tahoma", s_f2, FontStyle.Bold)
  75.         Else
  76.             Dim s2 As Double = CDbl(Math.Round(GridDeltay)) * 0.14
  77.             Dim s_f2 As Single = CSng(s2)
  78.             sdde2 = New Font("Tahoma", s_f2, FontStyle.Bold)
  79.         End If
  80.  
  81.         If Not Value = DateTime.MinValue Then 'None mode, Input Text file
  82.  
  83.             Dim yrmnth As New IO.DirectoryInfo(path)
  84.             If yrmnth.Exists Then
  85.  
  86.                 Dim fold As System.IO.DirectoryInfo
  87.                 fold = New System.IO.DirectoryInfo("Saves\" + m_iYear.ToString + " " & strMonth)
  88.                 Dim foldi As IO.FileInfo() = fold.GetFiles("**.*")
  89.                 Dim foldg As IO.FileInfo
  90.  
  91.                 For Each foldg In foldi
  92.  
  93.                     Dim objStreamReader As StreamReader
  94.                     Dim strLine As String
  95.                     objStreamReader = New StreamReader(path + "\" + foldg.ToString)
  96.                     strLine = objStreamReader.ReadLine
  97.                     If Not strLine = Nothing Then
  98.                         If strLine.Length > 9 Then
  99.                             strLine = strLine.Substring(0, 8) ' max 9
  100.                         End If
  101.                     End If
  102.                     rcDay = FindActiveRectByTag(CInt(foldg.Name)).Rect
  103.                     g.DrawString(strLine, sdde2, Brushes.Green, rcDay, OneLineNoTrimming2)
  104.                     objStreamReader.Close()
  105.  
  106.                 Next
  107.  
  108.             End If
  109.  
  110.         End If
  111.  
  112.  
  113.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement