Vladislav Vazhenin
Vladislav Vazhenin

Reputation: 349

Why I get two images overlapped in datagridview?

When I trying to set new image in datagridview imagecell I get two images overlapped and not just second image.

private void dataGridView4_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
    {
        if (e.ColumnIndex == 13)
        {
            if ((int) e.Value == 1)
                e.Value = Resources.ResourceManager.GetObject("unLock");
            else
                e.Value = Resources.ResourceManager.GetObject("Lock1");
        }
    }

When I set value to 1 I see first image. When I set to 0 I see two images in one cell overlapped.

Upvotes: 0

Views: 121

Answers (2)

Vladislav Vazhenin
Vladislav Vazhenin

Reputation: 349

I used images with transparent background. When I change background to non-transparent color problem was solved.

Upvotes: 1

Raikoug
Raikoug

Reputation: 377

You can try calling a refresh.

Upvotes: 1

Related Questions