我试图使用" semitransparent"在图片框上画画。钢笔。但是,当我的鼠标移动到绘制区域时,颜色会变得更暗,颜色也不均匀,如下图所示。
!左上区域比只涂过一次的中下区域更暗。1
是否有任何方法可以统一用于在pictureBox上绘画的颜色。
以下是我的代码的一部分
private: System::Void pictureBox1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if(e->Button==System::Windows::Forms::MouseButtons::Left)
{
Graphics ^ gg = Graphics::FromImage(pictureBox1->Image);
Pen ^pen=gcnew Pen(Color::FromArgb(20, Color::Red),20);
pen->StartCap = System::Drawing::Drawing2D::LineCap::RoundAnchor;
pen->EndCap = System::Drawing::Drawing2D::LineCap::RoundAnchor;
gg->DrawLine(pen,x0,y0,e->X,e->Y);
x0=e->X;
y0=e->Y;
pictureBox1->Refresh();
}
}