Click here to Skip to main content
15,892,927 members
Articles / Multimedia / GDI+

Interpolation of BezierSplines and Cubic Splines

Rate me:
Please Sign up or sign in to vote.
4.83/5 (16 votes)
5 Jan 2008CPOL2 min read 98.6K   3.1K   63  
Algorithms to compute the Y - Value at an X - Position of a curve, constructed by some support-points
Public Class ControlCaption : Inherits DrawObjectBase

   Public ReadOnly StringFormat As StringFormat = AddDisposable(New StringFormat)

   Protected _Text As String
   Public Function Text(ByVal NewValue As String) As ControlCaption
      If Object.Equals(NewValue, _Text) Then Return Me
      _Text = NewValue
      PreparePath()
      MyBase.Invalidate(True)
      Return Me
   End Function

   Protected Overrides Sub Control_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
      PreparePath()
      MyBase.Invalidate(True)
   End Sub

   Protected Overrides Sub PreparePath()
      With _Control.Font
         DrawPath.Reset()
         DrawPath.AddString( _
            _Text, .FontFamily, .Style, .Size * 1.4F, _Control.ClientRectangle, StringFormat)
      End With
   End Sub

   Protected Overrides Sub Control_Paint(ByVal sender As Object, ByVal e As PaintEventArgs)
      e.Graphics.SmoothingMode = SmoothingMode.HighQuality
      MyBase.Control_Paint(sender, e)
   End Sub

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions