Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Background text & border with fixed sized (Read 1550 times)
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Background text & border with fixed sized
Jun 26th, 2009 at 3:16pm
Print Post  
Hi,

I need to display a border with fixed pen width & text with a fixed size. I was wondering how you did it with the text you display beta text in the top-left corner? Is there a built-in function I could use?

So far, I have:
Code
Select All
const float BACKGROUND_STRING_DISTANCE = 15.0f;
void Diagram_DrawBackground(object sender, DiagramEventArgs e)
{
    e.Graphics.DrawString("Hello world!!!!", this._Diagram.Font, new SolidBrush(Color.IndianRed), e.VisibleRect.X + BACKGROUND_STRING_DISTANCE, e.VisibleRect.Y + BACKGROUND_STRING_DISTANCE);
    e.Graphics.DrawRectangle(new Pen(Color.Chartreuse), e.VisibleRect.X, e.VisibleRect.Y, e.VisibleRect.Width, e.VisibleRect.Height);
} 



However, the text and border get bigger/smaller as I zoom in/out.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Background text & border with fixed sized
Reply #1 - Jun 26th, 2009 at 3:42pm
Print Post  
Hi Marie,

Try doing that from a DiagramView.Paint handler, then it won't depend on the zoom level and scroll position.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Background text & border with fixed sized
Reply #2 - Jun 26th, 2009 at 3:49pm
Print Post  
Perfect Grin
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint