Text Justification

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Rigor69
Posts: 18
Joined: 05 Oct 2009, 18:31

Re: Text Justification

Post by Rigor69 » 30 Nov 2009, 18:27

Well, no, because I would like to let the Draw method to stay ignorant of exactly which Graphics object that it was drawing itself to. In this way, I can use the same Draw method for both screen representation and "DXFPrint". This was possible in the older versions.

Best Regards,

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Text Justification

Post by support » 04 Dec 2009, 18:34

Hello.
You transfer Grahics object to your Draw method as a parameter. As I see it, nothing oppose to transfer one Graphics object or another not as the reference.
What's the difference?

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Rigor69
Posts: 18
Joined: 05 Oct 2009, 18:31

Re: Text Justification

Post by Rigor69 » 04 Dec 2009, 20:13

OK, maybe I am not the expert, but I fail see how.
The Draw function must have a defined signature.
See my pseudocode below(this was possible in your prior versions):
PrintToDXF()
{
yourClassNameThatIDoNotRememberTheNameOf mf1;
Draw(ref mf1.Graphics);
}
PrintToScreen()
{
Graphics g = e.Graphics;
Draw(ref g);
}
Draw(ref Graphics gr)
{
gr.DrawString("abc");
}

Anyhow, I am now doubling my draw() functions, one for DXF and one for Screen. I hate to double the code, but I cannot find away around it.

Best regads,

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Text Justification

Post by support » 09 Dec 2009, 18:20

Did you try to modify your pseudocode like following?

Code: Select all

PrintToDXF()
{
  MetaForm mf1;
  Draw(mf1.Graphics);
}

PrintToScreen()
{
Draw(e.Graphics);
}

Draw(Graphics gr)
{
gr.DrawString("abc");
}
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Rigor69
Posts: 18
Joined: 05 Oct 2009, 18:31

Re: Text Justification

Post by Rigor69 » 14 Jan 2010, 21:37

Thanks, It worked!

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Text Justification

Post by support » 15 Jan 2010, 12:23

Please post your questions if any with detailed description to the forum or send to support@cadsofttools.com.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply