|
Thanks for the reply. I am reading RTF 1.8 Specification.
Let me re arrange my words, "Lines" means, lets say I draw a simple line in .wmf file and add that to RTF document. When I open the document and select .wmf image with the help of mouse and enlarge it, the size (width and height) of the rectangle (i.e. wmf image) increases that is acceptable but at the same time the line's width also increases, it becomes fat. Can we not control it at the time of creation of .wmf image?
sorry for messy description
|
|
|
|
|
That's what's supposed to happen. WMF is a vector graphic, meaning, basically, that the instructions to draw shapes is stored, not the shapes themselves. This is so that proportionally the graphic looks the same at any resolution.
Now, there may be a way to draw a rasterized shape (rendered) but I really don't know.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
yes you are very correct, all theory I read so far say the same thing about vector graphics and it is also said that .wmf can contain rasterized shapes (like bitmaps ) but nothing is said about how to add bitmaps to .wmf
may be i need to search more.
thanks
|
|
|
|
|
I have three classes A,B & C
A can instantiate B
B can instantiate C
but A cannot instantiate C
How can we do that
|
|
|
|
|
Put B and C in a separate DLL and mark C as 'internal', instead of 'public'.
Other way is making C a protected (or private) class inside the class B.
Yes, even I am blogging now!
|
|
|
|
|
I give up. Is there an option D?
|
|
|
|
|
Hi, where can i foud a library for probabilty.
normal, binomial, etc probabilty distrbutions.
Thanks.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Hi there!
I had the same problem some months ago and couldn't find a complete C# library for this. So I've done this myself. In recent future, I want to write an article about that but have no time for this now.
Anyway, to get what you want, there are two ways.
Either you can look for some Probability Library which is written for C++ or so and use it to create a Class Library for .NET. Take a look at this article[^] here on CodeProject which presents a wrapper for the random generators of the Boost.Random library for C++. As the Boost library also contains numerous distributions you could write a wrapper for them on your own orientating on the work done with the random generators.
The other and as I think preferable way would be implementing the distributions completely on your own. This isn't very hard, as they only do some mathematical operations with the numbers provided by a random generator. To know which mathematical ops you have to perform take a look at existing implementations of distributions like the Boost Library. Also I found this nice site[^] which provides good information about some distribution including formulas how to create the random numbers.
Hope this helps!?
www.troschuetz.de
|
|
|
|
|
Thank you! I will be waiting your article.
For now I will make something with my old probabilty books andyour links.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
The pleasure was mine!
machocr wrote:
I will be waiting your article.
Good to know that at least someone will read it
I will try to remember giving you a note when it's online. Hope I get this done in July after finishing my Bachelor thesis.
Until then, Happy Programming
www.troschuetz.de
|
|
|
|
|
Hello, just wanted to say hello. I recently started programming in C# and this looks to be a good place to gain knowledge. I hope to share my rambling thoughts with you and pester you for questions as the year progresses... anyway; well met!
Work by day, learn by night.
|
|
|
|
|
Is there a way to make drawing of Metafile (WMF) anti-aliased?
When I draw any metafile I get jagged edges for lines or circles.
I tried using:
Graphics.InterpolationMode
Graphics.PixelOffsetMode
Graphics.SmoothingMode
and they don't do anything for metafiles. They do work when I use drawline or drawcircle.
Thanks.
|
|
|
|
|
still looking for a good (and fast) solution for the same problem...
please someone help
|
|
|
|
|
Hi, I'm writing a project that takes values out of a n OleDbDataReader and places them into a text file exactly.
In other words, it has start codes, end codes, and line terminator codes. The line terminator sequence is a 0x0A (LF) followed by 0x00 (NULL). However, when writing this, the next string to be written has strange characters in front of it, like it'll have the 0x00 and then 0x13, which if left in and used in production, will cause the system that processes this file to reject it.
I'm using a BinaryWriter, and it's opened with ASCII encryption specified, so I do not know what is wrong. Anyone have any ideas?
|
|
|
|
|
Since you have specified ASCII encoding, I assume you are using the string overload of the BinaryWriter.Write method. This method writes strings prefixed by their length. That explains the strange characters you are seeing.
You would be better of converting the string to a series of bytes or chars first.
|
|
|
|
|
Using the String class's ToCharArray() worked, but just out of curiousity, is there a similar function that would do the conversion into a byte array?
And thanks for the solution, like I said, it's just a matter of curiousity, what I have now does work.
|
|
|
|
|
See the System.Text.Encoding class, and use the correct encoding.
Also, keep in mind this isn't a text file you're creating. The line endings are wrong (should be Environment.NewLine , but can be others except the null-terminator throws it out of whack). It you want a text file, use a TextWriter derivative. Unless you're trying to write a CSV, you can always base64-encode (or whatever encoding you want, but the .NET FCL doesn't have support for others at this time) binary data. You can use the Convert.ToBase64String or Convert.ToBase64CharArray methods, or the ToBase64Transform for streaming support (in this case you'll need to use a StreamWriter to get access to the string, or use a MemoryStream temporarily then use the Encoding class to write it to your text file).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have written a couple of windows services apps. when I test them they run fine and do what they are supposed to do. But after a couple of days or so, they are still running but do not perform the tasks. Any suggestions, if what could be causing it !
Would really appreciate any help.
Vinayak Katkam
japanreddy@yahoo.com
|
|
|
|
|
Make sure you're cleaning up code. If you use any IDisposable implementations (ADO.NET connections and commands are a good example), make sure you call Dispose on them when finished. It's a good idea to using a using block to make sure resources are released:
using (SqlConnection conn = new SqlConnection(...))
{
} It's also a good idea to instrument your service (using the Event Viewer, WMI events, etc.) so that you know what's going on. Obviously this would be a hard problem to debug (given the amount of time before things start going haywire), so instrumenting your app and responding to events will let you know when a problem starts.
Read some of the exception management and instrumentation blocks in the MSDN Patterns and Practices[^] section.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I created a C# project and I would like to call functions in my existing C++ project, so I add the C++ project to my C# solution. Can someone please tell me how to call a C++ function from a C# project? Thank you for your great help.
|
|
|
|
|
you need to add reference to the project in your C# project. This is a guess.
|
|
|
|
|
If this is a Managed C++ project, then it produces an assembly that you can use like any other assembly in your C# project.
If you want to call exported native functions, you need to learn about Platform Invoke. Read Consuming Unmanaged DLL Functions[^] and Marshaling Data with Platform Invoke[^].
If your project is a native VC++ project, your C# doesn't need a reference to it. Just make sure the compiled DLL is resolvable (i.e., either in the application's directory or in a directory within the PATH environment variable).
Read about the LoadLibrary API in the Platform SDK for the exact steps that the Winodws executable loader uses to resolve executables.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Fairly simple: i need to get the correct [THEME]_STARTBUTTON_BMP resource from the msstyles file, according to the current theme. UXTHEME reports Homestead for olive, Metallic for Metallic ... but... NormalColor for blue. i need the string "blue" if the current theme is in fact, the blue theme, in order to get the correct bitmap resource. IS THIS POSSIBLE?????
P.D.: I've tried, but uxtheme doesn't supports direct painting of startbutton resource, so, i thought the key is inside the .msstyles file itself. If i have the exact location where: DEFAULT=BLUE, then i read it and my problem is over. AFAIK, this location doesn't exists. PLZ HELPP!!!!
|
|
|
|
|
(this probably really belongs in the VS IDE board, but I'd rather Mr. Stewart took a read - apologies all)
Is there a way to programmatically create the "Add Reference" dialog as seen in the VS.NET IDE? I'm aiming at creating a wizard to generate a particular type of component. During this wizard process, the user will need to select an existing .NET assembly (one that conforms to interface X). I'm wobbling between writing my own file chooser, but if the "Add Reference" dialog is a creatable control, I'd rather use that.
Any ideas?
Jeremy Kimball
I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
|
|
|
|
|
Currently, the way the Add Reference works is as follows:
Go to the registry
Under the Framework it get the list of directories
Under each directory it gets each item in the GAC
You could probably do something similar where you have either a number of well-known directories or a way of dynamically constructing a directory list. For each assembly in each directory, you would then do an Assembly.Load and check to see if it exposes IMyInterface.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|