I am new to GDI+.I am drawing a string on the Win form
using GDI+. My string content is long and it does not
have any "vbcrlf". The whole string is displayed in a
single line and is getting truncated. Can anyone tell me
how to take the win form bounds and display the long
content on multiple lines.
The same is happening when i am printing the same string.
how do i take the page settings and print the page
Thanks in advance 5 2641
I got it to display in multiple lines in Win form using
the g.drawstring(st ring,f,b,Rectan gleF)
But I need to print the same content on multiple lines.
Can anyone guide me on this -----Original Message----- I am new to GDI+.I am drawing a string on the Win form using GDI+. My string content is long and it does not have any "vbcrlf". The whole string is displayed in a single line and is getting truncated. Can anyone tell me how to take the win form bounds and display the long content on multiple lines. The same is happening when i am printing the same
string.how do i take the page settings and print the page
Thanks in advance .
* <an*******@disc ussions.microso ft.com> scripsit: I got it to display in multiple lines in Win form using the g.drawstring(st ring,f,b,Rectan gleF) But I need to print the same content on multiple lines.
You can use the 'Graphics' object's 'MeasureString' method to get the
size the string will take on the printer. Then you can adjust the
position where the next line is printed accordingly.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Is there no way, where I can set the page settings of the
page to print and then print the string accordingly on
multiple lines. -----Original Message----- * <an*******@disc ussions.microso ft.com> scripsit: I got it to display in multiple lines in Win form
using the g.drawstring(st ring,f,b,Rectan gleF) But I need to print the same content on multiple lines. You can use the 'Graphics' object's 'MeasureString'
method to get thesize the string will take on the printer. Then you can
adjust theposition where the next line is printed accordingly.
-- Herfried K. Wagner [MVP] <URL:http://dotnet.mvps.org/> .
Hi,
Try this.
Dim g As Graphics = e.Graphics
Dim h As Integer
Dim strOut As String
strOut = "This is a really really really long string to print out on the
page."
h = CInt(g.MeasureS tring(strOut, Me.Font, 250).Height)
Dim rdraw As New RectangleF(10, 10, 250, h)
g.DrawString(st rOut, Me.Font, Brushes.Black, rdraw)
Ken
-------------------------------
<an*******@disc ussions.microso ft.com> wrote in message
news:28******** *************** ******@phx.gbl. .. Is there no way, where I can set the page settings of the page to print and then print the string accordingly on multiple lines.
-----Original Message----- * <an*******@disc ussions.microso ft.com> scripsit: I got it to display in multiple lines in Win form using the g.drawstring(st ring,f,b,Rectan gleF) But I need to print the same content on multiple lines.
You can use the 'Graphics' object's 'MeasureString' method to get thesize the string will take on the printer. Then you can adjust theposition where the next line is printed accordingly.
-- Herfried K. Wagner [MVP] <URL:http://dotnet.mvps.org/> . -----Original Message----- Hi,
Try this. Dim g As Graphics = e.Graphics
Dim h As Integer
Dim strOut As String
strOut = "This is a really really really long string to
print out on thepage."
h = CInt(g.MeasureS tring(strOut, Me.Font, 250).Height)
Dim rdraw As New RectangleF(10, 10, 250, h)
g.DrawString(s trOut, Me.Font, Brushes.Black, rdraw) Ken
-------------------------------
<an*******@dis cussions.micros oft.com> wrote in message news:28******* *************** *******@phx.gbl ... Is there no way, where I can set the page settings of
the page to print and then print the string accordingly on multiple lines.
-----Original Message----- * <an*******@disc ussions.microso ft.com> scripsit: I got it to display in multiple lines in Win form using the g.drawstring(st ring,f,b,Rectan gleF) But I need to print the same content on multiple
lines. You can use the 'Graphics' object's 'MeasureString' method to get thesize the string will take on the printer. Then you can adjust theposition where the next line is printed accordingly.
-- Herfried K. Wagner [MVP] <URL:http://dotnet.mvps.org/> .
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: timtos |
last post by:
I am working on a custom treeView and have some problems with
a) node.Bounds.Width
b) concatenate strings drawn with DrawString(...)
a)
I want to highlight a selected node and used the node.Bounds dimensions
to draw a rectangle around the node but the node.Bounds.Width property
seems to be wrong. Sometimes the rectangle is too large and sometimes
it is too small; something like this
|
by: David Lindgren |
last post by:
Hello!
I am using the DrawString method with different StringAlignments passed to
it and the result varies alot!
Take a look at this screenshot:
http://www.lowrad.net/files/alignment_screenshot.jpg
As you can see I am printing four different text in each of the the parts of
this image. ( The three parts are three images)
|
by: Drew |
last post by:
I posted this to framework.drawing, but did not get any responses...
Maybe here??
I am drawing some text using DrawString() and using a bounding
rectangle so that when the string is too long it wraps automatically.
I want to decrease the amount of space between the lines. How would I
go about changing the LineSpacing? The FontFamily has a read only
property.
Any ideas?
|
by: John |
last post by:
I'm trying to use the DrawText() method to draw some very long string
text on the Panel with AutoScroll enabled. However, for some unknown
reasons, I could not trigger the ScrollBar to show up.
Here is the simplicied section of drawing code:
private void panel_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
panel.AutoScroll = true;
|
by: Sam Sungshik Kong |
last post by:
Hello!
I'm testing Graphics.DrawString and it's very strange.
I created an event handler for the form.s Paint event.
(There's no other code in the form.)
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
| |
by: Jonah Olsson |
last post by:
Hi guys!
I'm trying to use Swedish characters with DrawString but no luck. Do I need
to set the Charset somewhere?? I've been searching Google Groups for hours
now, but I can't find any help or tutorial. Below is my code.
Thanks for any kind of help!
Regards,
Jonah Olsson
|
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 second time I onvoke print or preview, the DrawLine or DrawImage go well,
but the first DrawString the program tries to execute pops an exception:
************** Exception Text **************
System.ArgumentException: Invalid parameter used.
|
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 image but I have had varying
results on multiple images.
Is there anyway to make the text a fixed size on the image. Similar to
putting a date on a photograph.
|
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 string into multiple
lines.
Is there a way to find out into how many lines the string was split?
I am asking because this string is being displayed inside an owner
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |