<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>tomatomax.net &#187; .Net</title>
	<atom:link href="http://blog.tomatomax.net/archives/category/program/dotnet/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.tomatomax.net</link>
	<description>Every rule has its exception.</description>
	<lastBuildDate>Wed, 07 Jul 2010 08:41:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/category/program/dotnet/feed" />
		<item>
		<title>treeViewコントロール</title>
		<link>http://blog.tomatomax.net/archives/1857</link>
		<comments>http://blog.tomatomax.net/archives/1857#comments</comments>
		<pubDate>Tue, 16 Nov 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1857</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>要素の追加方法。</p>
<p>
<pre>
<font color="#000000">TreeNode</font> <font color="#000000">newNode</font>;
<font color="#000000">treeView1</font>.<font color="#000000">Nodes</font>.<font color="#000000">Clear</font>();
<font color="#0000ff">for</font>(<font color="#0000ff">int</font> <font color="#000000">i</font> = <font color="#000000">0</font>; <font color="#000000">i</font> &#60; <font color="#000000">3</font>; <font color="#000000">i</font>++)
{
<font color="#000000">newNode</font> = <font color="#0000ff">new</font> <font color="#000000">TreeNode</font>(<font color="#000000">i</font>.<font color="#000000">ToString</font>() + <font color="#000000">&#34;サーバ&#34;</font>);
<font color="#000000">treeView1</font>.<font color="#000000">Nodes</font>.<font color="#000000">Add</font>(<font color="#000000">newNode</font>);
<font color="#000000">newNode</font> = <font color="#000000">treeView1</font>.<font color="#000000">SelectedNode</font>;
<font color="#0000ff">for</font>(<font color="#0000ff">int</font> <font color="#000000">j</font> = <font color="#000000">0</font>; <font color="#000000">j</font> &#60; <font color="#000000">5</font>; <font color="#000000">j</font>++)
{
<font color="#000000">newNode</font> = <font color="#0000ff">new</font> <font color="#000000">TreeNode</font>(<font color="#000000">j</font>.<font color="#000000">ToString</font>() + <font color="#000000">&#34;村&#34;</font>);
<font color="#000000">treeView1</font>.<font color="#000000">Nodes</font>[<font color="#000000">i</font>].<font color="#000000">Nodes</font>.<font color="#000000">Add</font>(<font color="#000000">newNode</font>);
}
}
</pre>
</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1857/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1857" />
	</item>
		<item>
		<title>CE.NETでのHTML表示</title>
		<link>http://blog.tomatomax.net/archives/1844</link>
		<comments>http://blog.tomatomax.net/archives/1844#comments</comments>
		<pubDate>Mon, 25 Oct 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1844</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>いろいろ調べてみたけれど、.NET Compact Framework用のブラウザコンポーネントはないのかな？eMbedded Visual C++ならあるみたいだけれど。</p>
<p>MicrosoftのPocketPCプログラミングガイドより</p>
<blockquote>
<p>.NET Framework と .NET Compact Framework の相違点</p>
<p>.NET Framework の名前空間のうち、.NET Compact Framework ではサポートされない、または機能限定でサポートされるクラスがあります。</p>
<ul>
<li>サポートされないクラス</li>
</ul>
<p>Printing、ServiceProcess、Remoting、SessionState、HTML コントロールなど </p>
</blockquote>
<p>さて、どうしたものか。</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1844/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1844" />
	</item>
		<item>
		<title>Rectangle</title>
		<link>http://blog.tomatomax.net/archives/1812</link>
		<comments>http://blog.tomatomax.net/archives/1812#comments</comments>
		<pubDate>Sat, 11 Sep 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1812</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>混乱しがちなのでメモ。</p>
<p>Delphi7以前</p>
<p>
<pre>
<font color="#000000">r</font> := <font color="#000000">Rect</font>(<font color="#000000">Left</font>, <font color="#000000">Top</font>, <font color="#000000">Right</font>, <font color="#000000">Bottom</font>);
</pre>
</p>
<p>Delphi8</p>
<p>
<pre>
<font color="#000000">r</font> := <font color="#000000">Rectangle</font>.<font color="#000000">Create</font>(<font color="#000000">Left</font>, <font color="#000000">Top</font>, <font color="#000000">Width</font>, <font color="#000000">Height</font>);
</pre>
</p>
<p>Delphi8形式のほうが楽。</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1812/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1812" />
	</item>
		<item>
		<title>JoystickState.GetButtons()</title>
		<link>http://blog.tomatomax.net/archives/1800</link>
		<comments>http://blog.tomatomax.net/archives/1800#comments</comments>
		<pubDate>Tue, 24 Aug 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1800</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>以下はジョイスティックのボタン状態を得て、ボタンが押されていたらウィンドウを閉じる部分。</p>
<p>
<pre>
<font color="#0000ff">byte</font>[] <font color="#000000">buttons</font> = <font color="#000000">JS</font>.<font color="#000000">GetButtons</font>();
<font color="#0000ff">int</font> <font color="#000000">cnt</font> = <font color="#000000">0</font>;
<font color="#0000ff">foreach</font> (<font color="#0000ff">byte</font> <font color="#000000">b</font> <font color="#0000ff">in</font> <font color="#000000">buttons</font>)
{
<font color="#0000ff">if</font> (<font color="#000000">0</font> != (<font color="#000000">b</font> &#38; <font color="#000000">0x80</font>))
{
<font color="#000000">result</font> = <font color="#000000">cnt</font>;
<font color="#0000ff">this</font>.<font color="#000000">DialogResult</font> = <font color="#000000">DialogResult</font>.<font color="#000000">OK</font>;
<font color="#0000ff">this</font>.<font color="#000000">Close</font>();
}
<font color="#000000">cnt</font>++;
}
</pre>
</p>
<p>Managedになってもやはり最上位ビットで判断するのか……。</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1800/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1800" />
	</item>
		<item>
		<title>キーコンフィグ</title>
		<link>http://blog.tomatomax.net/archives/1795</link>
		<comments>http://blog.tomatomax.net/archives/1795#comments</comments>
		<pubDate>Fri, 20 Aug 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1795</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>Serializeを使ってキー設定を保存してみようと画策。</p>
<p><a href="http://hp.vector.co.jp/authors/VA013135/keyconfig.zip" target="_blank">http://hp.vector.co.jp/authors/VA013135/keyconfig.zip</a>(ソース付)</p>
<p>どちらかというとDirectInput関連で手間取った。ジョイスティックは16本まで認識できるハズだけど、持ってないので2本までしか確認してない……m(_ _)m</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1795/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1795" />
	</item>
		<item>
		<title>Serialize</title>
		<link>http://blog.tomatomax.net/archives/1794</link>
		<comments>http://blog.tomatomax.net/archives/1794#comments</comments>
		<pubDate>Thu, 19 Aug 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1794</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>データ保存の方法としてSerializeが使えそうなのでテスト。</p>
<p>
<pre>
<font color="#0000ff">using</font> <font color="#000000">System</font>;
<font color="#0000ff">using</font> <font color="#000000">System</font>.<font color="#000000">IO</font>;
<font color="#0000ff">using</font> <font color="#000000">System</font>.<font color="#000000">Runtime</font>.<font color="#000000">Serialization</font>;
<font color="#0000ff">using</font> <font color="#000000">System</font>.<font color="#000000">Runtime</font>.<font color="#000000">Serialization</font>.<font color="#000000">Formatters</font>.<font color="#000000">Binary</font>;

<font color="#008000">// シリアライズするクラスによってシリアライズされるクラス</font>
[<font color="#000000">Serializable</font>]
<font color="#0000ff">internal</font> <font color="#0000ff">class</font> <font color="#000000">MyData</font>
{
<font color="#0000ff">public</font> <font color="#0000ff">int</font> <font color="#000000">x</font>, <font color="#000000">y</font>;
<font color="#008000">// 引数ナシのコンストラクタを定義</font>
<font color="#0000ff">public</font> <font color="#000000">MyData</font>()
{
<font color="#000000">x</font> = <font color="#000000">0</font>;
<font color="#000000">y</font> = <font color="#000000">0</font>;
}
<font color="#008000">// Deserialize時に使用するシグネチャコンストラクタを定義する</font>
<font color="#0000ff">public</font> <font color="#000000">MyData</font>(<font color="#000000">SerializationInfo</font> <font color="#000000">info</font>, <font color="#000000">StreamingContext</font> <font color="#000000">sc</font>)
{
<font color="#000000">x</font> = (<font color="#0000ff">int</font>)<font color="#000000">info</font>.<font color="#000000">GetValue</font>(<font color="#000000">&#34;x&#34;</font>, <font color="#0000ff">typeof</font>(<font color="#0000ff">int</font>));
<font color="#000000">y</font> = (<font color="#0000ff">int</font>)<font color="#000000">info</font>.<font color="#000000">GetValue</font>(<font color="#000000">&#34;y&#34;</font>, <font color="#0000ff">typeof</font>(<font color="#0000ff">int</font>));
}
<font color="#008000">// Serialize時に使用するGetObjectDataの実装</font>
<font color="#0000ff">public</font> <font color="#0000ff">void</font> <font color="#000000">GetObjectData</font>(<font color="#000000">SerializationInfo</font> <font color="#000000">info</font>, <font color="#000000">StreamingContext</font> <font color="#000000">sc</font>)
{
<font color="#000000">info</font>.<font color="#000000">AddValue</font>(<font color="#000000">&#34;x&#34;</font>, <font color="#000000">x</font>);
<font color="#000000">info</font>.<font color="#000000">AddValue</font>(<font color="#000000">&#34;y&#34;</font>, <font color="#000000">y</font>);
}
}

<font color="#008000">// シリアライズするクラス</font>
[<font color="#000000">Serializable</font>]
<font color="#0000ff">internal</font> <font color="#0000ff">class</font> <font color="#000000">MyClass</font>
{
<font color="#0000ff">public</font> <font color="#0000ff">string</font> <font color="#000000">Signature</font>;
<font color="#0000ff">public</font> <font color="#0000ff">uint</font> <font color="#000000">Count</font>;
<font color="#0000ff">public</font> <font color="#000000">MyData</font> <font color="#000000">Data</font>;

<font color="#008000">// 引数ナシのコンストラクタを定義</font>
<font color="#0000ff">public</font> <font color="#000000">MyClass</font>()
{
<font color="#000000">Signature</font> = <font color="#000000">&#34;SaRU&#34;</font>;
<font color="#000000">Count</font> = <font color="#000000">0</font>;
<font color="#000000">Data</font> = <font color="#0000ff">new</font> <font color="#000000">MyData</font>();
}
<font color="#008000">// Deserialize時に使用するシグネチャコンストラクタを定義する</font>
<font color="#0000ff">public</font> <font color="#000000">MyClass</font>(<font color="#000000">SerializationInfo</font> <font color="#000000">info</font>, <font color="#000000">StreamingContext</font> <font color="#000000">sc</font>)
{
<font color="#000000">Signature</font> = (<font color="#0000ff">string</font>)<font color="#000000">info</font>.<font color="#000000">GetValue</font>(<font color="#000000">&#34;Signature&#34;</font>, <font color="#0000ff">typeof</font>(<font color="#0000ff">string</font>));
<font color="#000000">Count</font> = (<font color="#0000ff">uint</font>)<font color="#000000">info</font>.<font color="#000000">GetValue</font>(<font color="#000000">&#34;Count&#34;</font>, <font color="#0000ff">typeof</font>(<font color="#0000ff">uint</font>));
<font color="#000000">Data</font> = (<font color="#000000">MyData</font>)<font color="#000000">info</font>.<font color="#000000">GetValue</font>(<font color="#000000">&#34;Data&#34;</font>, <font color="#0000ff">typeof</font>(<font color="#000000">MyData</font>));
}

<font color="#008000">// Serialize時に使用するGetObjectDataの実装</font>
<font color="#0000ff">public</font> <font color="#0000ff">void</font> <font color="#000000">GetObjectData</font>(<font color="#000000">SerializationInfo</font> <font color="#000000">info</font>, <font color="#000000">StreamingContext</font> <font color="#000000">sc</font>)
{
<font color="#000000">info</font>.<font color="#000000">AddValue</font>(<font color="#000000">&#34;Signature&#34;</font>, <font color="#000000">Signature</font>);
<font color="#000000">info</font>.<font color="#000000">AddValue</font>(<font color="#000000">&#34;Count&#34;</font>, <font color="#000000">Count</font>);
<font color="#000000">info</font>.<font color="#000000">AddValue</font>(<font color="#000000">&#34;Data&#34;</font>, <font color="#000000">Data</font>);
}
}

<font color="#0000ff">class</font> <font color="#000000">Class1</font>
{
[<font color="#000000">STAThread</font>]
<font color="#0000ff">static</font> <font color="#0000ff">void</font> <font color="#000000">Main</font>(<font color="#0000ff">string</font>[] <font color="#000000">args</font>)
{
<font color="#000000">MyClass</font> <font color="#000000">myclass</font> = <font color="#0000ff">new</font> <font color="#000000">MyClass</font>();
<font color="#000000">myclass</font>.<font color="#000000">Signature</font> = <font color="#000000">&#34;OSaRU&#34;</font>;
<font color="#000000">myclass</font>.<font color="#000000">Count</font> = <font color="#000000">24</font>;
<font color="#000000">myclass</font>.<font color="#000000">Data</font>.<font color="#000000">x</font> = <font color="#000000">100</font>;
<font color="#000000">myclass</font>.<font color="#000000">Data</font>.<font color="#000000">y</font> = <font color="#000000">200</font>;

<font color="#008000">// シリアライズ</font>
<font color="#000000">FileStream</font> <font color="#000000">fs</font> = <font color="#0000ff">new</font> <font color="#000000">FileStream</font>(<font color="#000000">&#34;test.dat&#34;</font>, <font color="#000000">FileMode</font>.<font color="#000000">Create</font>);
<font color="#000000">BinaryFormatter</font> <font color="#000000">bf</font> = <font color="#0000ff">new</font> <font color="#000000">BinaryFormatter</font>();
<font color="#0000ff">try</font>
{
<font color="#000000">bf</font>.<font color="#000000">Serialize</font>(<font color="#000000">fs</font>, <font color="#000000">myclass</font>);
}
<font color="#0000ff">catch</font> (<font color="#000000">SerializationException</font> <font color="#000000">e</font>)
{
<font color="#000000">Console</font>.<font color="#000000">WriteLine</font>(<font color="#000000">&#34;Failed to serialize. Reason: &#34;</font> + <font color="#000000">e</font>.<font color="#000000">Message</font>);
<font color="#0000ff">throw</font>;
}
<font color="#0000ff">finally</font>
{
<font color="#000000">fs</font>.<font color="#000000">Close</font>();
}

<font color="#008000">// デシリアライズ</font>
<font color="#000000">myclass</font> = <font color="#0000ff">null</font>;
<font color="#000000">fs</font> = <font color="#0000ff">new</font> <font color="#000000">FileStream</font>(<font color="#000000">&#34;test.dat&#34;</font>, <font color="#000000">FileMode</font>.<font color="#000000">Open</font>);
<font color="#000000">bf</font> = <font color="#0000ff">new</font> <font color="#000000">BinaryFormatter</font>();

<font color="#0000ff">try</font>
{
<font color="#000000">myclass</font> = (<font color="#000000">MyClass</font>)<font color="#000000">bf</font>.<font color="#000000">Deserialize</font>(<font color="#000000">fs</font>);
}
<font color="#0000ff">catch</font> (<font color="#000000">SerializationException</font> <font color="#000000">e</font>)
{
<font color="#000000">Console</font>.<font color="#000000">WriteLine</font>(<font color="#000000">&#34;Failed to deserialize. Reason: &#34;</font> + <font color="#000000">e</font>.<font color="#000000">Message</font>);
<font color="#0000ff">throw</font>;
}
<font color="#0000ff">finally</font>
{
<font color="#000000">fs</font>.<font color="#000000">Close</font>();
}

<font color="#008000">// 表示</font>
<font color="#000000">Console</font>.<font color="#000000">WriteLine</font>(<font color="#000000">&#34;Signature:&#34;</font> + <font color="#000000">myclass</font>.<font color="#000000">Signature</font>.<font color="#000000">ToString</font>());
<font color="#000000">Console</font>.<font color="#000000">WriteLine</font>(<font color="#000000">&#34;Count:&#34;</font> + <font color="#000000">myclass</font>.<font color="#000000">Count</font>.<font color="#000000">ToString</font>());
<font color="#000000">Console</font>.<font color="#000000">WriteLine</font>(<font color="#000000">&#34;Data.x:&#34;</font> + <font color="#000000">myclass</font>.<font color="#000000">Data</font>.<font color="#000000">x</font>.<font color="#000000">ToString</font>());
<font color="#000000">Console</font>.<font color="#000000">WriteLine</font>(<font color="#000000">&#34;Data.y:&#34;</font> + <font color="#000000">myclass</font>.<font color="#000000">Data</font>.<font color="#000000">y</font>.<font color="#000000">ToString</font>());
<font color="#000000">Console</font>.<font color="#000000">ReadLine</font>();
}
}
</pre>
</p>
<p>結果</p>
<blockquote>
<p>Signature:OSaRU</p>
<p>Count:24</p>
<p>Data.x:100</p>
<p>Data.y:200</p>
</blockquote>
<p>iniファイルを利用しているような感覚。オブジェクトも格納できる(そのオブジェクトがSerializableになっている必要があるが)。</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1794/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1794" />
	</item>
		<item>
		<title>構造体と配列</title>
		<link>http://blog.tomatomax.net/archives/1793</link>
		<comments>http://blog.tomatomax.net/archives/1793#comments</comments>
		<pubDate>Wed, 18 Aug 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1793</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>構造体の中に配列を埋める方法がわからなかったのでメモ。</p>
<p>Unmanagedでは</p>
<p>
<pre>
<font color="#0000ff">struct</font> <font color="#000000">box</font> {
<font color="#0000ff">int</font> <font color="#000000">a</font>[<font color="#000000">10</font>];
};
</pre>
</p>
<p>これをManagedで実現しようとしたとき。</p>
<p>
<pre>
[<font color="#000000">StructLayout</font>(<font color="#000000">LayoutKind</font>.<font color="#000000">Sequential</font>)]
<font color="#0000ff">public</font> <font color="#0000ff">struct</font> <font color="#000000">box</font> {
[<font color="#000000">MarshalAs</font>(<font color="#000000">UnmanagedType</font>.<font color="#000000">ByValArray</font>, <font color="#000000">SizeConst</font>=<font color="#000000">10</font>)] <font color="#0000ff">public</font> <font color="#0000ff">int</font>[] <font color="#000000">a</font>;
}
</pre>
</p>
<p>(；´∀｀)……</p>
<p>さらに、使うときには配列のインスタンスを作成する必要があるようで。</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1793/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1793" />
	</item>
		<item>
		<title>はじめてのC#</title>
		<link>http://blog.tomatomax.net/archives/1789</link>
		<comments>http://blog.tomatomax.net/archives/1789#comments</comments>
		<pubDate>Sat, 14 Aug 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1789</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>というわけでHello, world!なんかを組んでみたり。</p>
<p>
<pre>
<font color="#0000ff">using</font> <font color="#000000">System</font>;

<font color="#0000ff">namespace</font> <font color="#000000">Helloworld</font>
{
<font color="#808080">///</font><font color="#008000"> </font><font color="#808080">&#60;summary&#62;</font>
<font color="#808080">///</font><font color="#008000"> Class1 の概要の説明です。</font>
<font color="#808080">///</font><font color="#008000"> </font><font color="#808080">&#60;/summary&#62;</font>
<font color="#0000ff">class</font> <font color="#000000">Class1</font>
{
<font color="#808080">///</font><font color="#008000"> </font><font color="#808080">&#60;summary&#62;</font>
<font color="#808080">///</font><font color="#008000"> アプリケーションのメイン エントリ ポイントです。</font>
<font color="#808080">///</font><font color="#008000"> </font><font color="#808080">&#60;/summary&#62;</font>
[<font color="#000000">STAThread</font>]
<font color="#0000ff">static</font> <font color="#0000ff">void</font> <font color="#000000">Main</font>(<font color="#0000ff">string</font>[] <font color="#000000">args</font>)
{
<font color="#008000">//</font>
<font color="#008000">// TODO: アプリケーションを開始するコードをここに追加してください。</font>
<font color="#008000">//</font>
<font color="#000000">System</font>.<font color="#000000">Console</font>.<font color="#000000">WriteLine</font>(<font color="#000000">&#34;Hello, world!&#34;</font>);
}
}
}
</pre>
</p>
<p>実際に記述したのは一行だけですが。</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1789/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1789" />
	</item>
		<item>
		<title>構造体をファイルに書き込む</title>
		<link>http://blog.tomatomax.net/archives/1788</link>
		<comments>http://blog.tomatomax.net/archives/1788#comments</comments>
		<pubDate>Thu, 12 Aug 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1788</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>ファイルヘッダなどを構造体として作成し、そのままファイルに書き込むコードの移植を行っていたのだけれど。</p>
<blockquote>
<p>f.write(header, 0, Sizeof(header));</p>
</blockquote>
<p>上のようなコードに相当するものがワカラン……。一つ一つメンバを書き込んでいくしかないのか。</p>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1788/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1788" />
	</item>
		<item>
		<title>Int32</title>
		<link>http://blog.tomatomax.net/archives/1773</link>
		<comments>http://blog.tomatomax.net/archives/1773#comments</comments>
		<pubDate>Wed, 21 Jul 2004 15:00:00 +0000</pubDate>
		<dc:creator>maruguu</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://blog.tomatomax.net/archives/1773</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>Sprite.Drawメソッドの引数は下のようになっている(C#)</p>
<blockquote>
<p>public void Draw(</p>
<p>    Texture srcTexture,</p>
<p>    Rectangle srcRectangle,</p>
<p>    Vector3 center,</p>
<p>    Vector3 position,</p>
<p>    int color</p>
<p>);</p>
</blockquote>
<p>最後のcolorはint型で指定し、掛け合わせる色とα値を指定する。ARGB:8888であるので、そのまま表示したいときは0xFFFFFFFFを指定する、とヘルプにも書いてあるのだけれど。</p>
<p>Delphiの場合。</p>
<blockquote>
<p> D3DSprite.Draw(SpriteTexture, FRect, Center, Pos, $FFFFFFFF);</p>
</blockquote>
<p>と記述すると、</p>
<blockquote>
<p>[警告]XXXX.pas(120): 定数式が範囲を超えました</p>
</blockquote>
<p>と警告が出てくる。たかが警告と無視していたら</p>
<p>「プロジェクトXXXX.exeに処理されない例外クラス Borland.Delphi.System.ERangeErrorがあります。」</p>
<p>( ゜Д゜)ハァ?</p>
<p>対処法としてはColorをColor.Whiteとすればいいのだけれど、α値を適当にいじれないし。</p>
<p>とりあえずキャストしてみたら上手くいった。</p>
<blockquote>
<p> D3DSprite.Draw(SpriteTexture, FRect, Center, Pos, Integer($FFFFFFFF));</p>
</blockquote>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 336x280, 作成済み 10/04/25 */
google_ad_slot = "6994973421";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-0582565723906120";
/* 200x90, 作成済み 10/04/25 */
google_ad_slot = "9492987907";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tomatomax.net/archives/1773/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.tomatomax.net/archives/1773" />
	</item>
	</channel>
</rss>
