Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Custom cell drawing (Read 8184 times)
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Custom cell drawing
Reply #15 - Sep 3rd, 2009 at 11:00am
Print Post  
Hi Stoyan,

It doesn't want. I've created a new font copying from the TableNode's font, and changing just the Unit to GraphicsUnit.Pixel but same result.

But I draw the text in millimeters not in pixels, all the sizes I've wrote in the previous post are millimeters (bounds, font size).

Code
Select All
 void Diagram_DrawCell(object sender, DrawCellEventArgs e)
        {
            MFDrawing.IGraphics g = e.Graphics;

            if (e.Cell.Tag is Property)
            {
               //this.DrawStyledText(g, e.Cell.Text, e.Cell.Font ?? e.Table.Font, e.Bounds, e.Cell.TextFormat);

                g.DrawString(e.Cell.Text,
                    e.Cell.Font ?? e.Table.Font, new SolidBrush(this.TextColor), e.Bounds, e.Cell.TextFormat);
            }
}
 



Thanks,
Bogdan
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Custom cell drawing
Reply #16 - Sep 4th, 2009 at 8:26am
Print Post  
Hi Stoyan,

Any hints on how  or why this text drawing clipping occurs? Is it a bug?

Thanks,
Bogdan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom cell drawing
Reply #17 - Sep 4th, 2009 at 9:10am
Print Post  
Hi Bogdan,

Try DrawStyledText from this version:
https://mindfusion.eu/_beta/fcnet532.zip

It seems in that case the Graphics.MeasureCharacterRanges method returned a smaller rectangle than actually required by DrawString(rect), so we have changed DrawStyledText() to use DrawString(point), which does not clip the text.

Stoyan
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Custom cell drawing
Reply #18 - Sep 5th, 2009 at 12:59am
Print Post  
Hi Stoyan,

Thanks, now DrawStyledText draw correctly the text (not anymore clipped).

Still, there is a drawback if I use DrawStyledText instead of g.DrawString methos Sad. And this is related to trimming. No matter what I set for stringFormat.Trimming, the text is no more painted if the cell width is decreased, and the text does not anymore fit in it.

So, if the user shrinks enough the table width, the cell text disappears. The StringFormat.Trimming setting seems not to be taken into account by DrawStyledText method.

Can this one be fixed too, in order to make it possible the DrawStyledText method usage?


Thanks,
Bogdan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom cell drawing
Reply #19 - Sep 5th, 2009 at 12:57pm
Print Post  
Hi Bogdan,

I think our text formatting algorithm supports the StringTrimming.Character and Word options, but indeed Character doesn't seem to work when using the DrawStyledText method. Our developer will check this next week.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint