私は本当に厄介な問題に直面しています..
.Net 2.0 C# WinForms プロジェクトがあります。ビットマップを描画領域に引き延ばそうとしていますが、何らかの理由で適切に引き伸ばされません。描画領域の右マージンと下マージンにアルファ チャネル グラデーションが表示されます。
この問題を特定するのにかなりの時間がかかりました。問題を再現するコードを数行作成します (以下のコード スニペットとスクリーンショットを参照)。
誰でもこの問題に光を当てることができますか?
前もって感謝します。
--
private void Form1_Paint( object sender, PaintEventArgs e )
{
// Create a black bitmap resource sized 10x10
Image resourceImg = new Bitmap( 10, 10 );
Graphics g = Graphics.FromImage( resourceImg );
g.FillRectangle( Brushes.Black, 0, 0, resourceImg.Width, resourceImg.Height );
Rectangle drawingArea = new Rectangle( 0, 0, 200, 200 ); // Set the size of the drawing area
e.Graphics.FillRectangle( Brushes.Aqua, drawingArea ); // Fill an aqua colored rectangle
e.Graphics.DrawImage( resourceImg, drawingArea ); // Stretch the resource image
// Expected result: The resource image should completely cover the aqua rectangle.
// Actual Result: The right and bottom edges become gradiently transparent (revealing the aqua rectangle under it)
}