<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>oliana.de &#187; Programmierung</title>
	<atom:link href="http://oliana.de/blog/category/programmierung/feed/" rel="self" type="application/rss+xml" />
	<link>http://oliana.de/blog</link>
	<description>Das Problem zwischen Stuhl und Bildschirm</description>
	<lastBuildDate>Sun, 29 Jan 2012 17:41:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fehler in der Fensterbehandlung von WPF</title>
		<link>http://oliana.de/blog/2009/10/02/fehler-in-der-fensterbehandlung-von-wpf-2/</link>
		<comments>http://oliana.de/blog/2009/10/02/fehler-in-der-fensterbehandlung-von-wpf-2/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 08:41:46 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/2009/10/02/fehler-in-der-fensterbehandlung-von-wpf-2/</guid>
		<description><![CDATA[Gerade habe ich einen kleinen Fehler in WPF entdeckt. Scheinbar ist es so, dass Fensterinstanzen bei der Instanziierung schon zur WindowCollection hinzugefügt werden und nicht erst wenn Sie geöffnet werden. Dadurch muss man Sie erst entfernen, bevor man das Programm beenden kann, da es ansonsten denkt, dass noch ein Fenster offen ist. Entdeckt habe ich [...]]]></description>
			<content:encoded><![CDATA[<p>Gerade habe ich einen kleinen Fehler in WPF entdeckt. Scheinbar ist es so, dass Fensterinstanzen bei der Instanziierung schon zur WindowCollection hinzugefügt werden und nicht erst wenn Sie geöffnet werden. Dadurch muss man Sie erst entfernen, bevor man das Programm beenden kann, da es ansonsten denkt, dass noch ein Fenster offen ist.</p>
<p><span id="more-252"></span></p>
<p>Entdeckt habe ich das ganze bei einem Projekt in dem ich eine neue Instanz eines Fensters erstellt habe, ohne es zu öffnen (über die Gründe will ich jetzt mal nichts sagen – ich weiß, dass das an sich ne blöde Idee ist…). Nachdem ich das Programm gestartet habe, konnte ich zwar alle Fenster schließen, aber der Prozess lief immer weiter.</p>
<p>Nach etwas debuggen habe ich dann herausgefunden, dass immer noch eine Referenz zum Fenster vorhanden ist, obwohl dieses gar nicht mehr existiert. Dadurch kann das Programm natürlich nicht beendet werden, da es denkt, das noch irgendwo ein Fenster offen ist.</p>
<p>Die Referenz zum Fenster in der WindowCollection der Anwendung wird scheinbar dann entfernt, wenn Window.Close() aufgerufen wird.</p>
<p>Ein sehr interessantes Phänomen, auf das man erst mal kommen muss…</p>
<h2>Update:</h2>
<p>Nachdem ich dafür einen Bug bei Microsoft Connect erstellt habe, kam nun die Antwort, dass das Verhalten “bei Design” ist. Komisch, ist aber so…</p>
<p>Zitat:</p>
<blockquote><p>This behavior is probably by design. Application has a property called &#8220;ShutdownMode&#8221; that has a default value of OnLastWindowClose. Creating a window is sufficient to register it for keeping the application alive, even if it is never shown.<br />
Depending on your scenario another value for ShutdownMode may be appropriate.<br />
Hope that helps,</p></blockquote>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:853aab67-2a47-4827-94f9-0cb928419e86" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">Technorati-Tags: <a rel="tag" href="http://technorati.com/tags/software">software</a>,<a rel="tag" href="http://technorati.com/tags/c%23">c#</a>,<a rel="tag" href="http://technorati.com/tags/wpf">wpf</a></div>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2009/10/02/fehler-in-der-fensterbehandlung-von-wpf-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maskedtextbox in WPF implementieren</title>
		<link>http://oliana.de/blog/2009/07/29/maskedtextbox-in-wpf-implementieren/</link>
		<comments>http://oliana.de/blog/2009/07/29/maskedtextbox-in-wpf-implementieren/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 13:21:57 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/?p=237</guid>
		<description><![CDATA[Heute beschreibe ich mal, wie man in WPF ein Control erstellt, dass von TextBox erbt und die Funktionalität einer Maskedtextbox bietet. Als ich vor kurzem diese Funktionalität brauchte hat sich herausgestellt, dass das ganze innerhalb von kurzer Zeit erledigt werden kann. Zunächst erzeugt man in Visual Studio ein entsprechendes Projekt mit der Vorlage WPF-Benutzersteuerelementbibliothek. In [...]]]></description>
			<content:encoded><![CDATA[<p>Heute beschreibe ich mal, wie man in WPF ein Control erstellt, dass von TextBox erbt und die Funktionalität einer Maskedtextbox bietet. Als ich vor kurzem diese Funktionalität brauchte hat sich herausgestellt, dass das ganze innerhalb von kurzer Zeit erledigt werden kann.</p>
<p> <span id="more-237"></span>
</p>
<ol>
<li>Zunächst erzeugt man in Visual Studio ein entsprechendes Projekt mit der Vorlage WPF-Benutzersteuerelementbibliothek. </li>
<li>In diesem Projekt kann man das automatisch erzeugte UserControl1 guten Gewissens entfernen (wir wollen ja ein WPF-Steuerelement erstellen). </li>
<li>Dafür muss man unser WPF-Steuerelement hinzufügen. (Einfügen –&gt; neues Element –&gt; Benutzersteuerelement) </li>
<li>Jetzt geht es darum, aus dem Usercontrol ein Steuerelement zu machen, welches von der Standard-TextBox erbt, damit man die ganzen Standard Geschichten schon fertig hat. Dazu einfach im XAML-Code UserControl durch TextBox ersetzen, und alle Attribute außer den namespaces und dem Klassennamen entfernen, so dass es in etwa so ausschaut:
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5a579f08-8001-485d-945e-e246591268a5" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">TextBox </span><span style="color: #FF0000;">x:Class</span><span style="color: #0000FF;">="Denis.WPF_Controls.MaskedTextBoxWPF"</span><span style="color: #FF0000;">
    xmlns</span><span style="color: #0000FF;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><span style="color: #FF0000;">
    xmlns:x</span><span style="color: #0000FF;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><span style="color: #FF0000;">
</span><span style="color: #0000FF;">/&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>Dadurch sagen wir einfach, dass wir ein Steuerelement erzeugen dass von TextBox erbt. Da es ja auch noch eine entsprechende CodeDatei gibt müssen wir dort ebenfalls sagen, dass wir nicht mehr die partielle Klasse UserControl erweitern, sondern Textbox:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b2df5a21-75f0-4068-abcb-6f0d5ec7ca91" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">partial</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> MaskedTextBoxWPF : UserControl
</span><span style="color: #008000;">//</span><span style="color: #008000;">ersetzen durch</span><span style="color: #008000;">
</span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">partial</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> MaskedTextBoxWPF : TextBox</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</li>
<li>Jetzt brauchen wir noch ein paar Events die wir behandeln um abzufangen wenn Text eingegeben, gelöscht und eingefügt (copy/paste) wird. Dazu einfach den XAML-Code so erweitern:
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a1c6b245-442f-47bb-93ea-299407f12939" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">TextBox </span><span style="color: #FF0000;">x:Class</span><span style="color: #0000FF;">="Denis.WPF_Controls.MaskedTextBoxWPF"</span><span style="color: #FF0000;">
    xmlns</span><span style="color: #0000FF;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><span style="color: #FF0000;">
    xmlns:x</span><span style="color: #0000FF;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><span style="color: #FF0000;">
    DataObject.Pasting</span><span style="color: #0000FF;">="TextBox_Pasting"</span><span style="color: #FF0000;">
    PreviewTextInput</span><span style="color: #0000FF;">="TextBox_PreviewTextInput"</span><span style="color: #FF0000;">
    KeyDown</span><span style="color: #0000FF;">="TextBox_KeyDown"</span><span style="color: #FF0000;">
</span><span style="color: #0000FF;">/&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</li>
<li>Als erstes brauchen wir eine Klassen-Variable, welche den MaskedTextBoxProvider enthält (wofür ein Verweis auf SystemComponentModel benötigt wird). Diese wird dann im Konstruktor mit einer Standardmaske gefüllt und dann initialisiert:
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5f0af161-7a69-49c0-a8fc-d951b44b6ddf" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #000000;">MaskedTextProvider mktProvider;

</span><span style="color: #0000FF;">public</span><span style="color: #000000;"> MaskedTextBoxWPF()
{
    InitializeComponent();
    mktProvider </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> MaskedTextProvider(</span><span style="color: #800000;">"</span><span style="color: #800000;">???</span><span style="color: #800000;">"</span><span style="color: #000000;">);
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</li>
<li>Außerdem geben wir die Mask-Eigenschaft nach außen weiter, lassen die im Designer bearbeiten und geben auch ne kleine Doku für das Bearbeiten im Designer an:
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:72080bea-049c-46cb-99e5-e8c76560a2cf" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #000000;">[Browsable(</span><span style="color: #0000FF;">true</span><span style="color: #000000;">)]
[DesignOnly(</span><span style="color: #0000FF;">true</span><span style="color: #000000;">)]
[Description(</span><span style="color: #800000;">"</span><span style="color: #800000;">0 Ziffer - erforderlich; 9 Ziffer oder Leerzeichen - opt.;</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;">
          </span><span style="color: #800000;">"</span><span style="color: #800000;">L Buchstabe - erforderlich; ? Buchstabe - opt.</span><span style="color: #800000;">"</span><span style="color: #000000;">)]
</span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> Mask
{
  </span><span style="color: #0000FF;">get</span><span style="color: #000000;">
  {
      </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> mktProvider.Mask;
  }
  </span><span style="color: #0000FF;">set</span><span style="color: #000000;">
  {
      mktProvider </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> MaskedTextProvider(value);
      Text </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">""</span><span style="color: #000000;">;
  }
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</li>
<li>Als letztes müssen wir noch die Events mit Code füllen.Im PreviewTextInput-Ereignis prüfen wir, ob der Buschstabe hinzugefügt werden darf und brechen ggf. ab.Im Pasting-Ereignis machen wir das selbe mit eingefügtem Text und das KeyDown-Ereignis ist dafür da den Text im MaskedTextBoxProvider aktuell zu halten (falls z.B. was gelöscht wird).
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:31ca2506-5b5a-4b31-a9ab-e319fafc8016" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> TextBox_PreviewTextInput(</span><span style="color: #0000FF;">object</span><span style="color: #000000;"> sender, TextCompositionEventArgs e)
{
  </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (mktProvider.Add(e.Text) </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">false</span><span style="color: #000000;">)
  {
      e.Handled </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">true</span><span style="color: #000000;">;
  }
}

</span><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> TextBox_Pasting(</span><span style="color: #0000FF;">object</span><span style="color: #000000;"> sender, DataObjectPastingEventArgs e)
{
  </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (e.DataObject.GetDataPresent(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(String)))
  {
      String text </span><span style="color: #000000;">=</span><span style="color: #000000;"> (String)e.DataObject.GetData(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(String));
      </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (mktProvider.Add(text) </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">false</span><span style="color: #000000;">)
      {
          e.CancelCommand();
      }
  }
  </span><span style="color: #0000FF;">else</span><span style="color: #000000;"> e.CancelCommand();
}

</span><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> TextBox_KeyDown(</span><span style="color: #0000FF;">object</span><span style="color: #000000;"> sender, KeyEventArgs e)
{
  mktProvider.Clear();
  mktProvider.Add(Text);
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</li>
</ol>
<p>So, das war’s schon. Man könnte das ganze noch etwas schöner machen, indem man wie bei WinForms die Eingabemaske anzeigt, aber die Funktionalität ist vorhanden und kann so benutzt werden.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4859a4d6-694a-46ce-9087-e5144c0cfff3" class="wlWriterEditableSmartContent">Technorati-Tags: <a href="http://technorati.com/tags/WPF" rel="tag">WPF</a>,<a href="http://technorati.com/tags/C%23" rel="tag">C#</a></div>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2009/07/29/maskedtextbox-in-wpf-implementieren/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>dynamische Charts im WPF-Toolkit</title>
		<link>http://oliana.de/blog/2009/07/13/dynamische-charts-im-wpf-toolkit/</link>
		<comments>http://oliana.de/blog/2009/07/13/dynamische-charts-im-wpf-toolkit/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 21:14:44 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/2009/07/13/dynamische-charts-im-wpf-toolkit/</guid>
		<description><![CDATA[Ich habe vor kurzem das WPF-Toolkit mit dem darin enthaltenen charting-Steuerelement entdeckt und muss sagen, dass es echt eine schöne Sache ist. Damit ist es wirklich sehr einfach einen Graphen zu erstellen. Es reicht in XAML den Graphen zu deklarieren und ihn dann über die DataSource zu füllen. Falls man so wie ich mehrere Datenreihen [...]]]></description>
			<content:encoded><![CDATA[<p>Ich habe vor kurzem das WPF-Toolkit mit dem darin enthaltenen charting-Steuerelement entdeckt und muss sagen, dass es echt eine schöne Sache ist. Damit ist es wirklich sehr einfach einen Graphen zu erstellen.</p>
<p> <span id="more-216"></span>
<p>Es reicht in XAML den Graphen zu deklarieren und ihn dann über die DataSource zu füllen. Falls man so wie ich mehrere Datenreihen dynamisch hinzufügen will kann man einfach eine entsprechende Series per Code hinzufügen und dann über die Itemsource die Datenquelle binden.</p>
<p>Hier mal ein Beispiel-Graph für ein Balkendiagram, welches Daten Monatsweise anzeigt (dafür ist auch die Formatierung gedacht). Dieser enthält immer eine “lineare” Achse, welche einen normalen Liniengraphen darstellt – ich habe Sie explizit definiert, damit der mindest-Wert immer auf 0 steht und nicht automatisch angepasst wird..</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:19c388b9-b348-4bb9-b7ba-5777b920d437" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;overflow: auto;"><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">chartingToolkit:Chart </span><span style="color: #FF0000;">Name</span><span style="color: #0000FF;">="chart1"</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
   </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">chartingToolkit:Chart.Axes</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
      </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">chartingToolkit:DateTimeAxis
         </span><span style="color: #FF0000;">Orientation</span><span style="color: #0000FF;">="X"</span><span style="color: #FF0000;"> Location</span><span style="color: #0000FF;">="Bottom"</span><span style="color: #FF0000;">
         IntervalType</span><span style="color: #0000FF;">="Months"</span><span style="color: #FF0000;"> Interval</span><span style="color: #0000FF;">="1"</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
         </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">chartingToolkit:DateTimeAxis.AxisLabelStyle</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Style </span><span style="color: #FF0000;">TargetType</span><span style="color: #0000FF;">="chartingToolkit:DateTimeAxisLabel"</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
               </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Setter </span><span style="color: #FF0000;">Property</span><span style="color: #0000FF;">="StringFormat"</span><span style="color: #FF0000;"> Value</span><span style="color: #0000FF;">="</span><span style="color: #808000;">{}{0:MM-yy}</span><span style="color: #0000FF;">"</span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">Style</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
         </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">chartingToolkit:DateTimeAxis.AxisLabelStyle</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
      </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">chartingToolkit:DateTimeAxis</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
      </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">chartingToolkit:LinearAxis </span><span style="color: #FF0000;">Orientation</span><span style="color: #0000FF;">="Y"</span><span style="color: #FF0000;">
         Location</span><span style="color: #0000FF;">="Left"</span><span style="color: #FF0000;"> Minimum</span><span style="color: #0000FF;">="0"</span><span style="color: #FF0000;">
         ShowGridLines</span><span style="color: #0000FF;">="True"</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
   </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">chartingToolkit:Chart.Axes</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
</span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">chartingToolkit:Chart</span><span style="color: #0000FF;">&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>der dann ohne Daten so ausschaut:</p>
<p><a href="http://oliana.de/blog/wp-content/image38.png" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://oliana.de/blog/wp-content/image_thumb2.png" width="244" height="184" /></a> </p>
<p>Um diesem dann dynamisch mehr “Series”, also weitere z.B. Balken/Linien hinzuzufügen kann reicht dann dieser Code. Durch das setzen von Title wird der entsprechende Titel in der legende angezeigt.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:8589f92f-a198-45ec-ad71-fe6e86811c28" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;overflow: auto;"><span style="color: #000000;">ColumnSeries serie </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> ColumnSeries();
</span><span style="color: #008000;">//</span><span style="color: #008000;"> Alternativ z.B.
</span><span style="color: #008000;">//</span><span style="color: #008000;"> LineSeries serie = new LineSeries();</span><span style="color: #008000;">
</span><span style="color: #000000;">serie.Title </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">Titel für Legende</span><span style="color: #800000;">"</span><span style="color: #000000;">;
serie.DependentValuePath </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">Y-Wert-komponente</span><span style="color: #800000;">"</span><span style="color: #000000;">;
serie.IndependentValuePath </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">X-Wert-komponente</span><span style="color: #800000;">"</span><span style="color: #000000;">;
serie.ItemsSource </span><span style="color: #000000;">=</span><span style="color: #000000;"> daten;
</span><span style="color: #008000;">//</span><span style="color: #008000;"> chart1, weil ich dem Chart im XAML
</span><span style="color: #008000;">//</span><span style="color: #008000;"> diesen kreativen Namen spendiert habe,</span><span style="color: #008000;">
</span><span style="color: #000000;">chart1.Series.Add(serie);</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>Eine Sache, welche schon als bug reported wurde ist allerdings, dass momentan ein Graph mit einer DateTimeAxis und einer ColumnSeries keine Daten anzeigt, wenn nur ein Datum in der Liste für die Itemsource vorhanden ist. Dies liegt daran, dass mit Hilfe zumindest eines anderen Balkens versucht wird, die Breite für den Balken zu berechnen. Das wird aber im nächsten Release gefixt werden.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e46ee775-0c57-4e65-b1a1-22d650c17bca" class="wlWriterEditableSmartContent">Technorati-Tags: <a href="http://technorati.com/tags/WPF" rel="tag">WPF</a>,<a href="http://technorati.com/tags/WPF+Toolkit" rel="tag">WPF Toolkit</a></div>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2009/07/13/dynamische-charts-im-wpf-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Status eines Windows Mobile Ger&#228;ts pr&#252;fen</title>
		<link>http://oliana.de/blog/2009/02/16/status-eines-windows-mobile-gerts-prfen/</link>
		<comments>http://oliana.de/blog/2009/02/16/status-eines-windows-mobile-gerts-prfen/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 22:53:42 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Windows Mobile]]></category>
		<category><![CDATA[.Net CF]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/2009/02/16/status-eines-windows-mobile-gerts-prfen/</guid>
		<description><![CDATA[Manchmal sieht man den Wald vor lauter Bäumen nicht… Ich hatte das Problem, dass man während der Synchronisierung mit Activesync nicht auf synchronisierte Dateien zugreifen kann. Da habe ich dann angefangen mit Schleifen zu arbeiten um zu prüfen wann der Lock endlich weg ist. Dabei gibt es einen so schönen und einfachen Weg. Die Klasse [...]]]></description>
			<content:encoded><![CDATA[<p>Manchmal sieht man den Wald vor lauter Bäumen nicht… Ich hatte das Problem, dass man während der Synchronisierung mit Activesync nicht auf synchronisierte Dateien zugreifen kann. Da habe ich dann angefangen mit Schleifen zu arbeiten um zu prüfen wann der Lock endlich weg ist. Dabei gibt es einen so schönen und einfachen Weg.</p>
<p> <span id="more-162"></span>
<p>Die Klasse SystemState in <font size="2">Microsoft.WindowsMobile.Status nimmt einem in der Hinsicht jegliche Arbeit ab. Zunächst muss man also den entsprechenden Verweis im Projekt einfügen und kann dann sehr einfach den Status prüfen. Diese Zeile prüft z.B. ob ActiveSync gerade etwas macht:</font></p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">if</span>(SystemState.ActiveSyncStatus == ActiveSyncStatus.Synchronizing)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>     MessageBox.Show(<span style="color: #006080">&quot;Synching!&quot;</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> }</pre>
</p></div>
</div>
<p><font size="2"></font></p>
<p>Mit der SystemState Klasse kann man einiges machen und in der Hinsicht lohnt es sich wirklich mal die Doku durchzuschauen um zu sehen was einem da alles zur Verfügung steht. Ich werde dort jetzt auf jeden Fall öfter rein schauen…</p>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2009/02/16/status-eines-windows-mobile-gerts-prfen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server CE 3.5 Datenbank komprimieren</title>
		<link>http://oliana.de/blog/2009/02/16/sql-server-ce-35-datenbank-komprimieren/</link>
		<comments>http://oliana.de/blog/2009/02/16/sql-server-ce-35-datenbank-komprimieren/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 22:43:16 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Windows Mobile]]></category>
		<category><![CDATA[.Net CF]]></category>
		<category><![CDATA[SQL Server CE]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/2009/02/16/sql-server-ce-35-datenbank-komprimieren/</guid>
		<description><![CDATA[Gerade hatte ich einige Probleme eine SQL-Server CE Datenbank auf einem Windows Mobile Gerät zu komprimieren (durch SQLCeEngine.Shrink()), da dort die Meldung kam, dass angeblich eine Komponente fehlte. Das Interessante dabei war, dass das ganze in dem Emulator wunderbar funktionierte. Letztendlich habe ich herausgefunden, dass es daran liegt, dass man die Replikations-Komponente zum Komprimieren braucht. [...]]]></description>
			<content:encoded><![CDATA[<p>Gerade hatte ich einige Probleme eine SQL-Server CE Datenbank auf einem Windows Mobile Gerät zu komprimieren (durch SQLCeEngine.Shrink()), da dort die Meldung kam, dass angeblich eine Komponente fehlte. Das Interessante dabei war, dass das ganze in dem Emulator wunderbar funktionierte.<span id="more-160"></span></p>
<p>Letztendlich habe ich herausgefunden, dass es daran liegt, dass man die Replikations-Komponente zum Komprimieren braucht. Interessanterweise wird diese im Emulator beim Debuggen direkt mit installiert, wohingegen diese auf dem Gerät natürlich nicht standardmäßig bei ist.</p>
<p>Um diese zu installieren kann man die “sqlce.repl.wce5.armv4i.cab” im folgenden Verzeichnis benutzen.</p>
<div>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\
wce500\armv4i</pre>
</div>
<p>Anschließend kann mit diesen Zeilen die Datenbank komprimiert werden:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> engine = <span style="color: #0000ff">new</span> SqlCeEngine(<span style="color: #006080">"ConnectionString"</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> engine.Shrink();</pre>
</div>
</div>
<p>Eine Sache auf die man dabei achten sollte ist, dass es Probleme geben kann, wenn die Datenbank-Datei in einem mit Activesync synchronisierten Verzeichnis liegt – dann kann es sein, dass die Datei durch ActiveSync gesperrt ist. Die Lösung für dieses Problem kommt im nächsten Post <img src='http://oliana.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2009/02/16/sql-server-ce-35-datenbank-komprimieren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VS2008 Projekte in Expression Blend &#246;ffnen und die Fehler</title>
		<link>http://oliana.de/blog/2008/10/10/vs2008-projekte-in-expression-blend-ffnen-und-die-fehler/</link>
		<comments>http://oliana.de/blog/2008/10/10/vs2008-projekte-in-expression-blend-ffnen-und-die-fehler/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 12:44:26 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Anwendungen]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/?p=150</guid>
		<description><![CDATA[Vor kurzem habe ich mein erstes WPF Projekt erstellt und wollte nun auch mal Expression Blend verwenden um das ganze ein bisschen aufzumotzen. Da kam beim öffnen direkt folgender Fehler: The project File "...Projekt.csproj" is not valid. Das importierte Projekt C:\Microsoft.CSharp.targets wurde nicht gefunden. ... Mit ein wenig Glück konnte ich die Lösung finden: das [...]]]></description>
			<content:encoded><![CDATA[<p>Vor kurzem habe ich mein erstes WPF Projekt erstellt und wollte nun auch mal Expression Blend verwenden um das ganze ein bisschen aufzumotzen. Da kam beim öffnen direkt folgender Fehler:</p>
<p><span id="more-150"></span></p>
<pre>The project File "...Projekt.csproj" is not valid.
Das importierte Projekt C:\Microsoft.CSharp.targets wurde nicht gefunden.
...</pre>
<p>Mit ein wenig Glück konnte ich die Lösung finden: das <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=a07196d1-971b-4710-99c8-d3d9603ccfcb&amp;displaylang=en" target="_blank">Service Pack 1 für Expression Blend</a> installieren! Nachdem ich das installiert hatte, funktioniert alles wunderbar. Jetzt wird animiert!</p>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2008/10/10/vs2008-projekte-in-expression-blend-ffnen-und-die-fehler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LINQ 2 SQL Server CE</title>
		<link>http://oliana.de/blog/2008/10/06/linq-2-sql-server-ce/</link>
		<comments>http://oliana.de/blog/2008/10/06/linq-2-sql-server-ce/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 12:14:43 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Windows Mobile]]></category>
		<category><![CDATA[SQL Server CE]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/?p=146</guid>
		<description><![CDATA[Gerade habe ich LINQ-2-SQL gesehen und fand es direkt mal ziemlich genial. Vor allem bekommt man dadurch einen OR-Mapper zur Verfügung gestellt, der sehr viel besser ist als typisierte Datasets. Eine der schönen Sachen ist, dass man typisierte Objekte verwendet, aber Vorteile wie z.B. das Verändern der Verbindung zur Laufzeit. Leider wird LINQ-2-SQLCE zwar unterstützt, [...]]]></description>
			<content:encoded><![CDATA[<p>Gerade habe ich LINQ-2-SQL gesehen und fand es direkt mal ziemlich genial. Vor allem bekommt man dadurch einen OR-Mapper zur Verfügung gestellt, der sehr viel besser ist als typisierte Datasets. Eine der schönen Sachen ist, dass man typisierte Objekte verwendet, aber Vorteile wie z.B. das Verändern der Verbindung zur Laufzeit.</p>
<p> <span id="more-146"></span>Leider wird LINQ-2-SQLCE zwar unterstützt, aber nicht schön wie bei den großen SQL Servern. <a href="http://code-inside.de/blog/2008/02/28/howto-sql-server-compact-edition-mit-linq-to-sql-verwenden/" target="_blank">Hier</a> habe ich nun eine Lösung gefunden wie das doch geht.  </p>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2008/10/06/linq-2-sql-server-ce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ConnectionString f&#252;r SQL Server CE zum Zugriff auf eine Netzwerkfreigabe</title>
		<link>http://oliana.de/blog/2008/10/05/connectionstring-fr-sql-server-ce-zum-zugriff-auf-eine-netzwerkfreigabe/</link>
		<comments>http://oliana.de/blog/2008/10/05/connectionstring-fr-sql-server-ce-zum-zugriff-auf-eine-netzwerkfreigabe/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 16:09:35 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[SQL Server CE]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/?p=144</guid>
		<description><![CDATA[Ich arbeite gerade an einem kleinen Tool dass auf dem SQL Server CE basiert. Dabei soll auf eine Datei zugegriffen werden, die auf einer Netzwerkfreigabe liegt, welche nicht als Laufwerk eingebunden ist. Mit dem generierten Connectionstring funktioniert dies leider nicht, aber endlich habe ich die Lösung gefunden: Der generierte Connectionstring hat das Format: Data Source=&#124;DataDirectory&#124;Pfad [...]]]></description>
			<content:encoded><![CDATA[<p>Ich arbeite gerade an einem kleinen Tool dass auf dem SQL Server CE basiert. Dabei soll auf eine Datei zugegriffen werden, die auf einer Netzwerkfreigabe liegt, welche nicht als Laufwerk eingebunden ist. Mit dem generierten Connectionstring funktioniert dies leider nicht, aber endlich habe ich die Lösung gefunden:</p>
<p><span id="more-144"></span></p>
<p>Der generierte Connectionstring hat das Format:</p>
<pre>Data Source=|DataDirectory|Pfad</pre>
<p>Bei diesem Format bezeichnet “|Datadirectory|” einen Platzhalter der während der Ausführung ersetzt wird. Dies ist z.B. dann der Fall, wenn die Anwendung per ClickOnce verteilt wird und die Datenbankdatei durch das Setup im automatisch angelegten Daten-Verzeichnis abgelegt wird. Wenn man diesen verwendet, sollte man keinen absoluten, sondern nur einen relativen Pfad angeben.</p>
<p>Will man einen absoluten Pfad (wie z.B. ein Verzeichnis einer Netzwerkfreigabe im Format <a href="file://\\Computer\Freigabe\Verzeichnis">\\Computer\Freigabe\Verzeichnis</a>) kann man dieses Format verwenden:</p>
<pre>Data Source=Pfad</pre>
<p>So einfach kann es gehen…</p>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2008/10/05/connectionstring-fr-sql-server-ce-zum-zugriff-auf-eine-netzwerkfreigabe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erwachsene SVN-Integration in Visual Studio: AnkhSVN</title>
		<link>http://oliana.de/blog/2008/08/24/erwachsene-svn-integration-in-visual-studio-ankhsvn/</link>
		<comments>http://oliana.de/blog/2008/08/24/erwachsene-svn-integration-in-visual-studio-ankhsvn/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 19:53:34 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Anwendungen]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Projekte]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/?p=112</guid>
		<description><![CDATA[Seit einiger Zeit schon benutze ich zur Quellcode-Verwaltung SVN und zur Integration in Visual Studio das frei verfügbare AnkhSVN. Bisher war die Integration zwar vorhanden und nutzbar, aber es gab einige Schwachpunkte. Z.B. war es nicht möglich ein Outlook-Plugin-Projekt mit AnkhSVN zu verwalten, da dieses das gesamte Projekt zerschossen hat. Vor kurzem ist AnkhSVN 2.0 [...]]]></description>
			<content:encoded><![CDATA[<p>Seit einiger Zeit schon benutze ich zur Quellcode-Verwaltung SVN und zur Integration in Visual Studio das frei verfügbare <a href="http://ankhsvn.open.collab.net/" target="_blank">AnkhSVN</a>. Bisher war die Integration zwar vorhanden und nutzbar, aber es gab einige Schwachpunkte. Z.B. war es nicht möglich ein Outlook-Plugin-Projekt mit AnkhSVN zu verwalten, da dieses das gesamte Projekt zerschossen hat.</p>
<p><span id="more-112"></span></p>
<p>Vor kurzem ist <a href="http://ankhsvn.open.collab.net/" target="_blank">AnkhSVN</a> 2.0 erschienen was eine wesentlich bessere Integration bietet, da es als natives SCC für Visual Studio implementiert wurde. Soweit ich es nach ein paar Tagen testen beurteilen kann hat es sich nicht nur insofern verbessert als dass Outlook-Plugin Projekte nun ohne Probleme damit verwaltet werden können. Die weiteren Pluspunkte sind:</p>
<ul>
<li>subjektive Beschleunigung des Eincheck-Vorgangs</li>
<li>Bessere Integration (eigenes Ausgabe-Fenster)</li>
<li>schönere Symbole <img src='http://oliana.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
</ul>
<p>Falls mir noch mehr Punkte einfallen werde ich Sie hinzufügen. Ich werde noch eins der größeren Nachteile testen müssen: Die Zusammenarbeit von mehreren Personen an einem einzigen Projekt. Bisher wurde dabei irgendwann die Projektdatei beschädigt wenn z.B. unterschiedliche Leute gleichzeitig Formulare in ein Projekt eingefügt haben.</p>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2008/08/24/erwachsene-svn-integration-in-visual-studio-ankhsvn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatische Höhe für Labels im Compact Framework auf dem Pocket PC</title>
		<link>http://oliana.de/blog/2008/05/27/automatische-hohe-fur-labels-im-compact-framework-auf-dem-pocket-pc/</link>
		<comments>http://oliana.de/blog/2008/05/27/automatische-hohe-fur-labels-im-compact-framework-auf-dem-pocket-pc/#comments</comments>
		<pubDate>Tue, 27 May 2008 19:50:18 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Windows Mobile]]></category>
		<category><![CDATA[.Net CF]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://oliana.de/blog/?p=94</guid>
		<description><![CDATA[Für ein kleines Projekt für Windows CE habe ich eine Methode gesucht um die Höhe eines Labels anhand des Inhalts automatisch zu setzen. Dabei habe ich hier eine Lösung in Visual Basic gefunden. Diese Lösung ist eigentlich recht elegant, da Sie API-Funktionen benutzt um das Rectangle zu zeichnen und die Höhe genau so zu bestimmen [...]]]></description>
			<content:encoded><![CDATA[<p>Für ein kleines Projekt für Windows CE habe ich eine Methode gesucht um die Höhe eines Labels anhand des Inhalts automatisch zu setzen. Dabei habe ich <a href="http://gps678.com/17/e1e89d7b8a1ab012.html" target="_blank">hier</a> eine Lösung in Visual Basic gefunden. Diese Lösung ist eigentlich recht elegant, da Sie API-Funktionen benutzt um das Rectangle zu zeichnen und die Höhe genau so zu bestimmen wie Sie auch später im Formular erscheinen würde wenn man z.B. den Text in ein Textfeld schreiben würde.</p>
<p>Hier eine Übersetzung in C#:<span id="more-94"></span></p>
<div>
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">using</span> System;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff;">using</span> System.Windows.Forms;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">using</span> System.Runtime.InteropServices;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff;">using</span> System.Drawing;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">class</span> Helper</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">{</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">struct</span> RECT</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Left;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Top;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Right;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> Bottom;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> DT_CALCRECT = 1024;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> DT_CENTER = 1;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> DT_LEFT = 0;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> DT_RIGHT = 2;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> DT_TOP = 0;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> DT_WORDBREAK = 16;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    [DllImport(<span style="color: #006080;">"coredll.dll"</span>, CharSet = CharSet.Unicode,</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        SetLastError = <span style="color: #0000ff;">true</span>)]</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">extern</span> <span style="color: #0000ff;">int</span> DeleteObject(IntPtr hObject);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    [DllImport(<span style="color: #006080;">"coredll.dll"</span>, CharSet = CharSet.Unicode,</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        SetLastError = <span style="color: #0000ff;">true</span>)]</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">extern</span> <span style="color: #0000ff;">int</span> DrawText(IntPtr hdc, <span style="color: #0000ff;">string</span> lpStr,</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">int</span> nCount, <span style="color: #0000ff;">ref</span> RECT lpRect, <span style="color: #0000ff;">int</span> wFormat);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    [DllImport(<span style="color: #006080;">"coredll.dll"</span>, CharSet = CharSet.Unicode,</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        SetLastError = <span style="color: #0000ff;">true</span>)]</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">extern</span> IntPtr SelectObject(IntPtr hdc,</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        IntPtr hObject);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #008000;">/// &lt;summary&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #008000;">/// Ändert die Höhe des Labels so, dass der Inhalt genau </span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #008000;">/// reinpasst.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #008000;">/// &lt;/summary&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #008000;">/// &lt;param name="label"&gt;Label dessen Höhe angepasst werden soll.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #008000;">/// &lt;/param&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> AutoSizeLabelHeight(Label label)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        RECT uRECT = <span style="color: #0000ff;">new</span> RECT();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">try</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000;">/*****************************************************</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">            * Create a Graphics object. We need a Graphics object </span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">            * so we can get a handle to a Device Context to be used</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">            * later in the DrawText API. However the Label control </span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">            * in CF2.0 does not support the CreateGraphics method,</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">            * so create the Graphics object from the form on which </span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">            * the Label is located.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">            * Note: This can cause an exception when this routine </span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">            * is called from a Form's Resize event. Probably because</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">            * the form is not fully initialised and the Resize event</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">            * may be called one or more times during form</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">            * initialisation. Therefore, the entire routine is wrapped</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">            * in a Try/Catch block.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">            *****************************************************/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            Graphics objGraphics = label.TopLevelControl.CreateGraphics();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000;">// Get the handle to the Device Context of the Graphics object</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            IntPtr hDc = objGraphics.GetHdc();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #008000;">// Get the handle to the Font of the Label</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                IntPtr hFont = label.Font.ToHfont();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                <span style="color: #008000;">// Apply the Font to the Graphics object</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                IntPtr hFontOld = SelectObject(hDc, hFont);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #008000;">// Set the initial size of the Rect</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                uRECT.Right = label.Width - 2;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                <span style="color: #008000;">// Build the base format</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff;">int</span> lFormat = DT_CALCRECT | DT_WORDBREAK | DT_TOP;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #008000;">/*****************************************************</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">                 * Adjust the format to the Label's text alignment.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">                 * Note: This probably isn't necessary as the horizontal </span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">                 * alignment of text shouldn't affect the text</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">                 * height calculation. But just in case...</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">                 *****************************************************/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff;">switch</span> (label.TextAlign)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    <span style="color: #0000ff;">case</span> ContentAlignment.TopLeft:</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                        lFormat = lFormat | DT_LEFT;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                        <span style="color: #0000ff;">break</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                    <span style="color: #0000ff;">case</span> ContentAlignment.TopCenter:</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                        lFormat = lFormat | DT_CENTER;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                        <span style="color: #0000ff;">break</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    <span style="color: #0000ff;">case</span> ContentAlignment.TopRight:</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                        lFormat = lFormat | DT_RIGHT;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                        <span style="color: #0000ff;">break</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                <span style="color: #008000;">// Calculate the Rect of the text</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff;">if</span> (DrawText(hDc, label.Text, -1, <span style="color: #0000ff;">ref</span> uRECT, lFormat)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                    != 0)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                    <span style="color: #008000;">// Success</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    <span style="color: #008000;">// Apply the new height to the label</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                    label.Height = uRECT.Bottom + 2;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #008000;">// Cleanup</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                <span style="color: #008000;">// Set the Font of the Graphics object back to original</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                SelectObject(hDc, hFontOld);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #008000;">// Delete the handle to the Font of the Label</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                DeleteObject(hFont);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #008000;">// Clean up the Graphics object</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            objGraphics.Dispose();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">catch</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000;">// Do nothing</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #008000;">//Debug.WriteLine("AutoSizeLabelHeight failed.")</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">}</pre>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://oliana.de/blog/2008/05/27/automatische-hohe-fur-labels-im-compact-framework-auf-dem-pocket-pc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.587 seconds -->

