Hi,
I am applying blinking effect to Feature Label(BlinkingTextStyle). it’s working fine.
But while trying to close the application. it’s closing whole project.
Error Message:
Code:
BlinkingTextStyle blinkingTextStyle = new BlinkingTextStyle();
blinkingTextStyle.FillBrushes.Add(GeoBrushes.Red);
blinkingTextStyle.FillBrushes.Add(new GeoSolidBrush(GeoColor.FromArgb(0, 255, 255, 255)));
blinkingTextStyle.OverlappingRule = LabelOverlappingRule.AllowOverlapping;
blinkingTextStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels;
imBlinkAircraft.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(blinkingTextStyle);
imBlinkAircraft.DrawingMarginPercentage = 50;
imBlinkAircraft.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay blinkingOverlay = new LayerOverlay() { AutoRefreshInterval = TimeSpan.FromMilliseconds(200) };
blinkingOverlay.Layers.Add("BlinkAircraftLayer", imBlinkAircraft);
wfMap.Overlays.Add("BlinkAircraftOverlay", blinkingOverlay);
wfMap.OverlaysDrawing += wfMap_OverlaysDrawing;
wfMap.OverlaysDrawn += wfMap_OverlaysDrawn;
public class BlinkingTextStyle : TextStyle
{
private Collection candidates =new Collection();
protected override void DrawCore(IEnumerable features, GeoCanvas canvas, System.Collections.ObjectModel.Collection labelsInThisLayer, System.Collections.ObjectModel.Collection labelsInAllLayers)
{
foreach (var feature in features)
{
if (feature.ColumnValues[“BlinkONOFF”].ToString() == “ON”)
canvas.DrawText(feature.ColumnValues[“AircraftIconType”].ToString(), new GeoFont(“Aircraft_b”, (float)Convert.ToDouble(feature.ColumnValues[“AircraftFontSize”].ToString()), DrawingFontStyles.Regular), GetFillBrush(), new GeoPen(GeoColor.FromArgb(0, 255, 255, 255)), new Collection { ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, (PointShape)feature.GetShape(), canvas.Width, canvas.Height) }, DrawingLevel, 0, 0, (float)Convert.ToDouble(feature.ColumnValues[“HDirection”].ToString()));
}
}
public Collection<GeoBrush> FillBrushes
{
get { return candidates; }
}
private GeoBrush GetFillBrush()
{
Random random = new Random();
int index = random.Next(candidates.Count);
return candidates[index];
}
}
Even though while closing application event, i am disable Map drawn events.
private void frmHSDPlotNew_FormClosing(object sender, FormClosingEventArgs e)
{
wfMap.OverlaysDrawing -= wfMap_OverlaysDrawing;
wfMap.OverlaysDrawn -= wfMap_OverlaysDrawn;
}
Please suggest me, what actually problem and how can we resolve it.
Thanks,
Riyaz