Picture in ColumnHeader

Posted by: silkkeng-fp on 8 September 2017, 1:17 pm EST

  • Posted 8 September 2017, 1:17 pm EST

    Hi,
    We need to have a picturebox over the columnheader, next to sort icon.

    Can you please shed some light if it is possible to have the spreadchildcontrols over the ColumnHeader?




    Regards,
    David
  • Replied 8 September 2017, 1:17 pm EST

    David -

    There are numerous examples on the forums showing how to add controls to custom celltypes(Do a search on 'PaintCell' or 'Custom CellType').  You would have to paint the sort indicator in the PaintCell method but this is going to get complicated.  I believe we have an example on the forums that shows how to do this.  If I have time and can find it I will let you know. 

  • Replied 8 September 2017, 1:17 pm EST

    David -

    As I said the drawing space for child controls does not incorporate the headers.  You would have to inherit your class from the GeneralCellType and paint your picturebox in the PaintCell override and assign the celltype to the cell(s) in the header. 

  • Replied 8 September 2017, 1:17 pm EST

    Hi,

    I found quite a few post in this forums related to paint image.

    I didnt find any related to painting a picture box.

    I have a class which inherits picture box, and have tooltip set on this picture box. So, I can't simply paint an image. I need to be able to show tooltip if mouse over the picture box.

    I have done this using spreadchildcontrol by creating new class which implements  DrawingSpace.IEmbeddedControlSupport for normal active cell. But this does not work for columnheader.

    Is the EnhancedColumnHeaderRenderer that I should be look at? OR, can you please provides more explanation/example to achieve this?

     

     

     

    Regards,
    David

  • Replied 8 September 2017, 1:17 pm EST

    David -

    The drawing space that contains the child controls only covers the data area of the spread.  I believe there is an example on the forums that shows how to create a custom cell type and paint the sort indicator and another control in the header.  You could do the same thing with a picture.
  • Replied 8 September 2017, 1:17 pm EST

    Hi Bob,

    Can you clarify more on the steps behind the paintcell on how to draw the picturebox? not image, as I need the tooltips. when mouseover the picturebox.
    I tried the paintcell, and firstly i lose the sort indicator icon.

    I was able to paint the image using g.drawimage. I can't find the way to draw the picturebox, either using controlpaint method or etc.
     

    Thank you.

     

    David
     

  • Replied 8 September 2017, 1:17 pm EST

    Yes, you can display tooltips in the headers.  Just set the TextTipPolicy and use the TextTipFetch event...

    Private Sub FpSpread1_TextTipFetch(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.TextTipFetchEventArgs) Handles FpSpread1.TextTipFetch
    If e.ColumnHeader = True Then
    If e.Column = 2 Then
    e.ShowTip = True
    e.TipText = "Test"
    End If
    End If
    End Sub

  • Replied 8 September 2017, 1:17 pm EST

    Hi Bob,

    Please see attached my project.

    I tried to follow the post above, and I am able to replicate it under data cell, but not columnheader.

    Can you please shed some light what have i done wrong?

    In the celltype, it requires double click to activate the cells. But since columnheader is readonly, is there away to activate this? 

    THanks 


    2008/06/SpreadTest2003.2005.zip
  • Replied 8 September 2017, 1:17 pm EST

    Hi Bob,

    Thanks for your reply. I am still searching/looking through the post over the forums. Let me know if you found any.

    Forgot to mention, this is Winform not Webform

    Thank you. 

     [edited by: silkkeng at 2:54 AM (GMT -5) on Mon, Jun 16 2008]
    I have looked through the search. Even though there are lots of post for Custom CellTypes, but I can't find any that are similar to what I am trying to achieve here(painting picturebox control over the ColumnHeader with tooltip enabled on the picturebox).

  • Replied 8 September 2017, 1:17 pm EST

    David -

    I do not recall an example that uses a picturebox.  But any example that paints another control in the PaintCell override should point you in the right direction. 

  • Replied 8 September 2017, 1:17 pm EST

    Hi Bob,

    Can you show me an example of painting control over the PaintCell in the ColumnHeader? Even a button or combobox, I would be able to assign the tooltip to this control.

          

    Thanks

     

  • Replied 8 September 2017, 1:17 pm EST

    Hi Bob,

    So the conclusion is there is no way to have the picturebox that have tooltip over the column header?

    But, it is possible to have tooltip just set over the columnheader? Which means user mousemove over columnheader to display the tooltips?

    Thanks again. 

  • Replied 8 September 2017, 1:17 pm EST

    There is not a way to do this in the column header since it is not editable.
  • Replied 8 September 2017, 1:17 pm EST

    Here's an example of painting a spread in a custom celltype...

    http://www.clubfarpoint.com/Forums/forums/thread/15391.aspx 

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels