2011年6月8日水曜日

dipについて

http://www.atmarkit.co.jp/fsmart/articles/android_int01/02.html

Androidの画面サイズはスクリーンサイズがまちまちなので、ピクセル指定でなくdip(Density-independent Pixel)で作成する。

換算式は以下の通り

pixel = dips * ( density / 160 )

忘れないように…

2009年1月14日水曜日

APIのPlaySound関数をVB.NETから使用してWavファイルを再生

VB.NETからAPIのPlaySound関数を使用してWavファイルを再生。
*もちろん、Wav以外は再生できないです
PlaySound関数では同時再生することはできないので、同時再生させるためにMediaPlayerを併用しました。
BGMなどはMediaPlayerで再生させておき、効果音など軽い音源はPlaySound関数を使用すれば、同時に再生できるようです。
smdn:総武ソフトウェア推進所さんのソースを参考にさせていただきました。
記事はこちら↓
WAVEファイルを再生する
http://smdn.invisiblefulmoon.net/ikimasshoy/dotnettips/tips027.html

画面のようにコントロールを配置。DllImportsやマーシャリングは各自でお願いしますね。

' ファイルから再生する
Private Shared Function PlaySound( _
ByVal pszSound As String, _
ByVal hModule As Integer, _
ByVal dwFlags As Integer) _
As Integer
End Function

' メモリ上のバッファから再生する
Private Shared Function PlaySound( _
ByVal pszSound As Byte(), _
ByVal hModule As Integer, _
ByVal dwFlags As Integer) _
As Integer
End Function
' 再生フラグ
Private Const SND_SYNC As Integer = &H0
' 同期再生
Private Const SND_ASYNC As Integer = &H1
' 非同期再生
Private Const SND_MEMORY As Integer = &H4
' バッファからの再生
Private Const SND_LOOP As Integer = &H8
' ループ再生
Private Const SND_NOSTOP As Integer = &H10
' 再生中のサウンドを停止しない
Private Const SND_NOWAIT As Integer = &H2000
' ビジー状態なら即座に処理を返す
' バッファ Dim buffer() As Byte

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' ファイルからバイト配列に読み込み
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then Exit Sub
Dim stream As FileStream Dim reader As BinaryReader
stream = New FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
reader = New BinaryReader(stream)
buffer = reader.ReadBytes(CInt(stream.Length))
reader.Close()
stream.Close()

'メディアプレーヤーにBGMを設定
AxWindowsMediaPlayer1.URL = System.IO.Path.Combine(Application.StartupPath, "one_resort.wav")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' ファイルから再生
' ファイルからバイト配列に読み込み
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then Exit Sub
PlaySound(OpenFileDialog1.FileName, Nothing, SND_ASYNC)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If buffer Is Nothing Then
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then Exit Sub End If
' バッファから再生
PlaySound(buffer, Nothing, SND_MEMORY Or SND_ASYNC)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'PlaySoundの停止
PlaySound("", Nothing, SND_MEMORY Or SND_ASYNC)
End Sub
End Class

2008年5月29日木曜日

色で画像を検索する検索サイト






以前、色で画像を検索するサイトを見つけて、どこだったろうか?と思い出し・・・

http://www.xcavator.net/

このサイトの『Photo Search』から、Advanced Search モードで検索すると画像を色で検索してくれる。


テンプレート作成やイメージ画像など、とても便利だ。




これまた別のサイト






Flickrからもある。



http://color.slightlyblue.com/
フリー素材を検索してくれる。
う~~ん、便利。





2008年5月9日金曜日

母へ-To the Mammy-

もうすぐ母の日。
なんとなく手紙を書きたくなった。
今日は、単なる娘として(笑)

母ちゃんへ

父の介護、大変だろうけど。

私を盗み見るようにうかがう姿。
ふと見ると、疲れきって眠ってる姿。
父に当り散らす声。


どれも母ちゃんに違いない。
娘を『鬼』といい、話しかけてこなくなった母ちゃん。

娘は鬼といわれても、それでもあなたの娘です。
悲しいけど、それでもそっとあなたを見ています。
いつからか親子逆転してしまったけど、娘はいつまでもあなたの娘です。

どうすれば、元通り、明るく話せるのでしょう?
時間を作って、無駄話に付き合えば、それでいいのでしょうか?
でも、それでは何も解決しないのがわかっているから、鬼といわれても、必要なことを言うしかない。

すっかり自信をなくした姿を見るのが、ほんとはつらいんです。
他人なら、もっと優しくできるけど、それではその場しのぎの逃げしかできない。

うつ病にでもなれたら、楽かもしれない。
泣ける時間があれば、楽かもしれない。

でも、病気になっている時間も泣いている余裕も私にはない。
仕事をし、母と父を支える。
そうすることしか私にはない。

大好きな母ちゃんへ
大事な母ちゃんへ

私はあなたの娘です。
それだけは忘れないでくださいね。
鬼といわれても、私はあなたの娘なんですから。

お母ちゃん、大好きだから。
素直に言えずにごめんなさいね。

こんなところに書いても、母には伝わらないんだけど。
それでも、誰かに話したかった。

いつになったら、弱音を吐いていいのだろう?
いつになったら、泣いていいのだろう?




Today is the Mother's Day in Japan!

It came to want to write a letter somehow.
As a mere daughter today..  r(^^;)

To My Mammy

Though father might nurse, and be serious.

Appearance for which it looks so that it may steal a glance at me.
Appearance to get exhausted when seeing by chance and to sleep.
Voice that is hit father and dispersed.


All must be mammies.
You said to me, 'Demon', and it is a mammy who had not talked to.

Even if it is said by her the 'Demon', the daughter is still your daughter.
You are quietly still seen though it is sad.
I'm your daughter indefinitely though the parent and child has been reversed when it is.

How might I be able to speak brightly as before?
Then, is chitchatting making time each other good it?
However, a necessary thing can do nothing but be said then even if said the demon because it
is understood that anything doesn't solve.

It is completely painful to see the appearance to lose confidence and the truth is painful.
Then, if it is others, only running away of the stopgap can be done though it is possible to do more gently.

If it is possible to get depression, it might be easy.
It might be easy if there is time that can cry.

However, I do not have room for sick time to cry either.
I works, and mother and father are supported.
I have only that I do so it.

To the loved mammy
To an important mammy

I'm your daughter,still now.
It alone is not forgotten.
Because I am your daughter even if it is said the demon.

Because it ..mammy.. loves.
I'm sorry that it is not possible to say obediently.

Though it doesn't transmit to mother even if it writes in such a
place.
Still, I wanted to speak to someone.

You might whine if it comes when.
You might cry if it comes when.

2008年4月17日木曜日

W-ZERO3とVS.NET

W-ZERO3を商魂たくましく去年購入。
でもまだ、プログラムはテストしか作ってない。
なかなか仕事に追われて、+αの開発ができていないなぁ。

VS2002から作りたいと思いながら、今年はもうすでにVS2008を使う羽目になりつつある。

外部制御の方法をただいま模索中 ・・・
む、難しいなぁ。
使えるようになったら、売れるのになぁ(笑)

2008年4月10日木曜日

メモリが飛んだ-The memory broke. -

先日増設したメモリが飛んだ(;_:)
iGoogleの設定を変更してたら、急にメモリダンプされた

・・・メモリを抜いて、復旧したが。
メモリは再起不能だった。

こんなこともあるんだなぁ。
512Mbのメモリを買い換えて、無事復旧完了。
けど、HDの断片化がひどいもので、.NET周りが壊れまわってしまった。
仕事で使うのに・・・

2日かけて断片化を何とか使用可能な程度に復旧。
けど、なぜだかHD内にないはずのファイルが断片化されたファイルとして検出されている。
しょうがないので、そのままになっている。

VB.NET2008をインストールしないといけないのに、このPCにはVB6.0、VB.NET2002、VB.NET2003、VB.NET2005が入っている。
全部使用しなければならないとはいえ、大丈夫か?(^^;;;

もう、おなかいっぱいだけど。

The memory that I had increased the other day broke.
When the setting of iGoogle had been changed, the memory was suddenly dumped to PC.

・・・The memory has broken though it restored when PC pulls out the memory.
...there are these kind of things, too...
The memory of 512Mb is newly bought, and it completes it safely restoration.
However, the file related to .NET seems to be considerably broken in the one with an awful fragmentation of HD.
To use on business ・・・

It manages to restore the fragmentation to the use Ca Ne level spending the second.
It is detected as a file that the file that must not be is fragmented in HD why. It is the state as it is because there is no other way.

There are VB6.0, VB.NET2002, VB.NET2003, and VB.NET2005 in this PC though it is necessary to install VB.NET2008.
Is it safe even though it is necessary to use everything?(^^;;;

HD almost becomes full.

2008年4月7日月曜日

メモリを増設-The memory of CF-18 is increased-

CF-18のメモリを増設。
今まで256MBだったんで、まぁ動かない(笑)
2年ぐらい前に購入し、引越しで行方不明になっていたんだけど、ふとしたところから出土(笑)
で、自分でやってみることにした。

でも、RAMスロットがわからず、もちろんマニュアルは行方不明なので、ネットを調べる。
・・・CF-18なんて、なかなか見つからず、四苦八苦し、裏側のスピーカーを外したところと判明。

静電気を帯びやすい体質なので、注意しながらメモリを差し込む。
びくびくしつつ、電源を入れた。
ちゃんと動いた。

これからは自分でやってみようと思った・・・
スロットの場所がわかりにくかったんで、メモとして。

The memory of CF-18 is increased. It was the current 256MB, and it ..movement.. doesn't exist. ..(.. ..laughter..)It bought it for about two years ago, and it laughed and it decided ..excavation (.. to try from a casual point with) for myself though it was a move and missing. However, RAM slot is not understood, and because the manual is of course missing, the net is examined. ・・・Place where CF-18 is not found easily, it troubles, and speaker on the other side was removed and turning out. The memory is inserted while noting it because it is a constitution that wears static electricity easily. It turned on power timidly. It moved neatly. Hereafter, I was going to try by myself ・・・. The place of the slot was incomprehensible, and as a memo.