TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
zsafadi
NA
26
0
Creating Custom DataGrid Column
Jan 22 2005 2:33 PM
Hi all, I'm developing a custom DataGrid Column, that hosts a custom IPAddress Control. I Should override the Paint mathod to paint the desiered text on the GridColumn when the Paint method is called because the DataGrid USer clicks the last row in the grid to insert a new value. i retrieve the value from the Column using "GetColumnValueAtRow ( source,rowNum )" and Paint it as shown in the code below. i handled the problem of retrieving an invalid value but assign the NullText property that i previosly set. But still the Paint draws 4 extra empty rows instead of only one. anyway seems that i'm not handling the Paint method properly so does anyone knows how i should handle the Paint method when the User clicks on the last row in the DataGrid to insert a new value. protected override void Paint ( Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight ) { try { string strIPAddress = "" ; try { strIPAddress = ( string ) GetColumnValueAtRow ( source, rowNum ) ; } catch { strIPAddress = this.NullText ; } Rectangle rect = bounds ; g.FillRectangle ( backBrush,rect ) ; rect.Offset ( 0, 2 ) ; rect.Height -= 2 ; g.DrawString ( strIPAddress , this.DataGridTableStyle.DataGrid.Font, foreBrush, rect ) ; } catch { System.Diagnostics.Debug.Assert ( false ) ; } }
Reply
Answers (
0
)
Dataset and multiple forms problem
XP Themes