Answer the question
In order to leave comments, you need to log in
What is it, where is it from???? What are the dots on the image? c#?
Where do these points come from, already in the second project in a row appear. And as always, I am unique, I have not found such a problem anywhere, but here out of the blue that I will not do that hello.
Image 3600 pixels by 3600 texture.
my
app Photos App
class PictureBoxCtrl : PictureBox
{
public PictureBoxCtrl() : base()
{
Dock = DockStyle.Fill;
BackColor = Color.Transparent;
DoubleBuffered = true;
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Invalidate();
}
protected override void OnPaint(PaintEventArgs pe)
{
//base.OnPaint(pe);
if (Image != null)
{
//pe.Graphics.Clear(BackColor);
float kX, kY;
kX = Image.Width / (float)this.Width;
kY = Image.Height / (float)this.Height;
int w, h;
if (kX < kY)
{
w = (int)( (float)Image.Width/kY);
h = (int)((float)Image.Height/kY);
}
else
{
w = (int)((float)Image.Width / kX);
h = (int)((float)Image.Height / kX);
}
var dstRect = new Rectangle(
(this.Width - w) / 2, (this.Height -h),
w, h
);
var srcRect = new Rectangle((int)0,0, Image.Width, Image.Height);
pe.Graphics.DrawImage(Image, dstRect, srcRect, GraphicsUnit.Pixel);
}
}
Answer the question
In order to leave comments, you need to log in
You have transparency turned on, and artifacts appear in places where white reaches its maximum.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question