Hello All,
I've created a WinForm control and everything is OK except the look
of the font on my control.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
SizeF objTextSize = e.Graphics.MeasureString(this.Text,
this.Font);
PointF objTextPosition = new PointF(0, (this.Height -
objTextSize.Height) / 2);
e.Graphics.DrawString(this.Text, this.Font, Brushes.Black,
objTextPosition);
}
}
If I compare my Control to a Label, the text in the Label looks a lot
more sharp, beautiful, clean and clear... Why? For the same font and
size, I should have the same look. No?
What is wrong with my DrawString? Why my control text and font
doesn't have the same look and feel as a Label text and font?
Thanks for you help!
Martin 2 2962
Hi Martin,
Did you test different settings of:
Graphics.TextContrast
or
Graphics.TextRenderingHint
with regards
Marcin
Martin napisał(a):
Hello All,
I've created a WinForm control and everything is OK except the look
of the font on my control.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
SizeF objTextSize = e.Graphics.MeasureString(this.Text,
this.Font);
PointF objTextPosition = new PointF(0, (this.Height -
objTextSize.Height) / 2);
e.Graphics.DrawString(this.Text, this.Font, Brushes.Black,
objTextPosition);
}
}
If I compare my Control to a Label, the text in the Label looks a lot
more sharp, beautiful, clean and clear... Why? For the same font and
size, I should have the same look. No?
What is wrong with my DrawString? Why my control text and font
doesn't have the same look and feel as a Label text and font?
Thanks for you help!
Martin
I'll give this a try !
Thanks !
Marcin Grzebski wrote:
Hi Martin,
Did you test different settings of:
Graphics.TextContrast
or
Graphics.TextRenderingHint
with regards
Marcin
Martin napisał(a):
Hello All,
I've created a WinForm control and everything is OK except the look
of the font on my control.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
SizeF objTextSize = e.Graphics.MeasureString(this.Text,
this.Font);
PointF objTextPosition = new PointF(0, (this.Height -
objTextSize.Height) / 2);
e.Graphics.DrawString(this.Text, this.Font, Brushes.Black,
objTextPosition);
}
}
If I compare my Control to a Label, the text in the Label looks a lot
more sharp, beautiful, clean and clear... Why? For the same font and
size, I should have the same look. No?
What is wrong with my DrawString? Why my control text and font
doesn't have the same look and feel as a Label text and font?
Thanks for you help!
Martin
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: DrDevious |
last post by:
Maybe I am doing something wrong but has anyone else here noticed a
difference in the positioning of text between the Graphics.DrawString
method and the Win32 GDI DrawText function?
My text is...
|
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:...
|
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...
|
by: jack |
last post by:
In using GDI+ drawstring, if the string to be drawn is in
rtf format, how do I make GDI+ to recognize the rtf
attributes.
In other words, how do I draw one string in GDI+ , within
which the...
|
by: Bauer |
last post by:
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...
| |
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: Allen |
last post by:
I've got a control that you can resize the contents of one of the text
fields inside it. When the contents are resized to smaller than the
text, I remove some of the end of the text and...
|
by: Gidi |
last post by:
Hi,
Is it possible to draw string with few font styls, like in WORD (i.e. Bold
and Underline) at the same line, on the same text ?
and is it possible that part of the line will be bold and the...
|
by: Brian Ward |
last post by:
I am trying to get to grips with some basic graphics, being new to C#.
I have this code (see below) in a simple project .. when I run it 6 text
strings are drawn, as I expected .. but this happens...
|
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,...
|
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,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
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 ...
| |