Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

画像透過合成について

87 views
Skip to first unread message

裕猫

unread,
Aug 20, 2008, 10:30:01 PM8/20/08
to
初めて投稿します。
現在C#にて画像合成の勉強をしています。C#逆引き大全という本のコードを参考にテストしておりますが、オリジナルのCG(ビットマップ)を指定して、コードを書きビルドしましたが、エラーはないのですがデバッグで動かしても、透過合成されるCGが表示されません。以下がコードですが、何が悪いのか原因がつかめません。おわかりになる方いらっしゃいましたら教えてください。よろしくお願いいたします。ちなみに付録のCDについていたサンプルはちゃんと動きます。プロパティの条件コードまったく同じなのに、なぜオリジナル画像が表示できないのか困っています。
コード
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace _59
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void pictureBox1_Click(object sender, EventArgs e)
{
Graphics g = pictureBox1.CreateGraphics();
ImageAttributes ia = new ImageAttributes();
ia.SetColorKey(Color.White, Color.White);
Image img = Properties.Resources.m01;
Rectangle rect = new Rectangle(0, 0, img.Width, img.Height);
g.DrawImage(img, rect, 0, 0, img.Width, img.Height,
GraphicsUnit.Pixel, ia);
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}

裕猫

unread,
Aug 21, 2008, 9:43:01 PM8/21/08
to
別の所で動く方法が解りました。お騒がせしました。
0 new messages