0

画像に文字列を描画してピクチャ ボックスに表示しようとしていますが、.Net グラフィック ライブラリの DrawString 関数を使用しています。

問題は、関数が2つの画像に描画されていることです-(描画したい画像と、描画したくない元の画像)。

コードは次のとおりです。

Image img = new Bitmap(1, 1);  
img = original;

drawing = Graphics.FromImage(img);
Font priceFont = new Font("Calibri (Body)", 16.0f, FontStyle.Bold);

drawing.DrawString(textBox1.Text, priceFont, brush, 410f, 660);
drawing.Save();
drawing.Dispose();

pictureBox1.BackgroundImage = null;
pictureBox1.BackgroundImage = img;
pictureBox2.BackgroundImage = null;
pictureBox2.BackgroundImage = original;

picbox1 と picbox2 は、オブジェクト「描画」が両方の画像に描画されているかのように、まったく同じ結果を表示しています。「オリジナル」ではなく「img」オブジェクトのみを描画する方法はありますか?

4

1 に答える 1

1
Image img = new Bitmap(1, 1);  
img = original;

上記の 2 行により、この問題が発生します。

あなたはこのようにそれを使うべきです

Image img = new Bitmap(original);
于 2013-08-27T11:41:40.750 に答える