# Dragged Point Style

**URL:** <https://community.thinkgeo.com/t/dragged-point-style/974>\
**Category:** WinForms\
**Created:** [January 19, 2010, 3:24am UTC](https://community.thinkgeo.com/t/dragged-point-style/974 "2010-01-19T03:24:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alta](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@alta](https://community.thinkgeo.com/u/alta)\
**Post date:** [January 19, 2010, 3:24am UTC](https://community.thinkgeo.com/t/dragged-point-style/974/1 "2010-01-19T03:24:53Z")

</div>

The&nbsp;"Dragged&nbsp;point&nbsp;style"&nbsp;is&nbsp;a&nbsp;great&nbsp;peace&nbsp;of&nbsp;code,&nbsp;but&nbsp;I&nbsp;would&nbsp;like&nbsp;to&nbsp;draw&nbsp;a&nbsp;point&nbsp;which&nbsp;I&nbsp;can&nbsp;drag.&nbsp;&nbsp;Furthermore,&nbsp;the&nbsp;point&nbsp;must&nbsp;have&nbsp;a&nbsp;label.&nbsp;Any&nbsp;help&nbsp;on&nbsp;this&nbsp;would&nbsp;be&nbsp;appreciated.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [January 19, 2010, 9:47am UTC](https://community.thinkgeo.com/t/dragged-point-style/974/2 "2010-01-19T09:47:46Z")

</div>

Hi&nbsp;Alta,

To&nbsp;drag&nbsp;a&nbsp;point&nbsp;by&nbsp;the&nbsp;DragInteractiveOverlay,&nbsp;you&nbsp;could&nbsp;add&nbsp;the&nbsp;point&nbsp;feature&nbsp;to&nbsp;the&nbsp;EditShapeLayer&nbsp;of&nbsp;DragInteractiveOverlay&nbsp;and&nbsp;set&nbsp;the&nbsp;CanDrag&nbsp;property&nbsp;to&nbsp;true.&nbsp;And&nbsp;to&nbsp;have&nbsp;a&nbsp;label&nbsp;for&nbsp;the&nbsp;point,&nbsp;you&nbsp;could&nbsp;set&nbsp;the&nbsp;text&nbsp;style&nbsp;of&nbsp;the&nbsp;EditShapeLayer.&nbsp;The&nbsp;code&nbsp;could&nbsp;be&nbsp;like&nbsp;this:  
&nbsp;  
`private void TestForm_Load(object sender, EventArgs e){    winformsMap1.MapUnit = GeographyUnit.DecimalDegree;    winformsMap1.CurrentExtent = new RectangleShape(-97.7591, 30.3126, -97.7317, 30.2964);    winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));    PointShape point = new PointShape(-97.74, 30.30);    //DragtInteractiveOverlay for setting the PointStyles of the control points and dragged points.    DragInteractiveOverlay dragInteractiveOverlay = new DragInteractiveOverlay();       // Add a column to EditShapeLayer.    dragInteractiveOverlay.EditShapesLayer.Open();    dragInteractiveOverlay.EditShapesLayer.Columns.Add(new FeatureSourceColumn("LabelColumn"));    dragInteractiveOverlay.EditShapesLayer.Close();    // Specify the label text.    Dictionary<string, string> columnValues = new Dictionary<string,string>();    columnValues.Add("LabelColumn", "LabelText");    // Add the point feature and specify text style.    dragInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("Point", new Feature(point, columnValues));    dragInteractiveOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = new TextStyle("LabelColumn", new GeoFont("Arial", 12), new GeoSolidBrush(GeoColor.SimpleColors.Black));    dragInteractiveOverlay.CanAddVertex = false;    dragInteractiveOverlay.CanRemoveVertex = false;    dragInteractiveOverlay.CanResize = false;    dragInteractiveOverlay.CanRotate = false;    dragInteractiveOverlay.CalculateAllControlPoints();    winformsMap1.EditOverlay = dragInteractiveOverlay;        winformsMap1.Refresh();}`  
&nbsp;  
Hope&nbsp;this&nbsp;helps&nbsp;and&nbsp;any&nbsp;more&nbsp;questions&nbsp;please&nbsp;let&nbsp;us&nbsp;know.  
&nbsp;  
Thanks,  
&nbsp;  
Sun

---

<div class="post-metadata">

**Author:** ![alta](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@alta](https://community.thinkgeo.com/u/alta)\
**Post date:** [January 20, 2010, 12:13am UTC](https://community.thinkgeo.com/t/dragged-point-style/974/3 "2010-01-20T00:13:17Z")

</div>

Fantastic,&nbsp;thanks!&nbsp;&nbsp;:)

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [January 20, 2010, 1:27am UTC](https://community.thinkgeo.com/t/dragged-point-style/974/4 "2010-01-20T01:27:26Z")

</div>

Alta,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;am&nbsp;glad&nbsp;that&nbsp;it’s&nbsp;working.&nbsp;And&nbsp;thank&nbsp;Sun’s&nbsp;help.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;want&nbsp;to&nbsp;close&nbsp;this&nbsp;post&nbsp;if&nbsp;you&nbsp;have&nbsp;no&nbsp;more&nbsp;questions.&nbsp;  
&nbsp;&nbsp;  
&nbsp;James

---

<div class="post-metadata">

**Author:** ![Gary4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/gary4/32/24993_2.png) [@Gary4](https://community.thinkgeo.com/u/Gary4)\
**Post date:** [October 3, 2011, 12:02pm UTC](https://community.thinkgeo.com/t/dragged-point-style/974/5 "2011-10-03T12:02:55Z")

</div>

Hi,&nbsp;when&nbsp;trying&nbsp;to&nbsp;add&nbsp;a&nbsp;point&nbsp;and&nbsp;drag&nbsp;it&nbsp;I&nbsp;just&nbsp;end&nbsp;up&nbsp;panning&nbsp;the&nbsp;map.&nbsp;Do&nbsp;you&nbsp;have&nbsp;to&nbsp;create&nbsp;controls&nbsp;to&nbsp;toggle&nbsp;between&nbsp;dragging&nbsp;and&nbsp;panning?

---

<div class="post-metadata">

**Author:** ![Clint](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@Clint](https://community.thinkgeo.com/u/Clint)\
**Post date:** [October 3, 2011, 12:18pm UTC](https://community.thinkgeo.com/t/dragged-point-style/974/6 "2011-10-03T12:18:39Z")

</div>

&nbsp;Gary,

If&nbsp;you&nbsp;want&nbsp;the&nbsp;point&nbsp;to&nbsp;be&nbsp;draggable&nbsp;you&nbsp;will&nbsp;need&nbsp;to&nbsp;create&nbsp;a&nbsp;MarkerOverlay&nbsp;to&nbsp;contain&nbsp;these&nbsp;points.&nbsp;&nbsp;To&nbsp;check&nbsp;out&nbsp;how&nbsp;the&nbsp;MarkerOverlay&nbsp;works&nbsp;with&nbsp;dragging&nbsp;you&nbsp;can&nbsp;look&nbsp;at&nbsp;the&nbsp;"Use&nbsp;a&nbsp;Draggable&nbsp;Marker"&nbsp;sample&nbsp;under&nbsp;the&nbsp;Markers&nbsp;section&nbsp;in&nbsp;the&nbsp;How&nbsp;Do&nbsp;I&nbsp;Samples.

I&nbsp;hope&nbsp;this&nbsp;helps.

Thanks!

---

<div class="post-metadata">

**Author:** ![Gary4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/gary4/32/24993_2.png) [@Gary4](https://community.thinkgeo.com/u/Gary4)\
**Post date:** [October 3, 2011, 12:34pm UTC](https://community.thinkgeo.com/t/dragged-point-style/974/7 "2011-10-03T12:34:36Z")

</div>

I’ve&nbsp;looked&nbsp;at&nbsp;the&nbsp;“Dragged&nbsp;Point&nbsp;Style”&nbsp;sample.&nbsp;There&nbsp;is&nbsp;a&nbsp;custom&nbsp;Overlay&nbsp;class&nbsp;called&nbsp;DragInteractiveOverlay,&nbsp;the&nbsp;one&nbsp;mentioned&nbsp;earlier&nbsp;in&nbsp;this&nbsp;post.&nbsp;Everything&nbsp;in&nbsp;the&nbsp;sample&nbsp;works&nbsp;fine,&nbsp;but&nbsp;when&nbsp;I&nbsp;try&nbsp;to&nbsp;add&nbsp;a&nbsp;new&nbsp;point&nbsp;on&nbsp;the&nbsp;overlay&nbsp;with:&nbsp;  
&nbsp;PointShape&nbsp;point&nbsp;=&nbsp;new&nbsp;PointShape(-97.74,&nbsp;30.30);&nbsp;  
&nbsp;dragInteractiveOverlay.EditShapesLayer.InternalFeatures.Add(“Point”,&nbsp;new&nbsp;Feature(point));&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;found&nbsp;this&nbsp;new&nbsp;point&nbsp;cannot&nbsp;be&nbsp;dragged&nbsp;untill&nbsp;another&nbsp;point&nbsp;is&nbsp;dragged&nbsp;first.&nbsp;  
&nbsp;It’s&nbsp;weird,&nbsp;if&nbsp;I&nbsp;click&nbsp;on&nbsp;this&nbsp;new&nbsp;point&nbsp;and&nbsp;try&nbsp;to&nbsp;drag&nbsp;it&nbsp;the&nbsp;screen&nbsp;pans.&nbsp;  
&nbsp;But&nbsp;if&nbsp;I&nbsp;drag&nbsp;one&nbsp;of&nbsp;the&nbsp;default&nbsp;point&nbsp;set&nbsp;up&nbsp;with&nbsp;the&nbsp;original&nbsp;sample&nbsp;I&nbsp;am&nbsp;now&nbsp;allowed&nbsp;to&nbsp;drag&nbsp;the&nbsp;new&nbsp;point&nbsp;I’ve&nbsp;created.

---

<div class="post-metadata">

**Author:** ![Clint](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@Clint](https://community.thinkgeo.com/u/Clint)\
**Post date:** [October 3, 2011, 12:42pm UTC](https://community.thinkgeo.com/t/dragged-point-style/974/8 "2011-10-03T12:42:21Z")

</div>

&nbsp;Gary,

I&nbsp;think&nbsp;you&nbsp;are&nbsp;looking&nbsp;at&nbsp;the&nbsp;wrong&nbsp;sample,&nbsp;the&nbsp;code&nbsp;in&nbsp;this&nbsp;post&nbsp;is&nbsp;old&nbsp;and&nbsp;there&nbsp;is&nbsp;an&nbsp;easier&nbsp;way&nbsp;to&nbsp;add&nbsp;draggable&nbsp;markers&nbsp;now.&nbsp;&nbsp;I&nbsp;was&nbsp;refering&nbsp;to&nbsp;the&nbsp;sample&nbsp;included&nbsp;in&nbsp;the&nbsp;How&nbsp;Do&nbsp;I&nbsp;Samples&nbsp;that&nbsp;get&nbsp;installed&nbsp;when&nbsp;you&nbsp;first&nbsp;downloaded&nbsp;the&nbsp;product.&nbsp;&nbsp;Here&nbsp;is&nbsp;the&nbsp;code&nbsp;from&nbsp;that&nbsp;sample&nbsp;that&nbsp;shows&nbsp;two&nbsp;points&nbsp;that&nbsp;can&nbsp;be&nbsp;dragged:

`            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;            winformsMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);            WorldMapKitWmsDesktopOverlay worldMapKitOverlay = new WorldMapKitWmsDesktopOverlay();            winformsMap1.Overlays.Add(worldMapKitOverlay);            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();            markerOverlay.MapControl = winformsMap1;            markerOverlay.DragMode = MarkerDragMode.Drag;            winformsMap1.Overlays.Add("MarkerOverlay", markerOverlay);            Marker marker = new Marker(-95.2806, 38.9554);            marker.Image = Properties.Resources.AQUA;            marker.Width = 20;            marker.Height = 34;            marker.YOffset = -17;            markerOverlay.Markers.Add(marker);            Marker marker2 = new Marker(-97.74, 30.30);            marker2.Image = Properties.Resources.AQUA;            marker2.Width = 20;            marker2.Height = 34;            marker2.YOffset = -17;            markerOverlay.Markers.Add(marker2);            winformsMap1.Refresh();`

---

<div class="post-metadata">

**Author:** ![Gary4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/gary4/32/24993_2.png) [@Gary4](https://community.thinkgeo.com/u/Gary4)\
**Post date:** [October 3, 2011, 12:47pm UTC](https://community.thinkgeo.com/t/dragged-point-style/974/9 "2011-10-03T12:47:58Z")

</div>

Hi,&nbsp;I&nbsp;figured&nbsp;out&nbsp;how&nbsp;the&nbsp;old&nbsp;code&nbsp;works.&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;you&nbsp;have&nbsp;to&nbsp;add&nbsp;this&nbsp;line&nbsp;of&nbsp;code&nbsp;to&nbsp;where&nbsp;you&nbsp;are&nbsp;creating&nbsp;the&nbsp;new&nbsp;point:&nbsp;&nbsp;  
&nbsp;dragInteractiveOverlay.CalculateAllControlPoints();&nbsp;  
&nbsp;&nbsp;  
&nbsp;but&nbsp;this&nbsp;new&nbsp;markerOverlay&nbsp;looks&nbsp;better.&nbsp;Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;help.

---

<div class="post-metadata">

**Author:** ![Clint](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@Clint](https://community.thinkgeo.com/u/Clint)\
**Post date:** [October 3, 2011, 12:59pm UTC](https://community.thinkgeo.com/t/dragged-point-style/974/10 "2011-10-03T12:59:42Z")

</div>

Thanks&nbsp;Gary,&nbsp;glad&nbsp;you&nbsp;got&nbsp;it&nbsp;working.
