|
Study the Platform SDK and the .NET Framework SDK. Get some experience writing native C/C++ applications which use Windows messaging, perhaps even extending the common controls.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the Justify module.
Have you ever found the solution to the RightToLeft problem?
This problem also appears when using RightToLeft fonts.
Cheers!
|
|
|
|
|
hi my dear
if there is any free rtf parser component please
notify me about that or help me to find right ways to
writing complete rtf parser
thanks alot
hassan azizi
|
|
|
|
|
The RichTextBox both parses and displays RTF. If you don't need to display it (which brings-up the question, why bother parsing it unless you plan on converting and saving it?), you can use a Windows Rich Edit control, but that requires a lot of re-declaring COM interfaces and P/Invoking native methods. If you're not advanced in the ways of interoperability in .NET, you're probably better off finding a third-party solution, which you most likely won't find for free. It's a lot of work to correctly support all that is contained in the RTF spec. What do you expect?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i have wrote a simple rtf parser that parses rtf text of a richtextbox control
it parse paragraphs,text styles,alighn,color,links,languages,charsets and so on... .but i want to extend it to support most of RTF specification scripts !
and it seems to be so hard!
i want someone to join me for this work
thanks alot
hassan azizi
|
|
|
|
|
i have wrote a simple rtf parser that parses rtf text of a richtextbox control
but i want to extend it to support most of RTF specification scripts !
and it seems to be so hard!
i want someone to join me for this work
thanks alot
hassan azizi
|
|
|
|
|
private void resetPage()
{
foreach (Control c in Page.Controls)
if (c is TextBox)
((TextBox)c).Text = "";
}
on my web page it will not reset the text to ""
|
|
|
|
|
Are the TextBoxes in another container (a group box or panel)?
<br />
private void resetPage(){<br />
resetPage(Page);<br />
}<br />
<br />
private void resetPage(Control container){<br />
foreach (Control c in container.Controls) <br />
if (c is TextBox) ((TextBox)c).Text = "";<br />
else resetPage(c);<br />
}<br />
|
|
|
|
|
|
do apologise i should have tried your code first it worked a treat.
|
|
|
|
|
how can i create a new bitmap file?
i can not find the constructor,all the constructor is for the existing file?!
|
|
|
|
|
Bitmap b = new Bitmap ( width, heoght );
b.Save ( filename );
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Thank you very much
i think i got it
|
|
|
|
|
And if you want to paint on it:
Bitmap bmp = new Bitmap(width, height);
Graphics g = Graphics.FromImage(bmp);
g.FillRectangle(Brushes.Red, new Rectangle(0, 0, bmp.Width, bmp.Height));
g.Dispose();
bmp.Save("C:\\Image.png", ImageFormat.Png);
bmp.Dispose();
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ive been programming in C# for a while now, but there are a few technical performance issues I don't know yet.
There are a couple of things I use a lot (and I am growing used to using them), like ArrayLists.
I want to know which of these really easy to use things, like foreach loops, ArrayLists etc has a big performace hit.
And if they do, what should I use when performance is a great issue?
|
|
|
|
|
I myself, always try to use for loop which is much faster than foreach loop . On the other hand, if I have a class named Class1 , I'd prefer to store it in an Array of its own type instead of ArrayList , getting rid of type casting issues.
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
Type-casting isn't so much of an issue with reference types. It results in only 1 to 2 extra IL instructions. When casting value types, however, the value type must be unboxed (it's boxed in the ArrayList since it stores object s) and that is a serious performance hit. That's when a typed array (like int[] ) is definitely better.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Boxing is very expensive, and I always avoid it, but even casting can introduce more performance drain than you may think. Try running this code on your setup to see what I mean.
<br />
long startTime, endTime;<br />
int loopCount = 10000000;<br />
<br />
Guid guid = Guid.NewGuid();<br />
Guid guid2 = guid;<br />
object o = guid;<br />
object[] objectArray = {guid};<br />
Guid[] guidArray = {guid};<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
guid = (Guid)objectArray[0];<br />
guid = (Guid)objectArray[0];<br />
guid = (Guid)objectArray[0];<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (accessing array of objects)");<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
guid = guidArray[0];<br />
guid = guidArray[0];<br />
guid = guidArray[0];<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (accessing array of Guids)");<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
guid = (Guid)o;<br />
guid = (Guid)o;<br />
guid = (Guid)o;<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (assigning Guid from object w/ cast)");<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
guid = guid2;<br />
guid = guid2;<br />
guid = guid2;<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (assigning Guid from Guid)");<br />
<br />
Environment.Exit(0);<br />
<br />
This gave the following output on my setup, a dual P4 Xeon workstation running VS.NET 2003 in Debug mode:
468750 microseconds total (accessing array of objects)
421875 microseconds total (accessing array of Guids)
484375 microseconds total (assigning Guid from object w/ cast)
375000 microseconds total (assigning Guid from Guid)
Casting overhead is actually one of the major performance drains when using generic collections, after things like method-call overhead and synchronization. I'm not saying that nobody should use collections, but it's good to know how you're spending cycles. I agree with maysam; there's no reason to cast unnecessarily, and good reasons to avoid it.
Regards,
Jeff Varszegi
EEEP!
|
|
|
|
|
A Guid is a value type, so there is boxing/unboxing involed with casting.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Sheesh, you're absolutely right. Thanks-- I thought those numbers looked suspiciously close, but I chalked it up to running in Debug mode, and I never realized that Guid is a struct! I ran this code:
<br />
long startTime, endTime;<br />
int loopCount = 10000000;<br />
<br />
string s = "";<br />
string s2 = s;<br />
object o = s;<br />
object[] objectArray = {s};<br />
string[] stringArray = {s};<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
s = (string)objectArray[0];<br />
s = (string)objectArray[0];<br />
s = (string)objectArray[0];<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (accessing array of objects)");<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
s = stringArray[0];<br />
s = stringArray[0];<br />
s = stringArray[0];<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (accessing array of strings)");<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
s = (string)o;<br />
s = (string)o;<br />
s = (string)o;<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (assigning string from object w/ cast)");<br />
<br />
startTime = DateTime.Now.Ticks;<br />
for(int x = 0; x < loopCount; x++) {<br />
s = s2;<br />
s = s2;<br />
s = s2;<br />
}<br />
endTime = DateTime.Now.Ticks;<br />
Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (assigning string from string)"); <br />
<br />
<br />
Environment.Exit(0);<br />
and got this output:
234375 microseconds total (accessing array of objects)
62500 microseconds total (accessing array of strings)
187500 microseconds total (assigning string from object w/ cast)
46875 microseconds total (assigning string from string)
Casting introduces a big performance whack in Java programs, a little less in .NET ones in my experience, but still very significant.
Regards,
Jeff Varszegi
EEEP!
|
|
|
|
|
Excuse me,I don't know which message board is adapted to ask my question.
I want the stroke I painted in my C# project can be saved and used in PowerPoint 2003,
but TabletPC SDK's Ink.Save can only save ink for *.ISF or bitmap,
*.ISF can't be inserted into PowerPoint 2003,
I only find the *.emf can be used...
If I save my ink for bitmap,
because the background of the ink is not transparent,
When I insert it into PowerPoint 2003,
it would cover the original image in PowerPoint 2003...
Can I save my ink as *.emf or a transparent bitmap...??
|
|
|
|
|
EMF is a vector format, so it really isn't transparent or solid. It's a collection of strokes and fills, so if an area isn't filled it appears transparent.
You can insert a bitmap into PowerPoint, though. PowerPoint supports a wide variety of image formats.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a question about deployment of a C# application. I see in the MSDN how to create a shortcut to the desktop, but for the life of me, I cannot see how to setup the Start menu. Can anyone please point me into the right direction?
Thanks
Larry J. Siddens
|
|
|
|
|
If I am not wrong in understanding what your question is.
Why not create a setup kit for your application. You could write to the registry. You could create a program group in the start Menu.
|
|
|
|
|
You don't write to the registry to correctly create a program group.
Microsoft MVP, Visual C#
My Articles
|
|
|
|