Text Justification
Moderators: SDS, support, admin
Text Justification
The StringFormat argument of stringformat does not seem to work.
Text justified to center on the screen appears justified Left on DXF.
Is there any way around this?
Best Regards,
Text justified to center on the screen appears justified Left on DXF.
Is there any way around this?
Best Regards,
Re: Text Justification
Hello.
Please specify the way you set justification of the texts.
Alexander.
Please specify the way you set justification of the texts.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Text Justification
OK, This is it:
String comes out left-aligned.
Best regards,
Code: Select all
String Name = "name";
StringFormat Nameformat = new StringFormat();
Nameformat.Alignment = StringAlignment.Center;
graphicsObj.DrawString(Name, font, Brushes.SandyBrown, Pos.X , Pos.Y,Nameformat);
Best regards,
Re: Text Justification
System.Drawing.StringAlignment specifies the alignment of a text sting relative its layout rectangle. Please pay attention to Far (as Near) value can set left or right position depends on layout direction. Try to change different alignments and you will see what text justification is ok.
Alexander.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Text Justification
Sorry, still i cant make it work.
If i use the syntax from above, the text appears justified to center on the form , but appears justified Left on the DXF.
If i use the Drawstring argument with Rectangle, the text within the rectangle appears Left justified withing the rectangle.
Do you support text justification?
Can you provide some code on how to justify text to center (or Right)?
Best Regards,
If i use the syntax from above, the text appears justified to center on the form , but appears justified Left on the DXF.
If i use the Drawstring argument with Rectangle, the text within the rectangle appears Left justified withing the rectangle.
Do you support text justification?
Can you provide some code on how to justify text to center (or Right)?
Best Regards,
Re: Text Justification
Hello.
We have built the new version of DXF Export .NET package. It can be downloaded via a link:
http://www.cadsofttools.com/download/be ... t_beta.zip
The text justification is modified. Please try to use this new version.
Alexander.
We have built the new version of DXF Export .NET package. It can be downloaded via a link:
http://www.cadsofttools.com/download/be ... t_beta.zip
The text justification is modified. Please try to use this new version.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Text Justification
Thanks for the new version. It looks promising, as the texts now show when dxf is opened with autocad.
However something has changed in this build so that I cannot any longer pass the Graphics object of the MetaForm to my Draw() function.
Gives me : Error 1 A property or indexer may not be passed as an out or ref parameter
In the last build this was possible.
I think it is vital to be able to pass the "Graphics" object because otherwise I have to build separate Draw-functions for showing the graphics on a form, and for printing to DXF. Lots of duplicated code in other words.
I cannot use your MetaForm.Graphics object in my main application for Visual presentation as is requires that it is disposed before showing the graphics. That is why i need to keep another Graphics object for my main Visual presentation.
Have i got it wrong? Is there another way of doing this so that I can use a the same Draw() for a Both my Graphics objects?
Best Regards,
However something has changed in this build so that I cannot any longer pass the Graphics object of the MetaForm to my Draw() function.
Code: Select all
MetaForm mf1 = new MetaForm();
Draw(ref mf1.Graphics);
In the last build this was possible.
I think it is vital to be able to pass the "Graphics" object because otherwise I have to build separate Draw-functions for showing the graphics on a form, and for printing to DXF. Lots of duplicated code in other words.
I cannot use your MetaForm.Graphics object in my main application for Visual presentation as is requires that it is disposed before showing the graphics. That is why i need to keep another Graphics object for my main Visual presentation.
Have i got it wrong? Is there another way of doing this so that I can use a the same Draw() for a Both my Graphics objects?
Best Regards,
Re: Text Justification
Dear Support.
I'd like to know if you are considering to change the code to comply with my last post, or if not. If you are not, I will have to look for another solution.
Best Regards
I'd like to know if you are considering to change the code to comply with my last post, or if not. If you are not, I will have to look for another solution.
Best Regards
Re: Text Justification
Hello.
We are not going to change the description of the properties MetaForm.Graphics in the future.
And we do not quite understand the purpose of the transfer parameter as a reference.
Anton.
We are not going to change the description of the properties MetaForm.Graphics in the future.
And we do not quite understand the purpose of the transfer parameter as a reference.
Anton.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Text Justification
OK, Than I will have to look elsewhere.
For the sake of clarity i would anyhow like to explain the reasoning behind my request.
You have a function in your lib that makes it possible to print a "Form" to DXF.
I think this is very useful! Consider if there is an existing application that does advanced graphical presentation on a windows form.
In a Object oriented approach you would probably let each "object"(called x) on the form draw itself. I'm sure you agree with that.
So, to let each object draw itself you would pass the "Graphics" as a reference to the object x, Let x draw on it, and pass it to the next object (y).
Now, this was the Form presentation. If I would for some reason want to add "Printing to DXF", It would be easy to pass another Graphics object insted (Your Graphics object), and let each object draw itself on it.
This way each object does not need to know if it is to be represented on the screen or on a DXF drawing, and no special code would need to be written for DXF Printing.
I found this very appealing in you last version, and started to build my application around it, but this possibility is gone in the last version.
I am not an expert programmer, so forgive(and please enlighten) me if I am overlooking a better solution here.
Best Regards,
For the sake of clarity i would anyhow like to explain the reasoning behind my request.
You have a function in your lib that makes it possible to print a "Form" to DXF.
I think this is very useful! Consider if there is an existing application that does advanced graphical presentation on a windows form.
In a Object oriented approach you would probably let each "object"(called x) on the form draw itself. I'm sure you agree with that.
So, to let each object draw itself you would pass the "Graphics" as a reference to the object x, Let x draw on it, and pass it to the next object (y).
Now, this was the Form presentation. If I would for some reason want to add "Printing to DXF", It would be easy to pass another Graphics object insted (Your Graphics object), and let each object draw itself on it.
This way each object does not need to know if it is to be represented on the screen or on a DXF drawing, and no special code would need to be written for DXF Printing.
I found this very appealing in you last version, and started to build my application around it, but this possibility is gone in the last version.
I am not an expert programmer, so forgive(and please enlighten) me if I am overlooking a better solution here.
Best Regards,
Re: Text Justification
Hello.
The only reason to transmit Graphics object as a reference to your object is changing your object within Draw method. In any other situation using of reference doesn't necessary. Is your Draw method includes such functional?
Alexander.
The only reason to transmit Graphics object as a reference to your object is changing your object within Draw method. In any other situation using of reference doesn't necessary. Is your Draw method includes such functional?
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Text Justification
Well Yes, My draw method draws directly to the "Graphics" object.
Best Regards,
Best Regards,
Re: Text Justification
Ok, but I asked if your Draw method changes objects x, y and so on. Only this situation requires transfer Graphics object as the reference.
Alexander.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Text Justification
Well, Each Object x, y, .. have their own Draw method. When the graphics object is passed to the Draw method, the object draws to the Graphics object.
I am not sure what you mean by "changes"
Best Regards,
I am not sure what you mean by "changes"
Best Regards,
Re: Text Justification
But in our demo we transfer Graphics object to our Draw method not as the reference. If every of your objects have its own Draw method, why can't you do the same?
Alexander.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support