|
True, that's what they say.
I suggest you try it out and see if there's Glyph manipulation.
Set the TextRenderingHint property of your Graphics object:
g.TextRenderingHint = TextRenderingHint.AntiAlias;
See how it's displayed.
Then remove it and compare the two.
Even though it's already visibly apparent, I would like to urge you to print the two results and compare them.
In my humble opinion, the AntiAlias touches the Glyph.
But I could be mistaken.
If I am mistaken and somehow I seem to have missed what the default does as opposed to what AntiAlias does, then please inform me.
Don't forget to add an informative link, not just for myself, but for others coming across this problem.
Thanks in advance.
Edit:
I indeed stand corrected.
Here's a link explaining how it works:
http://msdn.microsoft.com/en-us/library/ms534404%28VS.85%29.aspx
By setting the TextRenderingHint to AntiAlias, you kill the default corrective Glyph hinting the Graphics object does by itself.
Quote:
"TextRenderingHintSystemDefault
Specifies that a character is drawn using the currently selected system font smoothing mode (also called a rendering hint)."
Quote:
"TextRenderingHintAntiAlias
Specifies that a character is drawn using its antialiased glyph bitmap and no hinting. Stem width differences may be noticeable because hinting is turned off."
Thank you Covean for this insight
modified on Thursday, October 22, 2009 9:07 AM
|
|
|
|
|
I can see the difference. And yes I also think it touches the Glyph, but there so no hinting.
The Problem with the "no hinting" is "Stem width differences may be noticeable because hinting is turned off."
Edit:
Oh I read your edit too late.
|
|
|
|
|
Not a problem, your thoughts in this have been insightful. 
|
|
|
|
|
The plot thickens...
I was somewhat bored and still not satisfied with how the Graphics.DrawString() was working for me.
So I went on a Google hunt for some answers.
After looking around I came to a forum where a user had somewhat similar problems.
There he had linked a convo he had with a Microsoft MVP.
For more information please check this link:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/362ab21b-1dc4-4140-a39a-a366beea9e40[^]
Quote:
"They couldn't fix the bugz in Graphics.DrawString() because way too much .NET 1.x code depended on its quirks. That's what Application.SetCompatibleTextRenderingDefault() is all about too. If you really want to use GDI+, you'll have to find the workarounds for the bugs yourself. Right now, using Graphics.DrawString() in a Paint event is a bug."
Quote:
"Graphics.DrawString() is too broken to be usable. It got replaced by TextRenderer.DrawText()."
To simplify things:
If you care for precision work, in particular with text rendering, then use the old GDI.
GDI+ is bugged and unusable for precision work.
If you don't care for precision work and you don't use text rendering (or very little of it or the quality isn't important), then use the new GDI+.
|
|
|
|
|
I faced the same problem, thanks
modified 1-Aug-19 21:02pm.
|
|
|
|
|
hi
How to pass any text value from form to Crystal Report ?
ex: i need to pass "hellow" from Form1 to my Crystal Report , how to do it ?
(working in C#)
thank's in advance
|
|
|
|
|
You create paramaters in crystal report. via that parameters u can pass
___________
rptCount = New ReportDocument
rptCount.Load(Server.MapPath("reportname.rpt"))
''Get the collection of parameters from the report
crParameterFieldDefinitions = rptCount.DataDefinition.ParameterFields
''Access the specified parameter from the collection
crParameter1 = crParameterFieldDefinitions.Item("Param1")
crParameter2 = crParameterFieldDefinitions.Item(“Param2")
''Get the current values from the parameter field. At this point
''there are zero values set.
crParameter1Values = crParameter1.CurrentValues
crParameter2Values = crParameter2.CurrentValues
''Set the current values for the parameter field
crDiscrete1Value = New ParameterDiscreteValue
crDiscrete1Value.Value = Request.Form(“param1value“)
crDiscrete2Value = New ParameterDiscreteValue
crDiscrete2Value.Value = Request.Form(“param2value“)
''Add the first current value for the parameter field
crParameter1Values.Add(crDiscrete1Value)
crParameter2Values.Add(crDiscrete2Value)
''All current parameter values must be applied for the parameter field.
crParameter1.ApplyCurrentValues(crParameter1Values)
crParameter2.ApplyCurrentValues(crParameter2Values)
|
|
|
|
|
Hello,
I have this structure :
Firstname; adresse; lastName
Aubenque; 20 wallstreet; Julien
Aubenque; 23 wallstreet; Julien
Bachelot; 22 londres street ; Maud
Aubenque; 25 wallstreet; Julien
Bachelot; 24 londres street ; Maud
Bachelot; 28 londres street ; Maud
Aubenque; 20 wallstreet; Julien
Bachelot; 22 londres street ; Maud
I would get the lines where the firstname and lastname was the same, help met to resolve this great problem, thank you verry mutch.
|
|
|
|
|
I didn't understand your problem. Can you explain it?
|
|
|
|
|
I am sorry, ok
I would get all line where the lastname and lastname was the same, i will get two elements for exemple in arraylist :
the first :
Aubenque; 20 wallstreet; Julien
Aubenque; 23 wallstreet; Julien
Aubenque; 25 wallstreet; Julien
Aubenque; 20 wallstreet; Julien
the second :
Bachelot; 22 londres street ;Maud
Bachelot; 24 londres street ; Maud
Bachelot; 28 londres street ; Maud
Bachelot; 22 londres street ; Maud
Thank you verry mutch
|
|
|
|
|
abbd wrote: I would get all line where the lastname and lastname was the same, i will get two elements for exemple in arraylist :
I am really sorry but i still didn't got your question.
What actually you need? 
|
|
|
|
|
|
I need a book which describes about programming Microsoft windows.
I am using C#. I am reasonably sound in C (MCU work).
I can understand easily the syntax and structures in C#. But what confuses me is the many concepts like messages events. Also many terminologies like Guid, API functions etc.
I think I need a book to learn about the basics of windows programming.
C# books are not going much into that. They are teaching C# to a windows programmer.(At least I think So!)
Please suggest
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
|
I have Front End Microsoft C# 2005 Windows Application and Back End SQL Server 2005 Express Edition. I want to access SQL Server Express Data Base which is reside in one Computer, from 5 different location computers for adding and updating etc; records in Local Network Area.
Please guide me, how can I done the job.
|
|
|
|
|
|
hi.
How can I return IEnumerable<t> az a method parameter.
In fact I want to return a table records. but I must return as IEnumerable<t>;
How can I fill IEnumerable and return it?
|
|
|
|
|
Hi,
you have to write a class that will implement the IEnumerable interface. Within the implementation you can move through your records.
Have a look here:
http://msdn.microsoft.com/en-us/library/system.collections.ienumerable%28VS.80%29.aspx[^]
By the way, if you are using the System.Data.Table then the Rows-Property offers a GetEnumerator() method which will return an enumerator for the records within the table.
Regards
Sebastian
|
|
|
|
|
a world of thanks.
I 'll try to do it
|
|
|
|
|
Other than that, you can also use any class implemented from IEnumerable like Array, ArrayList, List etc... to return IEnumerable object.
|
|
|
|
|
Use a yield[^] keyword to return records as they go.
IEnumerable<int> GetNumbers()
{
for (int i = 0; i < 100; i++)
yield return i;
} Now you can do:
foreach (int number in GetNumbers())
Console.WriteLine(number);
Greetings - Jacek
|
|
|
|
|
I am getting an error message like this 'Object reference not set to an instance of an object' when I try to invoke an assembly method dynamically. Please refer to the attached code snippets.
I need forum's help to solve this problem.
The main code snippet.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using myClassLibrary;
namespace DynamicallyLoadAssembly
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Assembly assembly;
MethodInfo method;
Type type;
string sPath = @"F:\VS2005 Projects\myClassLibrary\myClassLibrary\bin\Debug\myClassLibrary.dll";
int val1 = 7;
int val2 = 5;
try
{
assembly = Assembly.LoadFile(sPath);
type = assembly.GetType("myClassLibrary.myClass");
Type[] p = new Type[3];
p[0] = Type.GetType("System.Int32");
p[1] = Type.GetType("System.Int32");
p[2] = Type.GetType("System.Int32&");
method = type.GetMethod("Method1", p);
Object[] ps = new Object[3] { val1, val2, 0 };
method.Invoke(null, ps);
MessageBox.Show("ps = " + ps[2].ToString());
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
Assembly assembly;
MethodInfo method;
Type type;
string sPath = @"F:\VS2005 Projects\myClassLibrary\myClassLibrary\bin\Debug\myClassLibrary.dll";
int val2 = 5;
try
{
assembly = Assembly.LoadFile(sPath);
type = assembly.GetType("myClassLibrary.myClass");
Type[] p = new Type[3];
p[0] = Type.GetType("System.Enum");
p[1] = Type.GetType("System.Int32");
p[2] = Type.GetType("System.Int32&");
method = type.GetMethod("Method1", p);
Object[] ps = new Object[3] { myClass.myEnum.One, val2, 0 };
// The error 'Object reference not set to an instance of an object' occurs when invoking this method.
method.Invoke(null, ps);
MessageBox.Show("ps = " + ps[2].ToString());
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}
}
}
The library code snippet.
using System;
using System.Collections.Generic;
using System.Text;
namespace myClassLibrary
{
public class myClass
{
public enum myEnum : int
{
One,
Two,
Three
};
public static void Method1(int a, int b, out int c)
{
c = a + b;
}
public static void Method2(myEnum a, int b, out int c)
{
c = 0;
switch (a)
{
case myEnum.One:
c = 1 + b;
break;
case myEnum.Two:
c = 2 + b;
break;
case myEnum.Three:
c = 3 + b;
break;
}
}
}
}
Thanks
Chris
|
|
|
|
|
Hi,
you are passing "null" as the first parameter to method.Invoke. But the first parameter is the required instance that the method will be executed on. The instance must be an object of the type you loaded dynamically. So before calling invoke you have to create an object from the type "myClassLibrary.myClass". This can be done by reflection also, using the constructor.
Have a look here:
http://msdn.microsoft.com/en-us/library/system.type.getconstructor.aspx[^]
Regards
Sebastian
|
|
|
|
|
Hi Sebastian,
Thanks for the answer, but I still do not understand how to fix.
I am not a pro programmer. Please explain with example...
thanks
|
|
|
|
|
Hi,
rewrite the invocation like this:
method = type.GetMethod("Method1", p);
object myObject = Activator.CreateInstance(type);
Object[] ps = new Object[3] { val1, val2, 0 };
method.Invoke(myObject, ps);
This will create an instance named myObject and invokes the method "method1" on that instance.
Regards
Sebastian
|
|
|
|