# Styles

**URL:** <https://community.thinkgeo.com/t/styles/293>\
**Category:** WinForms\
**Created:** [March 20, 2009, 6:20am UTC](https://community.thinkgeo.com/t/styles/293 "2009-03-20T06:20:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ted](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@Ted](https://community.thinkgeo.com/u/Ted)\
**Post date:** [March 20, 2009, 6:20am UTC](https://community.thinkgeo.com/t/styles/293/1 "2009-03-20T06:20:51Z")

</div>

I'm&nbsp;starting&nbsp;to&nbsp;explore&nbsp;styles.&nbsp;&nbsp;&nbsp;I&nbsp;have&nbsp;layers&nbsp;where&nbsp;I&nbsp;want&nbsp;all&nbsp;objects&nbsp;on&nbsp;the&nbsp;layer&nbsp;to&nbsp;be&nbsp;represented&nbsp;by&nbsp;a&nbsp;single&nbsp;set&nbsp;of&nbsp;styles...&nbsp;a&nbsp;areastyle&nbsp;to&nbsp;fill&nbsp;the&nbsp;polygons&nbsp;(if&nbsp;the&nbsp;data&nbsp;is&nbsp;polygonal)&nbsp;and&nbsp;an&nbsp;alternative&nbsp;style&nbsp;to&nbsp;display&nbsp;dots&nbsp;if&nbsp;the&nbsp;data&nbsp;is&nbsp;points.&nbsp;&nbsp;&nbsp;And&nbsp;I&nbsp;want&nbsp;two&nbsp;labels&nbsp;on&nbsp;each&nbsp;object,&nbsp;one&nbsp;above&nbsp;and&nbsp;one&nbsp;below&nbsp;the&nbsp;centroid.

I&nbsp;understand&nbsp;how&nbsp;to&nbsp;do&nbsp;this&nbsp;for&nbsp;individual&nbsp;breaks&nbsp;in&nbsp;a&nbsp;class&nbsp;break&nbsp;style,&nbsp;or&nbsp;individual&nbsp;members&nbsp;of&nbsp;a&nbsp;value&nbsp;style.&nbsp;&nbsp;&nbsp;But&nbsp;what&nbsp;object&nbsp;do&nbsp;I&nbsp;create&nbsp;that&nbsp;just&nbsp;has&nbsp;a&nbsp;single&nbsp;customstyles&nbsp;collection&nbsp;that&nbsp;gets&nbsp;applied&nbsp;to&nbsp;all&nbsp;objects?&nbsp;&nbsp;&nbsp;I&nbsp;have&nbsp;not&nbsp;found&nbsp;an&nbsp;example&nbsp;where&nbsp;you&nbsp;place&nbsp;multiple&nbsp;labels&nbsp;on&nbsp;a&nbsp;map.&nbsp;

In&nbsp;many&nbsp;of&nbsp;your&nbsp;examples,&nbsp;you&nbsp;create&nbsp;two&nbsp;feature&nbsp;layers...&nbsp;one&nbsp;for&nbsp;the&nbsp;geometries,&nbsp;and&nbsp;one&nbsp;for&nbsp;the&nbsp;labels.&nbsp;&nbsp;&nbsp;Is&nbsp;that&nbsp;really&nbsp;required?&nbsp;&nbsp;Is&nbsp;that&nbsp;how&nbsp;you&nbsp;ensure&nbsp;that&nbsp;labels&nbsp;for&nbsp;one&nbsp;geometry&nbsp;don't&nbsp;get&nbsp;overwritten&nbsp;by&nbsp;a&nbsp;neighboring&nbsp;geometry&nbsp;that&nbsp;is&nbsp;drawn&nbsp;later?

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [March 25, 2009, 12:50pm UTC](https://community.thinkgeo.com/t/styles/293/2 "2009-03-25T12:50:42Z")

</div>

Ted,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;kind&nbsp;of&nbsp;a&nbsp;tricky&nbsp;question&nbsp;as&nbsp;it&nbsp;has&nbsp;a&nbsp;few&nbsp;parts.&nbsp;  
&nbsp;&nbsp;  
&nbsp;1.On&nbsp;the&nbsp;multiple&nbsp;labels&nbsp;what&nbsp;you&nbsp;need&nbsp;to&nbsp;do&nbsp;is&nbsp;use&nbsp;the&nbsp;CustomStyles&nbsp;collection&nbsp;and&nbsp;add&nbsp;two&nbsp;TextStyles&nbsp;to&nbsp;it.&nbsp;&nbsp;On&nbsp;for&nbsp;the&nbsp;first&nbsp;label&nbsp;and&nbsp;one&nbsp;for&nbsp;the&nbsp;second.&nbsp;&nbsp;I&nbsp;have&nbsp;a&nbsp;feeling&nbsp;I&nbsp;am&nbsp;missing&nbsp;your&nbsp;point&nbsp;so&nbsp;if&nbsp;so&nbsp;let&nbsp;me&nbsp;know&nbsp;a&nbsp;little&nbsp;more&nbsp;detail.&nbsp;&nbsp;I&nbsp;can&nbsp;be&nbsp;thick&nbsp;sometimes.&nbsp;  
&nbsp;&nbsp;  
&nbsp;2.We&nbsp;suggest&nbsp;that&nbsp;you&nbsp;separate&nbsp;the&nbsp;layers&nbsp;that&nbsp;draw&nbsp;geometries&nbsp;and&nbsp;labels.&nbsp;&nbsp;While&nbsp;this&nbsp;is&nbsp;not&nbsp;required&nbsp;we&nbsp;suggest&nbsp;it&nbsp;so&nbsp;that&nbsp;if&nbsp;you&nbsp;have&nbsp;multiple&nbsp;geometry&nbsp;layers&nbsp;the&nbsp;labels&nbsp;for&nbsp;them&nbsp;always&nbsp;draw&nbsp;on&nbsp;top.&nbsp;&nbsp;In&nbsp;the&nbsp;case&nbsp;where&nbsp;you&nbsp;must&nbsp;or&nbsp;want&nbsp;draw&nbsp;text&nbsp;and&nbsp;geometries&nbsp;on&nbsp;the&nbsp;same&nbsp;layer&nbsp;then&nbsp;what&nbsp;we&nbsp;need&nbsp;to&nbsp;do&nbsp;is&nbsp;to&nbsp;enhance&nbsp;the&nbsp;TextStyle&nbsp;to&nbsp;allow&nbsp;it&nbsp;to&nbsp;draw&nbsp;on&nbsp;a&nbsp;different&nbsp;DrawingLevel.&nbsp;&nbsp;Let&nbsp;me&nbsp;explain&nbsp;this.&nbsp;&nbsp;&nbsp;Inside&nbsp;of&nbsp;a&nbsp;style&nbsp;we&nbsp;ultimately&nbsp;make&nbsp;a&nbsp;call&nbsp;to&nbsp;the&nbsp;GeoCanvas&nbsp;to&nbsp;do&nbsp;the&nbsp;actual&nbsp;drawing.&nbsp;&nbsp;In&nbsp;the&nbsp;GeoCanvas&nbsp;method&nbsp;calls&nbsp;to&nbsp;draw&nbsp;you&nbsp;specify&nbsp;a&nbsp;DrawingLevel,&nbsp;it&nbsp;is&nbsp;1-4.&nbsp;&nbsp;These&nbsp;drawing&nbsp;levels&nbsp;represent&nbsp;four&nbsp;different&nbsp;bitmaps&nbsp;that&nbsp;you&nbsp;can&nbsp;draw&nbsp;to&nbsp;in&nbsp;a&nbsp;stack.&nbsp;&nbsp;It&nbsp;is&nbsp;used&nbsp;to&nbsp;get&nbsp;certain&nbsp;effects&nbsp;for&nbsp;roads.&nbsp;&nbsp;For&nbsp;example&nbsp;if&nbsp;you&nbsp;have&nbsp;a&nbsp;road&nbsp;that&nbsp;is&nbsp;drawn&nbsp;by&nbsp;a&nbsp;thick&nbsp;black&nbsp;line&nbsp;then&nbsp;a&nbsp;thinner&nbsp;white&nbsp;line&nbsp;we&nbsp;need&nbsp;this&nbsp;kind&nbsp;of&nbsp;thing.&nbsp;&nbsp;If&nbsp;we&nbsp;first&nbsp;drew&nbsp;record&nbsp;one&nbsp;and&nbsp;drew&nbsp;the&nbsp;black&nbsp;thick&nbsp;line&nbsp;then&nbsp;draw&nbsp;the&nbsp;white&nbsp;line&nbsp;on&nbsp;top&nbsp;of&nbsp;it&nbsp;using&nbsp;the&nbsp;same&nbsp;level&nbsp;then&nbsp;went&nbsp;to&nbsp;record&nbsp;two&nbsp;etc&nbsp;the&nbsp;effect&nbsp;would&nbsp;not&nbsp;look&nbsp;good.&nbsp;&nbsp;Instead&nbsp;what&nbsp;we&nbsp;do&nbsp;is&nbsp;draw&nbsp;the&nbsp;black&nbsp;thick&nbsp;line&nbsp;on&nbsp;drawing&nbsp;level&nbsp;one&nbsp;and&nbsp;then&nbsp;the&nbsp;white&nbsp;line&nbsp;on&nbsp;drawing&nbsp;level&nbsp;2.&nbsp;&nbsp;At&nbsp;the&nbsp;end&nbsp;of&nbsp;all&nbsp;the&nbsp;records&nbsp;we&nbsp;combine&nbsp;all&nbsp;of&nbsp;them&nbsp;together&nbsp;and&nbsp;get&nbsp;the&nbsp;nice&nbsp;effect&nbsp;we&nbsp;want.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;The&nbsp;problem&nbsp;you&nbsp;are&nbsp;seeing&nbsp;is&nbsp;because&nbsp;if&nbsp;you&nbsp;use&nbsp;a&nbsp;text&nbsp;style&nbsp;and&nbsp;area&nbsp;style&nbsp;on&nbsp;the&nbsp;same&nbsp;layer&nbsp;the&nbsp;two&nbsp;styles&nbsp;are&nbsp;more&nbsp;than&nbsp;likely&nbsp;using&nbsp;drawing&nbsp;level&nbsp;one.&nbsp;&nbsp;If&nbsp;instead&nbsp;we&nbsp;make&nbsp;the&nbsp;text&nbsp;style&nbsp;use&nbsp;drawing&nbsp;level&nbsp;4&nbsp;then&nbsp;the&nbsp;geometries&nbsp;would&nbsp;always&nbsp;draw&nbsp;below&nbsp;them&nbsp;no&nbsp;matter&nbsp;what&nbsp;record&nbsp;number.&nbsp;&nbsp;I&nbsp;hope&nbsp;you&nbsp;understand,&nbsp;it&nbsp;is&nbsp;a&nbsp;hard&nbsp;thing&nbsp;to&nbsp;explain.&nbsp;&nbsp;The&nbsp;problem&nbsp;is&nbsp;that&nbsp;the&nbsp;TextStyle&nbsp;defaults&nbsp;to&nbsp;drawing&nbsp;level&nbsp;one.&nbsp;&nbsp;What&nbsp;we&nbsp;would&nbsp;need&nbsp;to&nbsp;do&nbsp;is&nbsp;change&nbsp;this&nbsp;to&nbsp;level&nbsp;4&nbsp;to&nbsp;be&nbsp;safe&nbsp;and&nbsp;also&nbsp;maybe&nbsp;expose&nbsp;this&nbsp;as&nbsp;a&nbsp;property&nbsp;that&nbsp;people&nbsp;could&nbsp;easily&nbsp;set.&nbsp;&nbsp;This&nbsp;problem&nbsp;comes&nbsp;up&nbsp;over&nbsp;and&nbsp;over&nbsp;and&nbsp;we&nbsp;should&nbsp;make&nbsp;this&nbsp;change.&nbsp;&nbsp;Let&nbsp;me&nbsp;see&nbsp;if&nbsp;I&nbsp;can&nbsp;get&nbsp;you&nbsp;a&nbsp;stop&nbsp;gap&nbsp;measure&nbsp;if&nbsp;you&nbsp;really&nbsp;need&nbsp;this.&nbsp;&nbsp;Let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;David&nbsp;

---

<div class="post-metadata">

**Author:** ![David\_Edwardson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@David\_Edwardson](https://community.thinkgeo.com/u/David_Edwardson)\
**Post date:** [May 1, 2009, 10:19am UTC](https://community.thinkgeo.com/t/styles/293/3 "2009-05-01T10:19:09Z")

</div>

I&nbsp;too&nbsp;am&nbsp;hitting&nbsp;this&nbsp;and&nbsp;would&nbsp;appreciate&nbsp;being&nbsp;able&nbsp;to&nbsp;set&nbsp;the&nbsp;drawing&nbsp;level&nbsp;for&nbsp;a&nbsp;style.&nbsp;&nbsp;Any&nbsp;idea&nbsp;when&nbsp;the&nbsp;next&nbsp;version&nbsp;(beta&nbsp;or&nbsp;final)&nbsp;is&nbsp;coming?&nbsp;&nbsp;I&nbsp;know&nbsp;there&nbsp;are&nbsp;multi-threading&nbsp;issues,&nbsp;just&nbsp;looking&nbsp;for&nbsp;an&nbsp;update.

---

<div class="post-metadata">

**Author:** ![Lee](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/l/bc8723/32.png) [@Lee](https://community.thinkgeo.com/u/Lee)\
**Post date:** [May 5, 2009, 6:24am UTC](https://community.thinkgeo.com/t/styles/293/4 "2009-05-05T06:24:45Z")

</div>

David,&nbsp;  
  
  
  
We&nbsp;plan&nbsp;to&nbsp;release&nbsp;the&nbsp;next&nbsp;Beta&nbsp;middle&nbsp;this&nbsp;month.&nbsp;  
  
  
  
ThinkGeo&nbsp;Support&nbsp;  
  
&nbsp;
