2008年9月7日 星期日

繪圖bar


Public Sub Gen_Box(ByVal DGV1 As DataGridView, ByVal R_index As Integer, ByVal Stime As DateTime, ByVal Etime As DateTime, ByVal TT_str As String, ByVal V_color As Brush, ByVal V_N_color As Brush)
Dim G As Graphics = DGV1.CreateGraphics
Dim Jj As Integer
Dim kk, Pp As DateTime
Dim Spoint_X, Spoint_y, Epoint_X, Epoint_Y As Integer kk = Stime.ToString("HH:mm")
Pp = Etime.ToString("HH:mm")
Jj = DateDiff(DateInterval.Minute, kk, Pp)
Spoint_X = DGV1.RowHeadersWidth + DGV1.Columns(R_index).Width * Stime.ToString("HH") + (Stime.ToString("mm") / 60 * DGV1.Columns(R_index).Width)
Spoint_y = DGV1.Rows(R_index).Height * R_index + DGV1.ColumnHeadersHeight + 1 Epoint_X = Jj / 60 * DGV1.Columns(R_index).Width Epoint_Y = DGV1.Rows(R_index).Height - 1
Dim rect As New Rectangle(Spoint_X, Spoint_y, Epoint_X, Epoint_Y) G.FillRectangle(V_color, rect)
Dim fontb As New Font("新細明體", 8, FontStyle.Bold)
G.DrawString(Stime.ToString("HH:mm") & " ~ " & Etime.ToString("HH:mm"), fontb, V_N_color, Spoint_X, Spoint_y)
End Sub

沒有留言:

張貼留言