Author Topic: Text in IMImage-class  (Read 1544 times)

sinus

  • Global Moderator
  • *****
  • Posts: 4230
  • IMatch-User since 2001 (IMatch 3.6)
Text in IMImage-class
« on: August 30, 2016, 08:42:51 AM »
Hi all
I am trying to change a bit a script from Mario (create Proxies) with the IMImage-class.

I create an image

Code: [Select]
' Create the bitmap
m_Image.Create(400,400,0)

and add then some text to the bitmap, like

Code: [Select]
m_Image.RenderText(anzahltops,,,48,imaLeft,imaTop)
m_Image.RenderText(anzahlstackmembers,,,48,imaRight,imaTop)

The changed script ends then successfully with an image like attachement 1.

You can see, also in attachement 2, we have some possibilities to place text in the bitmap.
Left, Center, Right
Top, Middle, Bottom

This is quite much, but it would be great, if I could place the text more exactly. As you can see in my attachement 1, I have now text like

Top
Middle
Bottom

But I would like to have:
Top
second line
third line
Middle
a line
a line
Bottom

Question 1:
Is it somehow possible to add a second line? I tried some <br> or  <LineBreak/> but nothing worked to create a second line.

Question 2:
I tried to add some space at the end and start of a word. But I was not able to do it.
Say, in my attachement, I want a space before "Stacks", so that the word has a space from the left border.
How could I achieve this?
I tried something with " "  or this method from Microsoft
Code: [Select]
Dim TestString As String
' Returns a string with 10 spaces.
TestString = Space(10)
' Inserts 10 spaces between two strings.
TestString = "Hello" & Space(10) & "World"

but could not get a simple space before or after a word (before "Stacks: 23" and after "1731 stacked".

My question 1 is much more important to me than question 2.  ;D

It would be cool, if somehow has a solution or an idea, how to achieve this.
(One method at least works, with overlaying a second, smaller bitmap, but this is VERY confusing and difficult to arrange the text).

Thanks for any ideas!
Best wishes from Switzerland! :-)
Markus

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27248
Re: Text in IMImage-class
« Reply #1 on: August 30, 2016, 08:55:49 AM »
Try using RenderMarkup instead of RenderText.

sinus

  • Global Moderator
  • *****
  • Posts: 4230
  • IMatch-User since 2001 (IMatch 3.6)
Re: Text in IMImage-class
« Reply #2 on: August 30, 2016, 09:15:55 AM »
Try using RenderMarkup instead of RenderText.

Ahhhhh, of course!
And the fastest service in the world!


Thanks, vielen Dank!

I will try that, stupid me!  :-[
Best wishes from Switzerland! :-)
Markus

sinus

  • Global Moderator
  • *****
  • Posts: 4230
  • IMatch-User since 2001 (IMatch 3.6)
Re: Text in IMImage-class
« Reply #3 on: August 30, 2016, 09:25:35 AM »
And you have even an example, what fits exactly what I must know, in the help-file!

Sorry  :-[ :-\ and again: GREAT Help-file!

(I thought, hm, where could I add XAML-instructions ... read again the help-file, and bang, at the end of the page (Render XAML Markup) it is all there with a example!

Code: [Select]
    image.RenderMarkup "  <TextBlock VerticalAlignment='Bottom' HorizontalAlignment='Center' Margin='0,0,0,25' FontFamily='Times New Roman' FontSize='32pt' Foreground='#ffffff'>Your Copyright here</TextBlock>",0,0,image.Width,image.Height
Really cool, Mario.
Best wishes from Switzerland! :-)
Markus

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27248
Re: Text in IMImage-class
« Reply #4 on: August 30, 2016, 09:28:47 AM »
Have fun.
Tip: You can quickly try out your markup e.g. in the Design & Print module and then copy&paste it.