Hi All,
I'm trying tp print to texts in the same position with
different font sizes on a graphics object (say a printer
or a picturebox) and I'm using the format string object
to remove spaces around a character but it doesn't work.
Private Sub PictureBox1_Paint(ByVal sender As
Object, ByVal e As System.Windows.Forms.PaintEventArgs)
Handles PictureBox1.Paint
'
Dim format As New StringFormat(CType
(StringFormat.GenericTypographic.Clone, StringFormat))
With e.Graphics
.PageUnit =
GraphicsUnit.Millimeter
.TextRenderingHint =
TextRenderingHint.AntiAlias
.DrawLine(New Pen(Color.Blue),
10, 0, 10, 200)
.DrawString("P", New Font
("Arial", 10, GraphicsUnit.Millimeter), Brushes.Green,
New RectangleF(10, 10, 100, 100), format)
.DrawString("P", New Font
("Arial", 48, GraphicsUnit.Millimeter), Brushes.Green,
New RectangleF(10, 10, 150, 165), format)
End With
'
End Sub
Does anyone have any idea how to work out this problem.
Any help appreciated.
Regards,
Saeid 4 2195
"Saeid" <Sa****@drs.co.uk> schrieb I'm trying tp print to texts in the same position with different font sizes on a graphics object (say a printer or a picturebox) and I'm using the format string object to remove spaces around a character but it doesn't work.
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint ' Dim format As New StringFormat(CType (StringFormat.GenericTypographic.Clone, StringFormat))
With e.Graphics .PageUnit = GraphicsUnit.Millimeter .TextRenderingHint = TextRenderingHint.AntiAlias .DrawLine(New Pen(Color.Blue), 10, 0, 10, 200) .DrawString("P", New Font ("Arial", 10, GraphicsUnit.Millimeter), Brushes.Green, New RectangleF(10, 10, 100, 100), format) .DrawString("P", New Font ("Arial", 48, GraphicsUnit.Millimeter), Brushes.Green, New RectangleF(10, 10, 150, 165), format) End With ' End Sub
Does anyone have any idea how to work out this problem. Any help appreciated.
I tried your code. Where do you expect the space to be removed? Do you mean
the space between the left side of the "P" and the vertical bar?
--
Armin
Yes Exactly, They should be all in the same Y position
but they're not. Thanks -----Original Message----- "Saeid" <Sa****@drs.co.uk> schrieb I'm trying tp print to texts in the same position with different font sizes on a graphics object (say a
printer or a picturebox) and I'm using the format string object to remove spaces around a character but it doesn't
work. Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint ' Dim format As New StringFormat(CType (StringFormat.GenericTypographic.Clone, StringFormat))
With e.Graphics .PageUnit = GraphicsUnit.Millimeter .TextRenderingHint = TextRenderingHint.AntiAlias .DrawLine(New Pen(Color.Blue), 10, 0, 10, 200) .DrawString("P", New Font ("Arial", 10, GraphicsUnit.Millimeter), Brushes.Green, New RectangleF(10, 10, 100, 100), format) .DrawString("P", New Font ("Arial", 48, GraphicsUnit.Millimeter), Brushes.Green, New RectangleF(10, 10, 150, 165), format) End With ' End Sub
Does anyone have any idea how to work out this problem. Any help appreciated. I tried your code. Where do you expect the space to be
removed? Do you meanthe space between the left side of the "P" and the
vertical bar?
-- Armin
.
<an*******@discussions.microsoft.com> schrieb Yes Exactly, They should be all in the same Y position but they're not. Thanks
I think the letters start at the same Y position. At the bigger char, also
the space between the (green) letter itself and the top of the char is
bigger.
As this is not a VB.NET specific question, please turn to
microsoft.public.dotnet.framework.drawing, or, probably better,
microsoft.public.win32.programmer.gdi
--
Armin http://learn.to/quote http://www.plig.net/nnq/nquote.html
Thanks Armin, I'll do that.
Regards,
Saeid -----Original Message----- <an*******@discussions.microsoft.com> schrieb Yes Exactly, They should be all in the same Y position but they're not. Thanks
I think the letters start at the same Y position. At the
bigger char, alsothe space between the (green) letter itself and the top
of the char isbigger.
As this is not a VB.NET specific question, please turn to microsoft.public.dotnet.framework.drawing, or, probably
better,microsoft.public.win32.programmer.gdi
-- Armin
http://learn.to/quote http://www.plig.net/nnq/nquote.html
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marc Ouellette |
last post by:
Hi All.
In the code below it will output the text string that is using the text from
txtTextToDraw.Text using the font properties of the lblFont. Then problem
is that not matter the font size...
|
by: Rich |
last post by:
Hello,
I need to draw some text on a form. No problem
....
e.Graphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat)
My problem is that I want to draw the text on top of some...
|
by: Joao |
last post by:
Hi, I'm trully excited to use VB.NET's PrintDocument to make my printouts. On
them I draw strings, images and lines.
All perfect, if I invoke the Print or the PrintPreview one time per run.
At...
|
by: =?Utf-8?B?SlIx?= |
last post by:
I would like to add text to an image. I have tried to use DrawString and it
works on some images but on others it is very very small. I am pretty sure
it has something to do with the size of the...
|
by: nothix9 |
last post by:
Hello guys, Ive been working this for 2 days, I am required to position a string using drawstring but the problem is its dynamic and changes depending on the database or source. A quick fix I thought...
|
by: ChrisNightingale |
last post by:
Hi everybody,
I have an odd issue which I'm not sure how to resolve. I'm basically implementing a print mechanism which takes a series of controls and reproduces them on a print document.
So...
|
by: dzenanz |
last post by:
Platform: VS2005/WinXP/.NET 2.0
I am trying to make one sentence of text scroll from right to left over the form (that works well enough, although not perfect).
Problem is, when I try to add...
|
by: vekipeki |
last post by:
I am having a problem with basic drawing of unicode characters in Windows 2000 and XP.
I have written a simplest possible C# WinForms program to test it (just create a new Windows Forms C#...
|
by: Dilip |
last post by:
Howdy Folks
I have a display where the Graphics.DrawString function is called to
display something. Since the text seems to be larger than its
bounding rectangle, the call basically splits the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |