Click here to Skip to main content
15,906,625 members
Home / Discussions / C#
   

C#

 
GeneralRe: HI ANYBODY PLS HELP ME ! Pin
jschell5-Mar-12 8:29
jschell5-Mar-12 8:29 
AnswerRe: HI ANYBODY PLS HELP ME ! Pin
Luc Pattyn5-Mar-12 8:48
sitebuilderLuc Pattyn5-Mar-12 8:48 
AnswerRe: HI ANYBODY PLS HELP ME ! Pin
Shameel5-Mar-12 2:22
professionalShameel5-Mar-12 2:22 
AnswerRe: HI ANYBODY PLS HELP ME ! Pin
PIEBALDconsult5-Mar-12 7:20
mvePIEBALDconsult5-Mar-12 7:20 
AnswerRe: HI ANYBODY PLS HELP ME ! Pin
jschell5-Mar-12 8:31
jschell5-Mar-12 8:31 
QuestionDisplay images in Gridview Pin
Elizabeth Rani4-Mar-12 18:43
Elizabeth Rani4-Mar-12 18:43 
AnswerRe: Display images in Gridview Pin
Abhinav S4-Mar-12 21:09
Abhinav S4-Mar-12 21:09 
AnswerRe: Display images in Gridview Pin
Montasser Ben Ouhida4-Mar-12 21:41
Montasser Ben Ouhida4-Mar-12 21:41 
Hi,

You can implement the cell paint event. I think that you have a data table like this:
(Val1, Val2, PicturePath, ...).
You can find bellow an example of code that shows in a data grid view a grid contact:
----------------------------------------------------------------
|Picture | First Name | Last Name | Phone number |
----------------------------------------------------------------
|    Wink | ;)   |     Mr. X       |   X1            |  00112233       |
----------------------------------------------------------------
|    Wink | ;)   |     Mr. X       |   X1            |  00112233       |
----------------------------------------------------------------

C#
// Subscribe to the event cell painting
myDataGridView += new DataGridViewCellPaintingEventHandler(myDataGridView_CellPainting);

C#
// Implement the event
void myDataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
      // Test if you are drawing the picture cell. Note that the RowIndex == 0 is the row header
      if (e.RowIndex > 0 && e.ColumnIndex == 0)
      {
          try
          {
             string strPath = myDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
             // To optimize you program, you can store the loadeds picture in a dictionary like this:
             Bitmap objPicture = null; 
             if(dicPictures.ContainsKey(strPath))
             {
                  objPicture = dicPictures[strPath];
             }
             else
             {
                  objPicture = Bitmap.FromFile(strPath);
                  dicPictures.Add(strPath, objPicture);
             }

             e.Graphics.DrawImage(objPicture, e.CellBounds);
           }
           catch (Exception Error)
           { 
              // Error Log or Managing
           } 
       }
}

QuestionBinary Read and Write Pin
computerpublic4-Mar-12 17:45
computerpublic4-Mar-12 17:45 
AnswerRe: Binary Read and Write Pin
Bernhard Hiller4-Mar-12 19:22
Bernhard Hiller4-Mar-12 19:22 
GeneralRe: Binary Read and Write Pin
computerpublic7-Mar-12 6:38
computerpublic7-Mar-12 6:38 
Questionintegrate two solution Pin
MemberDotNetting4-Mar-12 12:16
MemberDotNetting4-Mar-12 12:16 
AnswerRe: integrate two solution Pin
Dave Kreskowiak4-Mar-12 12:50
mveDave Kreskowiak4-Mar-12 12:50 
GeneralRe: integrate two solution Pin
MemberDotNetting4-Mar-12 12:58
MemberDotNetting4-Mar-12 12:58 
AnswerRe: integrate two solution Pin
Richard Andrew x644-Mar-12 12:51
professionalRichard Andrew x644-Mar-12 12:51 
GeneralRe: integrate two solution Pin
MemberDotNetting4-Mar-12 12:58
MemberDotNetting4-Mar-12 12:58 
GeneralRe: integrate two solution Pin
Dave Kreskowiak4-Mar-12 16:53
mveDave Kreskowiak4-Mar-12 16:53 
Questionlooking for binding properties dynamicly in wpf Pin
Aymane Farissi4-Mar-12 4:58
Aymane Farissi4-Mar-12 4:58 
AnswerRe: looking for binding properties dynamicly in wpf Pin
Richard Andrew x644-Mar-12 6:38
professionalRichard Andrew x644-Mar-12 6:38 
AnswerRe: looking for binding properties dynamicly in wpf Pin
Dave Kreskowiak4-Mar-12 7:23
mveDave Kreskowiak4-Mar-12 7:23 
Questionhelp Pin
Member 86946024-Mar-12 3:37
Member 86946024-Mar-12 3:37 
AnswerRe: help Pin
Richard MacCutchan4-Mar-12 3:42
mveRichard MacCutchan4-Mar-12 3:42 
AnswerRe: help Pin
Richard Andrew x644-Mar-12 6:39
professionalRichard Andrew x644-Mar-12 6:39 
AnswerRe: help Pin
Dave Kreskowiak4-Mar-12 7:21
mveDave Kreskowiak4-Mar-12 7:21 
AnswerRe: help Pin
Shameel5-Mar-12 2:24
professionalShameel5-Mar-12 2:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.