|
Hi
Is it possible to force DataGridViewCell to repaint? Just refreshing it.
Thanks
Ela
|
|
|
|
|
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"
|
|
|
|
|
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
|
|
|
|
|
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 property DataGridView in your class since you inherit from DataGridViewColumn / Cell and both these eventually inherit from DataGridViewElement which has a property which provides a reference to the DataGridView .
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
|
|
|
|
|
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
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
|
|
|
|
|
Such a life of developer
|
|
|
|
|
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
|
|
|
|
|
But DataGridViewImageCell does not have a Invalidate method.
|
|
|
|
|
Then you probably need to Invalidate the entire grid.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
There is a method grid.InvalidateCell however I cannot call it because I have to do it from DataGridViewImageCell level (form my own class). I described the problem above.
Thanks for advice.
|
|
|
|
|
I migrated one of my solutions to .net 2005 from 2003.
Issues:
When I am going to rebuile it some of the reerances are deleted from the dubug folder of some projects and compilation error comes saying that referance not found.
But if I am building (Not Rebuild) each projects differantly then this problem is not coming
Whatshould I do?
Please help me.
Rabindra Patra
|
|
|
|
|
Delete all the references and add them again.
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
|
|
|
|
|
In C#, how should I use a VB ocx that is dependent on a win32 dll ?
When ActiveX is dependent on another dll should we do something different?
|
|
|
|
|
TinyTin wrote: ocx
Hit the nail on the head here, an OCX is an OCX, doesn't matter whether it's VB, C++, Python, PHP, C#, VB.NET
TinyTin wrote: When ActiveX is dependent on another dll should we do something different?
No, just make sure the dependency is there when you try an access it.
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
|
|
|
|
|
Hi all,
i need to write some program to handle registry please give me some links or some guidence to do something . this type of programming is new for me so plz guide in detail.
thanks in advance.
Keep Praying
|
|
|
|
|
This piece of code helped me alot, hope it'll work for you.
/* ***************************************
* ModifyRegistry.cs
* ---------------------------------------
* a very simple class
* to read, write, delete and count
* registry values with C#
* ---------------------------------------
* if you improve this code
* please email me your improvement!
* ---------------------------------------
* by Francesco Natali
* - fn.varie@libero.it -
* ***************************************/
using System;
// it's required for reading/writing into the registry:
using Microsoft.Win32;
// and for the MessageBox function:
using System.Windows.Forms;
namespace Utility.ModifyRegistry
{
/// <summary>
/// An useful class to read/write/delete/count registry keys
/// </summary>
public class ModifyRegistry
{
private bool showError = false;
/// <summary>
/// A property to show or hide error messages
/// (default = false)
/// </summary>
public bool ShowError
{
get { return showError; }
set { showError = value; }
}
private string subKey = "SOFTWARE\\" + Application.ProductName.ToUpper();
/// <summary>
/// A property to set the SubKey value
/// (default = "SOFTWARE\\" + Application.ProductName.ToUpper())
/// </summary>
public string SubKey
{
get { return subKey; }
set { subKey = value; }
}
private RegistryKey baseRegistryKey = Registry.LocalMachine;
/// <summary>
/// A property to set the BaseRegistryKey value.
/// (default = Registry.LocalMachine)
/// </summary>
public RegistryKey BaseRegistryKey
{
get { return baseRegistryKey; }
set { baseRegistryKey = value; }
}
/* **************************************************************************
* **************************************************************************/
/// <summary>
/// To read a registry key.
/// input: KeyName (string)
/// output: value (string)
/// </summary>
public string Read(string KeyName)
{
// Opening the registry key
RegistryKey rk = baseRegistryKey ;
// Open a subKey as read-only
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistrySubKey doesn't exist -> (null)
if ( sk1 == null )
{
return null;
}
else
{
try
{
// If the RegistryKey exists I get its value
// or null is returned.
return (string)sk1.GetValue(KeyName.ToUpper());
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
ShowErrorMessage(e, "Reading registry " + KeyName.ToUpper());
return null;
}
}
}
/* **************************************************************************
* **************************************************************************/
/// <summary>
/// To write into a registry key.
/// input: KeyName (string) , Value (object)
/// output: true or false
/// </summary>
public bool Write(string KeyName, object Value)
{
try
{
// Setting
RegistryKey rk = baseRegistryKey ;
// I have to use CreateSubKey
// (create or open it if already exits),
// 'cause OpenSubKey open a subKey as read-only
RegistryKey sk1 = rk.CreateSubKey(subKey);
// Save the value
sk1.SetValue(KeyName.ToUpper(), Value);
return true;
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
ShowErrorMessage(e, "Writing registry " + KeyName.ToUpper());
return false;
}
}
/* **************************************************************************
* **************************************************************************/
/// <summary>
/// To delete a registry key.
/// input: KeyName (string)
/// output: true or false
/// </summary>
public bool DeleteKey(string KeyName)
{
try
{
// Setting
RegistryKey rk = baseRegistryKey ;
RegistryKey sk1 = rk.CreateSubKey(subKey);
// If the RegistrySubKey doesn't exists -> (true)
if ( sk1 == null )
return true;
else
sk1.DeleteValue(KeyName);
return true;
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
ShowErrorMessage(e, "Deleting SubKey " + subKey);
return false;
}
}
/* **************************************************************************
* **************************************************************************/
/// <summary>
/// To delete a sub key and any child.
/// input: void
/// output: true or false
/// </summary>
public bool DeleteSubKeyTree()
{
try
{
// Setting
RegistryKey rk = baseRegistryKey ;
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistryKey exists, I delete it
if ( sk1 != null )
rk.DeleteSubKeyTree(subKey);
return true;
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
ShowErrorMessage(e, "Deleting SubKey " + subKey);
return false;
}
}
/* **************************************************************************
* **************************************************************************/
/// <summary>
/// Retrive the count of subkeys at the current key.
/// input: void
/// output: number of subkeys
/// </summary>
public int SubKeyCount()
{
try
{
// Setting
RegistryKey rk = baseRegistryKey ;
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistryKey exists...
if ( sk1 != null )
return sk1.SubKeyCount;
else
return 0;
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
ShowErrorMessage(e, "Retriving subkeys of " + subKey);
return 0;
}
}
/* **************************************************************************
* **************************************************************************/
/// <summary>
/// Retrive the count of values in the key.
/// input: void
/// output: number of keys
/// </summary>
public int ValueCount()
{
try
{
// Setting
RegistryKey rk = baseRegistryKey ;
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistryKey exists...
if ( sk1 != null )
return sk1.ValueCount;
else
return 0;
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
ShowErrorMessage(e, "Retriving keys of " + subKey);
return 0;
}
}
/* **************************************************************************
* **************************************************************************/
private void ShowErrorMessage(Exception e, string Title)
{
if (showError == true)
MessageBox.Show(e.Message,
Title
,MessageBoxButtons.OK
,MessageBoxIcon.Error);
}
}
}
He who laughs last is a bit on the slow side
|
|
|
|
|
Hi,
Dear Respected Programmers
Kindly check the following command that, How may I make it correct? because i am getting an error => "culture name 'en-uk' is not supported"
Command is:
-----------
Application.CurrentCulture = new System.Globalization.CultureInfo("en-UK");
Thank you very much
|
|
|
|
|
Hi,
Try something like:
<br />
Application.CurrentCulture = new System.Globalization.CultureInfo("en-GB");<br />
Do your best to be the best
|
|
|
|
|
How to extend DataGrid so that i can add a property to its column?
|
|
|
|
|
Hello,
I have a problem with a dynamically allocated datagrid whose horizontol scroll bar does not scroll as expected when using the arrow keys. It is jittery but most irritatingly it stops about 50 pixels from scrolling full right.
Can anyone please help?
Kiterq...
|
|
|
|
|
[data]
string sbStrings = @"program files\software\program\report.htm,8/10/2006 4:23 pm-program files\software\program\report.htm,8/10/2006 2:25 pm-program files\software\program\report.htm,6/23/2006 8:14 pm-program files\software\program\report.htm,8/30/2006 1:12 pm";
Q. How would I split this , and - delimited string into a string [,] array?
or use something like this:
ArrayList list = new ArrayList();
list.Add(new ArrayList());
string1 string2
program files\softsoftware\program\help\help3.htm 9/22/2006 2:22 pm
|
|
|
|