Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionarray ^tempsPt = gcnew array (temperatures->Length) ; array ^tempsPtLb = gcnew array (temperatures->Length) ;
Dim tempsPt(temperatures.Length) As Point Dim tempsPtLb(temperatures.Length) As Point
DrawString (temps[i].ToString(), drawFont, drawBrush, tempsPtLb[i] );
G.DrawString(temps(i).ToString(), drawFont, drawBrush, tempsPtLb(i))
g->DrawArc (penPt,tempsPt[i].X, tempsPt[i].Y, 5, 5, 0, 359) ;
G.DrawArc(penPt,tempsPt(i).X, tempsPt(i).Y, 5, 5, 0, 359)
g->DrawCurve(penCourbe, tempsPt, 0.2) ;
g.DrawCurve(penCourbe, tempsPt, 0.2)
for (int i = 0 ; i < temperatures->Length ; i++) { //Code }
For i = 0 To temperatures.Length 'Code Next
Public Class clsCourbeTemperature Inherits PictureBox Private m_Temperature, m_EcartEntrePoints, m_NombrePointsMax As Integer Private m_NombreHautEchelle, m_NombreBasEchelle As String Private m_CouleurFond, m_CouleurTrait As Color Private m_col As Collection = New Collection Private b As Bitmap Private g As Graphics Public Sub New(ByVal ParentForm As Form, _ ByVal CouleurTrait As Color, _ ByVal CouleurFond As Color, _ ByVal TempsRafraichissement As Double, _ ByVal EcartEntrePoints As Integer, _ ByVal NombrePointsMax As Integer, _ ByVal NombreBasEchelle As String, _ ByVal NombreHautEchelle As String) Me.Width = ParentForm.ClientRectangle.Width Me.Height = ParentForm.ClientRectangle.Height Me.Parent = ParentForm m_EcartEntrePoints = EcartEntrePoints m_NombrePointsMax = NombrePointsMax m_CouleurFond = CouleurFond m_CouleurTrait = CouleurTrait m_NombreHautEchelle = NombreHautEchelle m_NombreBasEchelle = NombreBasEchelle b = New Bitmap(Me.Width, Me.Height) g = Graphics.FromImage(b) End Sub Public WriteOnly Property Temperature() As Double Set(ByVal value As Double) m_Temperature = value If m_col.Count >= m_NombrePointsMax Then m_col.Remove(1) End If m_col.Add(((100 - m_Temperature) / 100) * Me.Height) Dim ft As New Font("Arial", 13, FontStyle.Regular, GraphicsUnit.Pixel) g.FillRectangle(New SolidBrush(m_CouleurFond), New Rectangle(0, 0, b.Width, b.Height)) g.DrawString(m_NombreBasEchelle, ft, New SolidBrush(Color.White), 5, Me.Height - 20) g.DrawString(m_NombreHautEchelle, ft, New SolidBrush(Color.White), 5, 5) For x = 2 To m_col.Count g.DrawLine(New Pen(m_CouleurTrait, 2), _ New Point(x * m_EcartEntrePoints, m_col.Item(x - 1)), _ New Point((x * m_EcartEntrePoints) + m_EcartEntrePoints, m_col.Item(x))) If x = m_col.Count Then g.DrawString(m_Temperature.ToString, _ ft, _ New SolidBrush(Color.Orange), _ (x * m_EcartEntrePoints) + m_EcartEntrePoints, _ m_col.Item(x)) End If Next Me.Image = b.Clone End Set End Property End Class
Public Class Form1 Private p As clsCourbeTemperature Private rd As Random = New Random Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load p = New clsCourbeTemperature(Me, Color.Red, Color.Black, 1000, 20, 12, "0°C", "100°C") End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick p.Temperature = rd.next(0, 100) End Sub End Class
Public Sub New(ByVal ParentForm As Form, _ ByVal CouleurTrait As Color, _ ByVal CouleurFond As Color, _ ByVal TempsRafraichissement As Double, _ ByVal EcartEntrePoints As Integer, _ ByVal NombrePointsMax As Integer, _ ByVal NombreBasEchelle As String, _ ByVal NombreHautEchelle As String)