Bonjour, j'ai petit problème espace sur un label avec datetime entre 05:46 et data aujourd'hui.(voir image)
voici en image :
dans Timer_Tick :
Code : Sélectionner tout - Visualiser dans une fenêtre à part GetCenterLabel(Label2, TimeZoneInfo.ConvertTimeToUtc(UTCTime, UTC).ToString("HH:mm dd/MM/yyyy"), 85, FontStyle.Bold)dans Label2_Paint :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 Private Sub GetCenterLabel(lb As Label, info As String, FondSize As Integer, _FondStyle As FontStyle) lb.Text = info lb.Left = (Me.Width \ 2) - (lb.Width \ 2) lb.Top = (Me.Height \ 2) - (lb.Height \ 2) lb.Font = GetFont(My.Resources.DS_DIGIB, FondSize, _FondStyle) lb.TextAlign = ContentAlignment.MiddleCenter lb.ForeColor = Me.BackColor End Sub
Code : Sélectionner tout - Visualiser dans une fenêtre à part DrawColorText(CType(sender, Label), Label2.Text, e, 85, FontStyle.Bold)pouvez-vous m'aider à avoir l'espace entre l'heure et la date ? merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Private Sub DrawColorText(LBL As Label, _info As String, e As PaintEventArgs, FondSize As Integer, _FondStyle As FontStyle) Dim MyChar As String() = {":", " ", "/", "/"} Dim MyFont As Font = GetFont(My.Resources.DS_DIGIB, FondSize, _FondStyle) Dim jour As String() = _info.Split(New Char() {":", " ", "/"}, StringSplitOptions.RemoveEmptyEntries) Dim x As Integer = 0 For i As Integer = 0 To jour.Length - 1 e.Graphics.DrawString(jour(i), MyFont, New SolidBrush(_MyColor(i)), x, 0) x += (e.Graphics.MeasureString(jour(i), MyFont)).Width - (LBL.Width / 22) If i < (jour.Length - 1) Then e.Graphics.DrawString(MyChar(i), MyFont, New SolidBrush(Me.ForeColor), x, 0) x += (e.Graphics.MeasureString(MyChar(i), MyFont)).Width - (LBL.Width / 22) End If Next End Sub
Partager