2枚の画像の描画には時間がかかるので、できるだけ減らしたいと思います。私はpictureeditを使用し、ondrawイベントをオーバーライドしました。ここに以下の部分を追加しましたが、黒の画像になってしまいます。絵を描く必要があるかどうかを確認したいです。このチェックは機能します。次に、背景を描画して別の背景でオーバーレイします。これを画像として保存し、コントロールの背景として配置します。
背景を再描画しない場合は、次のように呼び出します。
g.Clear(Color.Transparent);
私のpictureEditペイントイベントで。
私は何か間違っていましたか?
よろしくお願いします、
パトリック
//Recalculate the background
if (redrawBackground)
{
g.FillRectangle(Brushes.White, 0, 0, backGroundImage.Width, backGroundImage.Height);
g.Clear(Color.White);
//this is drawn without aspect ration. The matrix is stored, since drawing images is expensive
GenerateTransformation(g, false);
g.DrawImageUnscaled(backGroundImage, new Rectangle(0, 0, backGroundImage.Width, backGroundImage.Height));
lastTransformation = g.Transform;
GenerateTransformation(g, true);
g.DrawImage(foreGroundImage, new Rectangle(0, 0, backGroundImage.Width, backGroundImage.Height));
lastTransformationAspect = g.Transform;
//Save bitmap as background
Bitmap bmp = new Bitmap(backGroundImage.Width, backGroundImage.Height, e.Graphics);
//Trick the background by a new image
pictureEdit.Image = bmp;
}