?
Solved

ComponentOne FlexGrid: Merging headers with FixedOnly and details with Spill ?

Posted on 2006-04-12
10
Medium Priority
?
4,188 Views
Last Modified: 2008-01-09
 How is it possible?

I have a FlexGrid that has a header on 2 lines. Some cols of the first line needs to be merged togheter. This is done easily by setting .AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.FixedOnly

Now, I have added a hierarchy in my grid to display the rows grouped by a column. but this group desciption is very long. So I would like like to set .AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Spill

Any demos of that?
 
 
0
Comment
Question by:Éric Moreau
  • 6
  • 4
10 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16456298
Eric,

It has been a long time since I used the C1FlexGrid, so it might take a little to get up to speed.  

What version are you using now?

Bob
0
 
LVL 70

Author Comment

by:Éric Moreau
ID: 16456337
Hi Bob

I still use 2.1.20033.136
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16456583
Eric,

All I have is the Community Version from the VB.NET 2003 Resource Kit.  I don't know how much they changed the model for 2.0, but I'll see if I can remember how to do it with the version that I have.

Bob
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Author Comment

by:Éric Moreau
ID: 16456600
The version I have is the latest upgrade to the Community Version from the VB.NET 2003 Resource Kit available for free (2003-3 if I am not mistaken). So your version should be almost the same as mine.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16456831
It is slowly coming back ;)

If memory serves me correctly, you can only specify AllowMergingEnum.Free or AllowMergingEnum.Spill but not both.  So you could merge the column headers, but not also spill text over to the next empty cell.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16456861
If I am right, we could probably find a way to fake it.

Bob
0
 
LVL 70

Author Comment

by:Éric Moreau
ID: 16456889
>>you can only specify AllowMergingEnum.Free or AllowMergingEnum.Spill but not both

That's what I found.

>>If I am right, we could probably find a way to fake it.

That's exactly what I'm looking for!
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 16457071
Eric,

I gotta get going for the weekend, but this is what I have so far, that sorta, kinda works:

1) I set up the columns so that the 5th column spills into the 6th column.
2) Set DrawMode = OwnerDraw
3) Set AllowMerging = FixedOnly
4) Add this event sink:

  Private Sub fg_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) Handles fg.OwnerDrawCell

    If e.Col = 4 AndAlso e.Graphics.MeasureString(e.Text, Me.fg.Font).Width > e.Bounds.Width Then
      Dim pen As New Pen(e.Style.Border.Color, 1)
      Dim x1 As Integer = e.Bounds.Left
      Dim x2 As Integer = e.Bounds.Right - 1
      Dim y1 As Integer = e.Bounds.Top
      Dim y2 As Integer = e.Bounds.Bottom - 1
      e.Graphics.DrawLine(pen, x1, y2, x2, y2)
      e.Handled = True
    End If

  End Sub

5) When the text is too long for the cell in Column(4), then the text won't be drawn (e.Handled = True).  What I was thinking is that you use Graphics.DrawString with a layout rectangle for the entire region of both cells for the merge range.  

6) I hope that makes sense.  I'll pick it up later.

Bob
0
 
LVL 70

Author Comment

by:Éric Moreau
ID: 16468617
I have used your idea of setting the DrawMode to OwnerDraw but I kept AllowMerging to Nodes. Then in the OwnerDrawCell event, using DrawString, I span myself the title over many columns.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16477274
Eric,

Any idea that gets what you want is always acceptable.  Glad I could be of a little help.

Bob
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question