Painting on a GridControl

Hi there! I''ve been having some problems with painting on my grid... what I want to do is paint some strings on it, but I want to do it on my own. Not using Events to do it. I would like to know if there''s a way to get a graphics tool to paint on a GridControl, and use it in a handmade method or function. Thank you! Pierre-Luc

6 Replies

PI Pierre-Luc February 20, 2006 03:33 PM UTC

Well, in the end I found out I can''t do what I want without an event..... but still when I use this : Private Sub PlanifGrid_DrawCell(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs) Handles PlanifGrid.DrawCell Dim Name As String e.Graphics.DrawString(Name, Me.drawFont, Me.drawBrush, 40, 40) End If End Sub it paints at the correct place, but if I click or double-click on the cell where it was drawn,.... it disapear. is there some kind of onfocus event that redraws an empty cell? or something I could do to fix this thanks!


AD Administrator Syncfusion Team February 21, 2006 05:34 AM UTC

Hi Pierre, You can avoid this problem, by setting the e.Cancel property to true in the draw_cell event handler. Here is the code snippet Private Sub PlanifGrid_DrawCell(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs) Handles PlanifGrid.DrawCell Dim Name As String e.Graphics.DrawString(Name, Me.drawFont, Me.drawBrush, 40, 40) e.Cancel = True; End If End Sub Regards, Madhan.


PI Pierre-Luc February 21, 2006 06:15 PM UTC

It worked... but now the grid headers are not drawing... I attached an example of the graphic output, the THIS is while using e.cancel = true and the THAT is while not using it (and having the problem I had at first) I hope it can be fixed Pierre-Luc


PI Pierre-Luc February 21, 2006 06:16 PM UTC

heh... forgot to attache the picture

Example3.zip


AD Administrator Syncfusion Team February 22, 2006 02:04 PM UTC

Hi Pierre, The attached sample is working fine, uses the same code. Can you post a sample showing the mentioned problem. And also kindly mention the grid version that you are using. Here is a sample project. Best regards, Madhan.


PI Pierre-Luc February 22, 2006 03:03 PM UTC

You are just awesome ! all that was needed is an If e.RowIndex > 1 And e.ColIndex > 1 Then [my code] e.cancel = true end if to prevent canceling the drawcell on the headers Thanks a lot, your example made me realize that best regards and thanks, Pierre-Luc

Loader.
Up arrow icon