473,813 Members | 3,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom - DataGridViewCol umn / DataGridViewCel l

I am trying to create a custom DataGridViewCel l which is "NOT" derived from
DataGridViewTex tBoxColumn. The painting works fine but I am unable to get
the control into edit mode.

Do I need to manually handle the OnClick, something else, or is there
somewhy to set the edit control?

Edit type is called when the cell is clicked so it seems to be doing
something.

Regards,
John

class clsPMenuColumn : DataGridViewCol umn
{
private System.Data.Dat aSet displayStrings;
public System.Data.Dat aSet DisplayStrings
{
set
{
this.displayStr ings = value;
}
get
{
return this.displayStr ings;
}
}

public override object Clone()
{
clsPMenuColumn cell = (clsPMenuColumn )base.Clone();
cell.DisplayStr ings = this.DisplayStr ings;

return cell;
}

public override DataGridViewCel l CellTemplate
{
get
{
return base.CellTempla te;
}
set
{
if (value != null &&
!value.GetType( ).IsAssignableF rom(typeof(clsP MenuCell)))
throw new InvalidCastExce ption("Must be a Pmenu cell");

base.CellTempla te = value;
}
}
}
}

class clsPMenuCell : DataGridViewCel l
{
private System.Data.Dat aSet DisplayStrings
{
get
{
if (base.OwningCol umn is clsPMenuColumn)
return ((clsPMenuColum n)base.OwningCo lumn).DisplaySt rings;
return null;
}
}

public override object DefaultNewRowVa lue
{
get
{
return new clsMenuStructur e();
}
}

public override Type EditType
{
get
{
return typeof(ctrlPMen uItem);
}
}

public override Type ValueType
{
get
{
return typeof(clsMenuS tructure);
}
}

public clsPMenuCell() : base()
{
}

protected override void Paint(System.Dr awing.Graphics graphics,
System.Drawing. Rectangle clipBounds, System.Drawing. Rectangle cellBounds,
int rowIndex, DataGridViewEle mentStates cellState, object value, object
formattedValue, string errorText, DataGridViewCel lStyle cellStyle,
DataGridViewAdv ancedBorderStyl e advancedBorderS tyle, DataGridViewPai ntParts
paintParts)
{
/// do painting here
}
}
Jul 27 '06 #1
1 10664
Never mind, had to hit F2 for edit mode.

Regards,
John
Jul 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1327
by: tsair | last post by:
When i add a new property into datagridviewcolumn, the property alway show null even i has been key in something in the property. how to solve this ? thank you
0
1282
by: Tsair | last post by:
I create a custom DataGridViewColumn from a usercontrol with Textbox and a button. After input the usercontrol textbox value and press Tab to next column, the value of the textbox does not show in the column. How to make the column show the usercontrol value ?
5
11219
by: Tsair | last post by:
I do a customise DataGridColumn with a UserControl (TextBox + Button for Calender), DataGridView does not show the data content of the column.
2
1423
by: Andy | last post by:
Hi all, I'm creating my own DataGridViewColumn class, and have added a string property to it which should be settable via the Property designer. I've gotten the property to show up, but even if i set a value, the code generated sets the property to null, not the value I typed. Any ideas? Thanks
7
8966
by: SteveT | last post by:
I would like to create a customized DataGridViewColumn called DataGridViewCheckedListBoxColumn. I'd like the ability to multi-select items in the list. Does anyone know of an example of how this is done? -- ----------- Thanks, Steve
0
1224
by: Franz | last post by:
I created a custom dataGridViewColumn which only accept numbers. For this Column, I can define a precision (number of decimal). I can set this property into my code, but not in design mode! Although the property is displayed, the value is never recorded! any ideas? thx in advance.
1
3547
by: Charles Bazi | last post by:
Hi, Based on MSDN http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx smple, I have made my custom DataGridViewColumn. I use it to host a custom control, sort of ComboBox, but instead of having a dropdown list, it opens a search dialog when the button of control (a textbox with a button) is pressed. So, when I pick something with my control, I have two results in my
0
1131
by: Katit | last post by:
I need to be able to custom color background of cells. When I do DataGridViewCell.Style.BackColor = Color.Yellow; It works properly as with any other enumerated color. When I try to do something like:
1
2503
by: lbelkova | last post by:
Hello, I've created a custom DataGridViewColumn. Everything work well, except for some reason the column doesn't accept some of the chars: "q", "." and "'". Did anybody have a similar problem? Please let me know. Any help will be gratefully appreciated. Thanks. my code:
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10407
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10424
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10140
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9224
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.