DotSpatial.Positioning.Forms Represents a user control used to display altitude. Altimeters are used to visually represent some form of altitude, typically the user's current altitude above sea level. Altitude is measured using three needles which represent (from longest to shortest) hundreds, thousands and tens-of-thousands. The display of the Altimeter is controlled via the Value property. Represents a base class for round controls painted using polar coordinates. Represents a base class for designing flicker-free, multithreaded user controls. This powerful and versatile class provides a framework upon which to create high-performance owner-drawn controls. Common rendering challenges such as multithreading, thread synchronization, double-buffering, performance tuning, platform tuning and animation are all handled by this class. Controls which inherit from this class perform all paint operations by overriding the OnPaintOffScreen method, and optionally the OnPaintOffScreenBackground and OnPaintOffScreenAdornments methods. Controls which demand higher performance should perform all rendering on a separate thread. This is done by setting the IsPaintingOnSeparateThread property to True. Since the actual painting of the control is handled by this class, the OnPaint method should not be overridden. When all off-screen paint operations have completed, this class will copy the contents of the off-screen bitmap to the on-screen bitmap which is visibly displayed on the control. By deferring all rendering operations to another thread, the user interface remains very responsive even during time-consuming paint operations. Performance tuning is another major feature of this class. The OptimizationMode property gives developers the ability to tune rendering performance for animation speed, rendering quality, low CPU usage, or a balance between all three. While thread synchronization has been implemented wherever possible in this class, and the class is almost entirely thread-safe, some care should be taken when accessing base Control properties from a separate thread. Even basic properties like Visible can fail, especially on the Compact Framework. For minimal threading issues, avoid reading control properties during paint events. This class has been tuned to deliver the best performance on all versions of the .NET Framework (1.0, 1.1 and 2.0) as well as the .NET Compact Framework (1.0 and 2.0). Compatibility is also managed internally, which simplifies the process of porting controls to the Compact Framework. This example demonstrates how little code is required to use features like double-buffering and multithreading. IsPaintingOnSeparateThread enables multithreading, and all paint operations take place in the OnPaintOffScreen method instead of OnPaint. To prevent memory leaks, all GDI objects are disposed of during the Dispose method. Public Class MyControl Inherits DoubleBufferedControl Dim MyBrush As New SolidBrush(Color.Blue) Sub New() IsPaintingOnSeparateThread = True End Sub Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)) End Sub Public Overrides Sub Dispose(ByVal disposing As Boolean) MyBrush.Dispose() End Sub End Class public class MyControl : DoubleBufferedControl { SolidBrush MyBrush = new SolidBrush(Color.Blue); MyControl() { IsPaintingOnSeparateThread = true; } protected override void OnPaintOffScreen(PaintEventArgs e) { e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)); } public override void Dispose(bool disposing) { MyBrush.Dispose(); } } Creates a new instance. Creates a new instance using the specified thread name. The name associated with the rendering thread when rendering is multithreaded. This name appears in the Output window when the thread exits and can be useful during debugging. The name should also contain a company or support URL. Allows the control to be repainted after a call to SuspendPainting. Temporarily pauses all painting operations. Repaints the control either directly or via the painting thread. Redraws the control off-screen. Occurs when an exception occurs during a multithreaded paint operation. Exceptions caught during rendering iterations are channeled through this method instead of being re-thrown. This allows developers the ability to silently handle rendering problems without letting them interrupt the user interface. This method invokes the ExceptionOccurred event. This example demonstrates how to be notified of rendering failures using the OnPaintException method. Public Class MyControl Inherits DoubleBufferedControl Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) ' Cause an error by using a null pen e.Graphics.DrawRectangle(Nothing, Rectangle.Empty) End Sub Protected Overrides Sub OnPaintException(ByVal e As ExceptionEventArgs) Throw e.Exception End Sub End Class public class MyControl : DoubleBufferedControl { protected override void OnPaintOffScreen(PaintEventArgs e) { // Cause an error by using a null pen e.Graphics.DrawRectangle(null, Rectangle.Empty); } protected override void OnPaintException(ExceptionEventArgs e) { throw e.Exception; } } An Exception object describing the rendering error. Occurs when the desired frame rate has changed. This virtual method is called whenever the TargetFrameRate property has changed. This method gives controls the opportunity to adjust animation effects to achieve the frame rate as closely as possible. An Integer specifying the ideal or desired frame rate for the control. Performs all major painting operations for the control. This method must be overridden. All painting operations for the control take place during this method. After this method completes, the OnPaintOffScreenAdornments method is called. When all painting operations have completed, the task of repainting the control visually takes place automatically. Developers seeking to upgrade their existing controls to use this control must move all code from OnPaint into OnPaintOffScreen. For best performance, the OnPaint method would not be overridden at all. A CancelablePaintEventArgs object used for all painting operations, as well as to signal when a rendering iteration has been aborted. Optional. Performs painting operations which draw the control's background. This method provides the ability to prepare the background of the control before major painting operations take place. By default, this method calls the Graphics.Clear method to erase the control to the background color. This method can be overridden to perform certain visual effects. For example, the PolarControl class, which inherits from this class, uses this method to apply a fading circular gradient to create a 3D illusion. Then, the OnPaintOffScreenAdornments method is also overridden to apply a second effect which gives the appearance of glass over the control. For more information on glass effects, see the Effect property of the PolarControl class. A CancelablePaintEventArgs object used for all painting operations, as well as to signal when a rendering iteration has been aborted. Optional. Performs any additional painting operations after the main portions of the control are painted. By default, this method does nothing. This method can be overridden to apply certain details, however, such as a watermark, company logo, or glass. For example, the PolarControl class overrides this method to apply a glass effect on top of anything that has already been painted. For more information on glass effects, see the Effect property of the PolarControl class. A CancelablePaintEventArgs object used for all painting operations, as well as to signal when a rendering iteration has been aborted. Occurs when the control is about to be rendered for the first time. This virtual method provides the ability to prepare any local variables before the control is painted for the first time. This method is typically used to create GDI objects such as Pen, Brush, and Font immediately before they are needed. It is recommended that this event be used to create any such GDI objects. Additionally, it is also recommended that GDI objects get created outside of the OnPaintOffScreen method if they are used repeatedly. For desktop framework applications, this method is called when the control's handle is created. For Compact Framework 1.0 applications, there is no handle creation event, so this method is called when the first call to OnPaint occurs. Occurs when the control is to be redrawn on-screen. In the DoubleBufferedControl class, the process of painting the control on-screen is handled automatically. As a result, this method does not have to be overloaded to paint the control. In fact, this method should not be overridden to perform any painting operations because it would defeat the purpose of the control and re-introduce flickering problems. Ideally, well-written controls will move any and all painting operations from the OnPaint method into the OnPaintOffScreen method, and avoid overriding OnPaint entirely. By keeping the OnPaint method as lightweight as possible, user interfaces remain responsive and free from flickering problems. This example demonstrates how a user control is upgraded from Control to the DoubleBufferedControl class. Upgrading is straightforward: All painting operations are moved from OnPaint to OnPaintOffScreen and OnPaint is no longer overridden. Public Class MyControl Inherits Control Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) Dim MyBrush As New SolidBrush(Color.Blue) e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)) MyBrush.Dispose(); End Sub End Class public class MyControl : Control { protected override void OnPaint(PaintEventArgs e) { SolidBrush MyBrush = new SolidBrush(Color.Blue); e.Graphics.FillRectangle(MyBrush, new Rectangle(50, 50, 50, 50)); MyBrush.Dispose(); } } Public Class MyControl Inherits DoubleBufferedControl Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) Dim MyBrush As New SolidBrush(Color.Blue) e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)) MyBrush.Dispose(); End Sub End Class public class MyControl : DoubleBufferedControl { protected override void OnPaintOffScreen(PaintEventArgs e) { SolidBrush MyBrush = new SolidBrush(Color.Blue); e.Graphics.FillRectangle(MyBrush, new Rectangle(50, 50, 50, 50)); MyBrush.Dispose(); } } Finalizes an instance of the DoubleBufferedControl class. Releases memory and GDI resources created by the control. This method is very important to implement properly when working with controls. Any Brush, Pen, Font, Matrix, GraphicsPath, Region or other GDI+ object containing a Dispose method must be disposed of before they are destructed by the garbage collector. Well-written controls will create unmanaged GDI+ objects outside of the OnPaintOffScreen method, then dispose of them during the Dispose method. This practice improves performance by creating as new new objects and resources as possible while minimizing problems which may occur due to resources which are not properly released. Failure to call the Dispose method on GDI+ objects will cause memory leaks which will slowly eat up available memory until the application can no longer function. Use the "GDI Objects" column of the Windows Task Manager to monitor the number of GDI objects allocated. Memory leaks will cause the GDI Object count to increase continuously, whereas well-written controls will experience a GDI Object count that remains fairly constant over a longer period of time. To view the GDI Objects column in the Windows Task Manager: Open the Windows Task Manager Select the "Processes" tab. Select "Choose Columns..." from the View menu. Check the "GDI Objects" box and click OK. This example demonstrates how a control might create subtle problems when the Dispose method is not used on every GDI+ object. Public Class MyControl Inherits DoubleBufferedControl Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) Dim MyBrush As New SolidBrush(Color.Blue) e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)) End Sub ' Notice: MyBrush is never disposed. A memory leak ' will occur! End Class public class MyControl : DoubleBufferedControl { protected override void OnPaintOffScreen(PaintEventArgs e) { SolidBrush MyBrush = new SolidBrush(Color.Blue); e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)); } // Notice: MyBrush is never disposed. A memory leak // will occur! } Public Class MyControl Inherits DoubleBufferedControl ' 1. GDI objects are created outside of the OnPaintOffScreen ' methods whenever possible. Dim MyBrush As New SolidBrush(Color.Blue) Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) ' 2. The paint method is as lightweight as possible, ' improving rendering performance e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)) End Sub Public Overrides Sub Dispose(ByVal disposing As Boolean) ' 3. Any GDI+ objects are disposed of properly MyBrush.Dispose() End Sub End Class public class MyControl : DoubleBufferedControl { // 1. GDI objects are created outside of the OnPaintOffScreen // methods whenever possible. SolidBrush MyBrush = new SolidBrush(Color.Blue); protected override void OnPaintOffScreen(PaintEventArgs e) { // 2. The paint method is as lightweight as possible, // improving rendering performance e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)); } public override void Dispose(bool disposing) { // 3. Any GDI+ objects are disposed of properly MyBrush.Dispose(); } } Converts a color from HSB (hue, saturation, brightness) to RGB. Occurs when an exception is thrown during off-screen painting operations. When the control is rendering on a separate thread, exceptions cannot be caught by a regular Try..Catch statement. Exceptions are instead channeled through this event. The control will also attempt to display exception information on-screen to inform developers of the code which failed. It is important to capture this event or override the OnPaintException method in order to be properly notified of problems. Without doing this, the control could fail to paint properly yet give no indication that there is a problem. This example hooks into the ExceptionOccurred event of a control in order to handle painting exceptions. Public Class MyControl Inherits DoubleBufferedControl Sub New() ' Receive notifications of paint problems AddHandler ExceptionOccurred, AddressOf HandleExceptions End Sub Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) ' Try to paint with a null Pen e.Graphics.DrawRectangle(Nothing, Rectangle.Empty) End Sub Private Sub HandleExceptions(ByVal sender As Object, ByVal e As ExceptionEventArgs) ' Write the error to the Debug window Debug.WriteLine(e.Exception.ToString()) End Sub End Class public class MyControl : DoubleBufferedControl { MyControl() { // Receive notifications of paint problems ExceptionOccurred += new ExceptionEventHandler(HandleExceptions); } protected override void OnPaintOffScreen(PaintEventArgs e) { // Try to paint with a null Pen. e.Graphics.DrawRectangle(null, Rectangle.Empty); } private sub HandleExceptions(object sender, ExceptionEventArgs e) { // Write the error to the Console Console.WriteLine(e.Exception.ToString()); } } Occurs when the control is to be redrawn in the background. In the DoubleBufferedControl class, all painting occurs off-screen. Then, the off-screen bitmap is quickly drawn on-screen when painting completes. This event is called immediately after the PaintOffScreenBackground event. Occurs when the control's background is to be redrawn before the main graphics of the control. In the DoubleBufferedControl class, all painting occurs off-screen. Then, the off-screen bitmap is quickly drawn on-screen when painting completes. This event is called to paint any background graphics before the main elements of the control are drawn. Some painting effects, such as glass or plastic, use this event along with PaintOffScreenAdornments to add annotations to the control. This event is called immediately before the PaintOffScreen event. Occurs when additional graphics or annotations must be added to the control. In the DoubleBufferedControl class, all painting occurs off-screen. Then, the off-screen bitmap is quickly drawn on-screen when painting completes. This event is called to paint any additional graphics after the main elements of the control are drawn. Some painting effects, such as glass, adding text or logos, use this event to draw on the control. This event is called immediately after the PaintOffScreen event. Indicates whether the control is currently running inside of a Windows Forms designer. Indicates if the control and its resources have been disposed. Indicates if all off-screen rendering takes place on a separate thread. This powerful property controls whether or not rendering operations are multithreaded. When set to True, a new thread is launched and all subsequent calls to OnPaintOffScreen, OnPaintOffScreenBackground and OnPaintOffScreenAdornments occur on that thread. Thread synchronization features are enabled so that painting operations never interfere with rendering operations. The priority of the rendering thread is controlled via the ThreadPriority property. When this property is False, the rendering thread is torn down and all rendering occurs on the owner's thread. Controls which perform significant painting operations should enable this property to allow the user interface to be more responsive. As a general rule, any intense processing should be moved away from the user interface thread. This example instructs the control to perform all rendering on a separate thread. Notice that all thread management is handled automatically -- the only operation required is enabling the property. Public Class MyControl Inherits DoubleBufferedControl Sub New() ' Enable multithreading IsPaintingOnSeparateThread = True End Sub ' This method is now called from another thread Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) Dim MyBrush As New SolidBrush(Color.Blue) e.Graphics.FillRectangle(MyBrush, New Rectangle(50, 50, 50, 50)) MyBrush.Dispose() End Sub End Class public class MyControl : DoubleBufferedControl { MyControl() { // Enable multithreading IsPaintingOnSeparateThread = true; } // This method is now called from another thread protected overrides void OnPaintOffScreen(PaintEventArgs e) { SolidBrush MyBrush = new SolidBrush(Color.Blue); e.Graphics.FillRectangle(MyBrush, new Rectangle(50, 50, 50, 50)); MyBrush.Dispose(); } } Controls the upper-left portion of the off-screen bitmap to paint on-screen. A Point structure indicating the corner of the off-screen bitmap to draw on-screen. Default is Empty. If the size of the off-screen bitmap is different than the on-screen bitmap, a control may need to draw different portions of the off-screen bitmap. For example, if an off-screen bitmap is 200x200 pixels but the visible portion of the control is only 50x50 pixels, an offset of (10, 10) instructs the control to paint the off-screen bitmap from (10, 10)-(60, 60). for most controls, this property does not need to be overridden. Controls which override this property also override the OffScreenBitmapSize property to specify a size defferent than the visible portion of the control. Returns the bitmap used for off-screen painting operations. A Bitmap containing off-screen painted data. This control maintains two separate bitmaps: an "off-screen" bitmap, where all painting operations take place, and an "on-screen" bitmap which is displayed visually to the user. When an off-screen painting operation completes successfully, the off-screen bitmap is copies to the on-screen bitmap, then painted on the display. This property returns the off-screen bitmap created during the most recent paint iteration. Controls the relative priority of multithreaded painting operations. A ThreadPriority value. Default is Normal. Painting operations may require more CPU time if they represent the majority of a user interface, or if painting operations are more complicated. Performance can be improved by increasing the priority of the rendering thread. Likewise, if a control is of minor importance to an application, a lower thread priority can improve performance in more important areas of the application. This example enables multithreaded painting then changes the priority of the rendering thread to Lowest to give the rest of the application more CPU time. Public Class MyControl Inherits DoubleBufferedControl Sub New() ' Enable multithreading IsPaintingOnSeparateThread = True ' Set a low thread priority ThreadPriority = ThreadPriority.Lowest End Sub ' This method is now called from another thread Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) ' ...etc. End Sub End Class public class MyControl : DoubleBufferedControl { MyControl() { // Enable multithreading IsPaintingOnSeparateThread = true; // Set a low thread priority ThreadPriority = ThreadPriority.Lowest; } // This method is now called from another thread protected override void OnPaintOffScreen(PaintEventArgs e) { // ...etc. } } Controls the background color of the control. A Color structure representing the background color. The default BackColor property of the Control class cannot be accessed from a thread other than the UI thread. As a result, this property was shadowed in order to make it thread-safe. Controls whether exception messages are displayed on the control. In some situations, an exception can occur during a paint operation. To notify developers of the problem, the error text is written directly to the control. This behavior may not be suitable for some developers, however, who want to trap errors more gracefully. Setting this property to False causes error messages to never be drawn on the control. The ExceptionOccurred event should instead be used to gracefully handle errors when they occur. Returns the width of the control in pixels. An Integer indicating the width of the control in pixels. The default Width property of the Control class cannot be accessed from a thread other than the UI thread. As a result, this property was shadowed in order to make it thread-safe. Returns the horizontal and vertical length of the control in pixels. The default Height property of the Control class cannot be accessed from a thread other than the UI thread. As a result, this property was shadowed in order to make it thread-safe. Returns the height of the control in pixels. An Integer indicating the width of the control in pixels. Returns the bitmap used to paint the visible portion of the control. A Bitmap containing data to be painted on the display. This control maintains two separate bitmaps: an "off-screen" bitmap, where all painting operations take place, and an "on-screen" bitmap which is displayed visually to the user. When an off-screen painting operation completes successfully, the off-screen bitmap is copies to the on-screen bitmap, then painted on the display. This property returns the on-screen bitmap matching what is actually seen in the control. Controls the desired frame rate for rendering operations. An Integer indicating the desired frame rate. Default is 30. This property is used by controls which make use of animation effects. Typically, this property tells a control how long to delay between repaint operations, or how many frames to allocate for a certain time period. Controls which do not do any custom animation effects ignore this property and it has no effect. When this property changes, the OnTargetFrameRateChanged virtual method is called. If a control is able to repaint itself very quickly, smooth animation effects can be achieved. A refresh rate of 30 frames per second or above is necessary to give the human eye the illusion of motion. Refresh rates of 60 or even 120 are possible for extremely fast controls and can result in very nice, smooth animation effects. This property can be a bit confusing for developers because it does not control the rate at which the control is actually repainted. (The control is only repainted when necessary, whenever that occurs.) This property is used only to tune custom effects implemented by controls inheriting from this class. This example animates a green rectangle. The default target frame rate is set to 60 frames per second, which causes the interval of a timer to change. The timer changes the position of the rectangle. Public Class MyControl Inherits DoubleBufferedControl Dim AnimatedRectangle As Rectangle Sub New() ' Set a 60 frames per second target TargetFramesPerSecond = 60 End Sub Protected Overrides Sub OnTargetFrameRateChanged() ' Change the timer to fire 60 times per second MyTimer.Interval = 1000 / TargetFramesPerSecond End Sub Private Sub MyTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) ' Change the location of an animated thing AnimatedRectangle = New Rectangle((AnimatedRectangle.X + 1) Mod Width, (AnimatedRectangle.Y + 1) Mod Height, 50, 50) ' And cause the control to repaint InvokeRepaint() End Sub Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) Dim MyBrush As New SolidBrush(Color.Green) e.Graphics.FillRectangle(MyBrush, AnimatedRectangle) MyBrush.Dispose() End Sub End Class public class MyControl : DoubleBufferedControl Rectangle AnimatedRectangle; MyControl() { // Set a 60 frames per second target TargetFramesPerSecond = 60; } protected override void OnTargetFrameRateChanged() { // Change the timer to fire 60 times per second MyTimer.Interval = 1000 / TargetFramesPerSecond } private void MyTimer_Tick(object sender, EventArgs e) { // Change the location of an animated thing AnimatedRectangle = New Rectangle((AnimatedRectangle.X + 1) ^ Width, (AnimatedRectangle.Y + 1) ^ Height, 50, 50); // And cause the control to repaint InvokeRepaint(); } protected override void OnPaintOffScreen(PaintEventArgs e) { SolidBrush MyBrush = new SolidBrush(Color.Green); e.Graphics.FillRectangle(MyBrush, AnimatedRectangle); MyBrush.Dispose(); } } Controls the graphics quality settings for the control. Indicates the point at the center of the control. This property is typically used for centering items in the control. This property is updated automatically as the control is resized. A Point structure representing the pixel at the center of the control. This example uses the Center property to center a rectangle in the middle of the control. Public Class MyControl Inherits DoubleBufferedControl Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) ' Center a rectangle in the middle of the control Dim MyShape As New Rectangle(Center.X - 25, Center.Y - 25, 50, 50) ' Now paint it Dim MyBrush As New SolidBrush(Color.Green) e.Graphics.FillRectangle(MyBrush, MyShape) MyBrush.Dispose() End Sub End Class public class MyControl : DoubleBufferedControl { protected override void OnPaintOffScreen(PaintEventArgs e) { // Center a rectangle in the middle of the control Rectangle MyShape = new Rectangle(Center.X - 25, Center.Y - 25, 50, 50); // Now paint it SolidBrush MyBrush = new SolidBrush(Color.Green); e.Graphics.FillRectangle(MyBrush, MyShape); MyBrush.Dispose(); } } Glass reflection Glass reflection rectangle Creates a new instance. Creates a new instance using the specified thread name. A String representing the friendly name of the control. The thread name is dusplayed in the Visual Studio "Threads" debugging window. Multithreaded debugging can be simplified when threads are clearly and uniquely named. Cleans up any unmanaged GDI+ resources used during painting. Make Brushes Occurs when the control's effect has changed. Occurs when the control's size has changed. Occurs when the control's rotation has changed. Occurs when the compass direction associated with 0° has changed. Occurs when the control's orientation has changed. Create Graphics Create Polar Graphics Occurs when the control's background is painted. Occurs when additional painting is performed on top of the control's main content. Rotates the entire control to the specified value. Occurs when the desired animation frame rate has changed. Occurs when the rotation amount has changed. Occurs when the compass direction associated with 0° has changed. Occurs when the control's coordinate orientation has changed. Controls the special painting effect applied to the control. Controls the amount of rotation applied to the entire control. Returns the current amount of rotation during an animation. Controls the acceleration and deceleration technique used during rotation. Returns the compass direction which matches zero degrees. Returns the radius corresponding to the edge of the control. Controls the background color of the control. Returns the radius corresponding to the center of the control. Returns whether positive values are applied in a clockwise or counter-clockwise direction. Creates a new instance. Occurs when the Value property has changed. Indicates if the control should automatically display the current altitude. A Boolean, True if the control automatically displays the current altitude. When this property is enabled, the control will examine the CurrentAltitude property of the DotSpatial.Positioning.Gps.Devices class and update itself when the property changes. When disabled, the Value property must be set manually to change the control. Controls the font used for displaying altitude text. This property controls the font used to display altitude text on the control. To control the font of numbers drawn around the edge of the control, see the AltitudeLabelFont property. AltitudeLabelFont Property Controls the color of altitude text. This property controls the color of the altitude text on the control. To change the color of numbers drawn around the edge of the control, see the AltitudeLabelColor property. AltitudeLabelColor Property Controls how the control smoothly transitions from one value to another. Controls the format of altitude values. A String which is compatible with the ToString method of the Distance class. This property controls how text is output on the control. By default, the format is "v uu" where v represents the numeric portion of the altitude, and uu represents units. Controls the altitude to display on the control. A Distance structure measuring the altitude to display. Changing this property causes the needles on the control to move so that they represent the value. Controls the color of numbers around the edge of the control. This property controls the color of numbers around the edge of the control. To control the color of altitude text, see the ValueColor property. ValueColor Property Controls the font of numbers drawn around the edge of the control. This property controls the font used to draw numbers around the edge of the control. To control the font used to draw altitude text, see the ValueFont property. ValueFont Property Controls the color of smaller tick marks drawn around the edge of the control. Minor tick marks are drawn between major tick marks around the control. These tick marks can be made invisible by changing the color to Transparent. There are ten major tick marks in an altimeter, drawn next to numbers on the control. These tick marks can be made invisible by changing the color to Transparent. Controls the interior color of the tens-of-thousands needle. The tens-of-thousands needle is the smallest needle of the control. The interior can be made invisible by setting this property to Transparent. Controls the color of the interior of the thousands needle. Controls the color of the interior of the hundreds needle. Controls the color of the edge of the tens-of-thousands needle. Controls the color of the edge of the thousands needle. Controls the color of the edge of the hundreds needle. Controls the color of the shadow cast by the altitude needles. Controls the size of the shadow cast by the altitude needles. Indicates which time is displayed by the clock control. GPS satellite signals are used to display the current time. The computer's system clock is used to display the current time. A custom time will be displayed by setting the Value property manually. Represents a user control which displays the local or satellite-derived time. The constructor provides a name for the control. This name is used as the name of the thread if multithreading is enabled. Dispose This method is called whenever the control must be rendered. All rendering takes place off-screen, which prevents flickering. The "PolarControl" base class automatically handles tasks such as resizing and smoothing. All you have to be concerned with is calculating the polar coordinates to draw. Occurs when the value changes Controls the color of smaller tick marks drawn around the edge of the control. Minor tick marks are drawn between major tick marks around the control. These tick marks can be made invisible by changing the color to Transparent. There are ten major tick marks in an altimeter, drawn next to numbers on the control. These tick marks can be made invisible by changing the color to Transparent. Controls the font used to draw the hour labels around the edge of the clock. Controls the color of the shortest hand on the clock, representing hours. Controls the color of the minutes hand on the clock. Controls the color of the seconds hand on the clock. Controls the technique used to display the current time. Controls the amount of time allowed to elapse before the clock is refreshed with the latest time report. This property works only when the control is set to display the local machine's time. Controls the time being displayed by the device. Controls the color used to paint numeric labels for hours. Calculates intermediate colors between two other colors. This class is used to create a smooth transition from one color to another. After specifying a start color, end color, and number of intervals, the indexer will return a calculated Color. Specifying a greater number of intervals creates a smoother color gradient. Instances of this class are guaranteed to be thread-safe because the class uses thread synchronization. On the .NET Compact Framework, the alpha channel is not supported. This example uses a ColorInterpolator to calculate ten colors between (and including) Blue and Red . ' Create a New color interpolator Dim Interpolator As New ColorInterpolator(Color.Blue, Color.Red, 10) ' Output Each calculated color Dim i As Integer For i = 0 To 9 ' Get the Next color In the sequence Dim NewColor As Color = Interpolator(i) ' Output RGB values of this color Debug.Write(NewColor.R.ToString() + ",") Debug.Write(NewColor.G.ToString() + ",") Debug.WriteLine(NewColor.B.ToString()) Next i // Create a new color interpolator ColorInterpolator Interpolator = new ColorInterpolator(Color.Blue, Color.Red, 10); // Output each calculated color for (int i = 0; i < 10; i++) { // Get the next color in the sequence Color NewColor = Interpolator[i]; // Output RGB values of this color Console.Write(NewColor.R.ToString() + ","); Console.Write(NewColor.G.ToString() + ","); Console.WriteLine(NewColor.B.ToString()); } Creates a new instance. A Color at the start of the sequence. A Color at the end of the sequence. The total number of colors in the sequence, including the start and end colors. Returns a calculated color in the sequence. A Color value representing a calculated color. This example creates a new color interpolator between blue and red, then accesses the sixth item in the sequence. ' Create a New color interpolator Dim Interpolator As New ColorInterpolator(Color.Blue, Color.Red, 10) ' Access the sixth item Color CalculatedColor = Interpolator(5); // Create a New color interpolator ColorInterpolator Interpolator = new ColorInterpolator(Color.Blue, Color.Red, 10); // Access the sixth item Color CalculatedColor = Interpolator[5]; An Integer between 0 and Count minus one. Controls the interpolation technique used to calculate intermediate colors. An InterpolationMethod value indicating the interpolation technique. Default is Linear. This property controls the rate at which the start color transitions to the end color. Values other than Linear can "accelerate" and/or "decelerate" towards the end color. Controls the first color in the sequence. A Color object representing the first color in the sequence. Changing this property causes the entire sequence to be recalculated. This example changes the start color from Green to Orange. A Color object representing the last color in the sequence. Controls the last color in the sequence. Changing this property causes the entire sequence to be recalculated. Controls the number of colors in the sequence. Changing this property causes the entire sequence to be recalculated. An Integer indicating the total number of colors, including the start and end colors. Represents a user control used to display the current direction of travel. A compass control Occurs when the value changes Controls the direction that the needle points to. Controls how the control smoothly transitions from one value to another. Controls the number of degrees in between each label around the control. Controls the color of degree labels drawn around the control. Controls the font of degree labels drawn around the control. Controls the number of degrees in between each compass direction (i.e. \"N\", \"NW\") around the control. Controls the color of compass labels on the control. Controls the color of tick marks next to each direction label on the control. Controls whether the Value property is set manually, or automatically read from any available GPS device. Controls the font used to draw direction labels on the control. Controls the output format of labels drawn around the control. (i.e. h°m's\")" Controls the number of degrees in between each small tick mark around the control. Controls the color of smaller tick marks drawn around the control. Controls the number of degrees in between each larger tick mark around the control. Controls the color of larger tick marks drawn around the control. Controls the color of the interior of the needle which points North. Controls the color of the edge of the needle which points North. Controls the color of the interior of the needle which points South. Controls the color of the edge of the needle which points South. Controls the color of the shadow cast by the compass needle. Controls the size of the shadow cast by the compass needle. Represents information about a cancelable paint iteration. This class is used primarily by the OnPaintOffScreen method of the DoubleBufferedControl class when paint operations need to be performed. This class behaves the same as PaintEventArgs, but includes an extra IsCanceled property to indicate when a rendering iteration should be aborted. Creates a new instance using the specified Graphics object and clipping rectangle. A Graphics object used for all painting within the control. A Rectangle that defines the area that should be painted. Typically the size of the entire control. Indicates if the painting operation should be completely aborted. A Boolean, True if painting was aborted. Default is False. This property is used by controls which allow their paint operations to be cancelled. When set to True, the entire painting iteration is stopped and restarted. This property is useful if a control always needs to display the very latest information. Setting this property to True can have some undesirable affects. For example, if a paint iteration is cancelled repeatedly, the control will never get far enough in a paint operation to paint on-screen. Some care should be taken when using this property. This example demonstrates how to write a cancelable paint operation. It's typically a good idea to check for conditions which should cause a paint to cancel before beginning a time-consuming painting task. In this case, the IsPaintingAborted property is examined before entering a large loop. IsPaintingAborted becomes True when a new request to paint the control is made after starting the current paint iteration. Public Class MyControl Inherits DoubleBufferedControl Sub New() IsPaintingOnSeparateThread = True End Sub Protected Overrides Sub OnPaintOffScreen(ByVal e As CancelablePaintEventArgs) ' Should painting be cancelled? If IsPaintingAborted ' Yes. Abort all painting e.IsCanceled = True Exit Sub End If ' Otherwise, A big paint operation begins Dim Count As Integer For Count = 1 To 20000 Dim MyBrush As New SolidBrush(Color.Green) e.Graphics.DrawRectangle(MyBrush, New Rectangle(Count, Count, 5, 5)) MyBrush.Dispose() Next Count End Sub End Class public class MyControl : DoubleBufferedControl { MyControl() { IsPaintingOnSeparateThread = true; } protected override void OnPaintOffScreen(PaintEventArgs e) { // Should painting be cancelled? if (IsPaintingAborted) { // Yes. Abort all painting e.IsCanceled = true; return; } // Otherwise, A big paint operation begins for (int Count = 1; Count <= 20000; Count++) { SolidBrush MyBrush = new SolidBrush(Color.Green); e.Graphics.DrawRectangle(MyBrush, new Rectangle(Count, Count, 5, 5)); MyBrush.Dispose(); } } } Represents a collection of rendering performance and quality settings. This class is used to control the quality of all painting operations in GIS.NET. Settings are biased either towards rendering performance, quality, or a compromise between the two. The HighPerformance static member is used to paint quickly at the cost of quality; the HighQuality member paints better-looking results but painting operations require more time. The Balanced member provides minimal quality improvements while preserving moderate rendering speed. Represents graphics settings balanced between quality and rendering performance. A GraphicsSettings object. When this setting is used, painting operations will enable a few quality-improving features while still allowing for faster rendering performance. This quality setting is recommended for "draft" quality, where a more responsive map is preferable to quality. Represents graphics settings which maximize quality. A GraphicsSettings object. This is the default setting used by the GIS.NET rendering engine. All possible smoothing features are enabled, including anti-aliasing, bicubic image interpolation, and ClearText. With this setting, the smallest geographic features and even most text are readable. This setting is recommended for production use, as well as printing. Represents graphics settings which maximize rendering performance. A GraphicsSettings object. When this setting is used, all quality enhancement features are disabled. The resulting map will render more quickly, but the resulting quality will be hardly suitable for production use. This setting is best suited for situations where panning and zooming performance must have all possible speed. Creates a new instance. Creates a new instance using the specified settings. Applies the graphics settings to the specified grahpics container. A Graphics object. Controls the technique used to merge bitmap images. Controls the method used to calculate color values between pixels. Controls the amount of shift for each pixel to improve anti-aliasing. Controls the technique used to blend edges. Controls the technique used to smoothen the edges of text. Controls the amount of gamma correction applied to text. Indicates the special effect applied to polar controls during painting. No effect is applied. Additional painting is performed during OnPaintOffScreenBackground and OnPaintOffScreenAdornments to give the appearance of lighting and glass. Represents a coordinate measured relative to the center of a circle. Instances of this class are guaranteed to be thread-safe because the class is immutable (its properties can only be changed via constructors). Represents a polar coordinate with no value. Represents a polar coordinate at the center of a circle. Creates a new instance using the specified radius and angle. A Double indicating a radius. Increasing values represent a distance further away from the center of a circle. An Angle representing a direction from the center of a circle. The radius "r," when combined with an angle "theta" will create a coordinate relative to the center of a circle. By default, an angle of zero represents the top of the circle ("North") and increasing angles wind clockwise around the circle. Creates a new instance using the specified radius and angle. A Double indicating a radius. Increasing values represent a distance further away from the center of a circle. An Angle representing a direction from the center of a circle. The radius "r," when combined with an angle "theta" will create a coordinate relative to the center of a circle. By default, an angle of zero represents the top of the circle ("North") and increasing angles wind clockwise around the circle. Creates a new instance using the specified radius, angle, origin and winding direction. A Double indicating a radius. Increasing values represent a distance further away from the center of a circle. An Angle representing a direction from the center of a circle. An Azimuth indicating which compass direction is associated with zero degrees. (Typically North.) A PolarCoordinateOrientation value indicating whether increasing Theta values wind clockwise or counter-clockwise. The radius "r," when combined with an angle "theta" will create a coordinate relative to the center of a circle. The BearingOrigin will associate a compass direction with zero degrees (0°), but this value is typically "North". Creates a new Polar Coordinate Creates a new instance by converting the specified string. A String describing a polar coordinate in the current culture. Creates a new instance by converting the specified string. A String describing a polar coordinate in any culture. A CultureInfo object describing how to parse the specified string. Converts the current instance to a pixel coordinate. Converts the current instance to a precise pixel coordinate. Converts the current instance to a highly-precise pixel coordinate. Converts the current instance to a highly-precise Cartesian coordinate. Applies rotation to the existing coordinate. The amount of rotation to apply (above zero for clockwise). A PolarCoordinate adjusted by the specified rotation amount. Sets the rotation of the angle The angle to set the PolarCoordinate Returns the current instance adjusted to the specified orientation and origin. Parses the value as a PolarCoordinate Parses the value in the specified culter as a polar coordinate Customizes the string with a format provider Polar Coordinate string Point PointF PointD Returns Theta, the amount of clockwise rotation of the coordinate. Returns R, the distance away from the center of an imaginary circle. Returns the compass direction which matches zero degrees. Returns whether positive values are applied in a clockwise or counter-clockwise direction. Controls the winding direction of increasing angular values. This enumeration is used by the PolarCoordinate class to determine where a coordinate is on a circle. Increasing angles are further clockwise around the circle. Increasing angles are further counter-clockwise around the circle. Polar Coordinate Orientation Event Args Creates a new instance of the Polar coordinate orientation event arguments The orientation Encapsulates a GDI+ drawing surface using polar coordinates instead of pixel coordinates. Converts a polar coordinate to a pixel coordinate. Converts a polar coordinate to a highly-precise pixel coordinate. To Polar Coordinate To Polar Coordinate To Polar coordinate Converts the current instance into a polar coordinate. Converts a polar coordinate to a precise pixel coordinate. To PointF Erases the control's background to the specified color. Draws a single straight line. DrawString Draw String Draw Centered String Draw Centered String Draws a square or rectangular shape. Fills the interior of a circular shape. Draws a circular shape. Fills the interior of a closed shape. Converts an array of polar coordinates into a GraphicsPath object. Fills and outlines a polygon using the specified style. Draws a closed shape. Draws text rotated by the specified amount. Converts an array of polar coordinates to an array of pixel coordinates. Converts an array of polar coordinates to an array of precise pixel coordinates. Converts an array of polar coordinates to an array of highly-precise pixel coordinates. Draws a rounded line. Draws a rounded line that travels through several points. Draws multiple rounded lines that travels through several points. Draw Closed Curve Draw Closed Curve Draw Curve Draw Curve Returns the compass direction which matches zero degrees. Returns whether positive values are applied in a clockwise or counter-clockwise direction. Returns the value of R associated with the center of the control. Returns the value of R associated with the edge of the control. Returns the GDI+ drawing surface used for painting. Returns the amount of rotation applied to the entire control. Represents a control used to display satellite signal strengths. Satellite Signal Bar Controls the satellites which are currently being viewed in the control. Controls the number of pixels in between vertical satellite signal bars. Controls the color inside of satellite icons with no signal. Controls the color inside of satellite icons with a weak signal. Controls the color inside of satellite icons with a moderate signal. Controls the color inside of satellite icons with a strong signal. Controls the color inside of satellite icons with a very strong signal. Controls the color around satellite icons with no signal. Controls the color around satellite icons with a weak signal. Controls the color around satellite icons with a moderate signal. Controls the color around satellite icons with a strong signal. Controls the color around satellite icons with a very strong signal. Controls the color of the ellipse drawn around fixed satellites. Controls whether the Satellites property is set manually, or automatically read from any available GPS device. Controls the font used to draw the strength of each satellite. Controls the color used to draw the strength of each satellite. Controls the font used to draw the ID of each satellite. Controls the color used to draw the ID of each satellite. Controls whether controls are rotated to show the current bearing straight up. The control will be rotated so that North always points to the top of the screen. The control will be rotated so the the current bearing points to the top of the screen. Represents a user control used to display the location and signal strength of GPS satellites. Creates a new instance. Controls the amount of rotation applied to the entire control to indicate the current direction of travel. Controls whether the Satellites property is set manually, or automatically read from any available GPS device. Controls the number of degrees in between each smaller tick mark around the control. Controls the format of compass directions drawn around the control. Controls the number of degrees in between each larger tick mark around the control. Controls the color used to draw smaller tick marks around the control. Controls the color used to draw larger tick marks around the control. Controls the number of degrees in between each compass label around the control. Controls the color used to display compass direction letters around the control. Controls the font used to draw compass labels around the control. Controls the color inside of satellite icons with no signal. Controls the color inside of satellite icons with a weak signal. Controls the color inside of satellite icons with a moderate signal. Controls the color inside of satellite icons with a strong signal. Controls the color inside of satellite icons with a very strong signal. Controls the color around satellite icons with no signal. Controls the color around satellite icons with a weak signal. Controls the color around satellite icons with a moderate signal. Controls the color around satellite icons with a strong signal. Controls the color around satellite icons with a very strong signal. Controls the color of the ellipse drawn around fixed satellites. Controls which bearing points straight up on the screen. Contains the list of satellites drawn inside of the control. The Origin Azimuth angle The rotation angle Controls the color of the shadow cast by satellite icons. Controls the font used to display the ID of each satellite. Controls the color used to display the ID of each satellite. Represents a user control used to measure speed graphically. Speedometer Occurs when the value changed The azimuth angle of hte origin The rotation angle Gets or sets the spedometer needle color of the edge Gets or sets the needle fill color. The Needle Shadow Brush color intially semitransparent black. Controls the amount of speed being displayed in the control Controls how the control smoothly transitions from one value to another. Controls the fastest speed allowed by the control. Controls the amount of speed in between each label around the control. Controls the number of degrees in between each smaller tick mark around the control. Controls the number of degrees in between each larger tick mark around the control. the color of the minor ticks. Controls whether the speed label is drawn in the center of the control. Controls whether the Value property is set manually, or automatically read from any available GPS device. Gets or sets the Major Tick Color Controls the display format used for speed labels drawn around the control. Gets or sets the Speed Label font color Controls the angle associated with the smallest possible speed. Controls the angle associated with the largest possible speed.