Forcing repainting the cell
-
If it has an Invalidate method, call it, that forces a repaint of a control.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
How about
DataGrid.InvalidateCell
? ;)
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed
I crated my own class inherited from DataGridViewImageCell. How can I call a method from parent object which is DataGridView? I passed a DataGridView parameter to constructor but when I call grid.InvalidateCell() I have a message "Object refrence not set to an instance of an object"
-
If it has an Invalidate method, call it, that forces a repaint of a control.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Then you probably need to Invalidate the entire grid.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Then you probably need to Invalidate the entire grid.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
How about
DataGrid.InvalidateCell
? ;)
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed
-
I think I am near the solution however how to call a method of grid being on DataGridViewImageCell level?
Which methods of the grid. Please elaborate.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed
-
Which methods of the grid. Please elaborate.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed
I created my own classes public class ImageCell : DataGridViewImageCell { public ImageCell(DataGridView grid) { this.grid = grid; } ........ private void animate(object o, EventArgs e) { DataGridView dgv = (DataGridView)grid; dgv.InvalidateCell(this); /// there is an error } } and public class ImageColumn : DataGridViewColumn { public ImageColumn(DataGridView dgv) { this.CellTemplate = new ImageCell(dgv); this.HeaderText = ""; this.Width = 25; this.Resizable = DataGridViewTriState.False; } } In my application when I have DataGridView I just add ImageColumn object as new column passing DataGridView object to the constructor: ImageColumn imgCol = new ImageColumn(m_DataGridView); m_DataGridView.Columns.Add(imgCol); I do not like to pass such a parameter to the constructor. However how to call InvalidateCell in ImageCell class? thanks Ela
-
I created my own classes public class ImageCell : DataGridViewImageCell { public ImageCell(DataGridView grid) { this.grid = grid; } ........ private void animate(object o, EventArgs e) { DataGridView dgv = (DataGridView)grid; dgv.InvalidateCell(this); /// there is an error } } and public class ImageColumn : DataGridViewColumn { public ImageColumn(DataGridView dgv) { this.CellTemplate = new ImageCell(dgv); this.HeaderText = ""; this.Width = 25; this.Resizable = DataGridViewTriState.False; } } In my application when I have DataGridView I just add ImageColumn object as new column passing DataGridView object to the constructor: ImageColumn imgCol = new ImageColumn(m_DataGridView); m_DataGridView.Columns.Add(imgCol); I do not like to pass such a parameter to the constructor. However how to call InvalidateCell in ImageCell class? thanks Ela
You should be able to get a reference to the
DataGridView
from the conveniently named propertyDataGridView
in your class since you inherit fromDataGridViewColumn
/Cell
and both these eventually inherit fromDataGridViewElement
which has a property which provides a reference to theDataGridView
.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed
-
You should be able to get a reference to the
DataGridView
from the conveniently named propertyDataGridView
in your class since you inherit fromDataGridViewColumn
/Cell
and both these eventually inherit fromDataGridViewElement
which has a property which provides a reference to theDataGridView
.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed
What a fool I am. How couldn't I see such a beatifull protperty - just DataGridView. Many thanks for help. It is blinking now but there is something with gif. It is displayed as x - as it was no gif. However I think it is another problem. Many thanks one more time Ela
-
What a fool I am. How couldn't I see such a beatifull protperty - just DataGridView. Many thanks for help. It is blinking now but there is something with gif. It is displayed as x - as it was no gif. However I think it is another problem. Many thanks one more time Ela
Don't worry I had a similar problem where I spent a whole day ripping code apart trying to find the answer and in the end it was looking me in the face :-O The X is probably because it can't find the gif or there was an error in the drawing code (similar to when a control crashes on the designer).
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed
-
Don't worry I had a similar problem where I spent a whole day ripping code apart trying to find the answer and in the end it was looking me in the face :-O The X is probably because it can't find the gif or there was an error in the drawing code (similar to when a control crashes on the designer).
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9 Ed