Skip to content

WF-64705 - Updated the README file #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# How to load the image without reducing the resolution
This example demonstrates that how to load the image without reducing the resolution

To maintain the image resolution, convert the image as <b>byte[]</b> format and use <b>Byte[]</b> datatype for image column to the grid. By default, when the image loaded in the grid cell is resized using [ImageSize](https://learn.microsoft.com/pt-br/dotnet/api/system.windows.forms.imagelist.imagesize?redirectedfrom=MSDN&view=netframework-4.7.2) property, the resolution of the image gets affected.

## C#

```C#
private DataTable CreateTable()
{
dt.Columns.Add("Name");
dt.Columns.Add("Id");
dt.Columns.Add("Date");
dt.Columns.Add("Country");
dt.Columns.Add("Ship City");
dt.Columns.Add("Ship Country");
dt.Columns.Add("Freight");
dt.Columns.Add("Postal code");
dt.Columns.Add("ImageColumn", typeof(byte[]));

for (int l = 0; l <= gridControl1.RowCount; l++)
{
DataRow dr = dt.NewRow();
dr[0] = name1[r.Next(0, 5)];
dr[1] = "E" + r.Next(30);
dr[2] = new DateTime(2012, 5, 23);
dr[3] = country[r.Next(0, 5)];
dr[4] = city[r.Next(0, 5)];
dr[5] = scountry[r.Next(0, 5)];
dr[6] = r.Next(1000, 2000);
dr[7] = r.Next(10 + (r.Next(600000, 600100)));
//Adding image as Byte[] array.
Byte[] imageArray = System.IO.File.ReadAllBytes(FindFile(@"flower" + l % 3 + ".jpg"));
dr[8] = imageArray;
dt.Rows.Add(dr);
}
return dt;
}
```