|
Michael Schubert wrote: It would appear that you have encountered some kind of keyboard malfunction. I suggest you fix this first and then come back here to ask your questions.
That's what happens when you drool on your keyboard, you end up gumming up the keyboard. I think this is what they mean by sticky keys.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Sounds more like 10yr old to me.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
You think they don't drool?
|
|
|
|
|
Kwagga wrote: Sounds more like 10yr old to me
Nah, just another poor soul that was conscripted into service of yet another outsourcing company.
|
|
|
|
|
It may also cause an echo.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
then you should call it in form "constructor" not "Form Load event"
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
|
instead of making a byte[] why dont you do your editting directly to the bitmap and then use the bitmap save function create the output file you want
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
well then you dont want to be working with an array of image pixels cuz they will always be valid values
Whats you error?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi Collin,
Not every stream/file constitutes a valid image; what Image.FromStream() accepts is the streamed content of an image file, as Image.FromFile() would expect. There is more to an image than just a bunch of RGB values; it needs dimensions, pixel depth information, maybe a color lookup table, compression information, etc.
Now what is it you want to achieve? You already have a valid image to start with, so why not modify it rather than copying/modifying its pixels, then work from there.
FYI: setting every third byte to 255 produces red only if (1) you do have a 24bpp image (which would be exceptional, most .NET images are 32bpp) and (2) the image is sufficiently dark (a white pixel will remain white, a yellow one will remain yellow)
BTW: in general when getting an exception, you should look at it; when posting a message, you should report it, that could help getting more and better replies sooner. In this particular case, you were bound to get an ArgumentException telling you not much except the one argument wasn't good enough...
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
|
Hi Collin,
if you want to convert an existing image into a stream, use an Image.Save overload that deals with streams i.e. Image.Save(Stream, ImageFormat).
the code you have shown does NOT deal with an image, it only handles pixel data; I suggest you don't try and convert pixel data back into a valid image, just use the existing .NET classes (Image, Bitmap), they know about several image formats.
FWIW: if you are having trouble turning an image into a stream (say a MemoryStream), then reading it back from that stream, chances are you forgot to "rewind" the stream between writing and reading, i.e. to reposition it at its beginning.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
You can use the System.IO.MemoryStream object to do this.
byte[] buffer;
MemoryStream ms=new MemoryStream(buffer);
Hope this helps.
|
|
|
|
|
|
Post the exception type and exception message.
|
|
|
|
|
Hi,
I am trying to get some rich text (from a RichTextBox.Rtf) onto a bitmap but can't seem to find a way to do it.
The key lines of my code are...
Bitmap Canvas = new Bitmap(200, 200, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Graphics Artist = Graphics.FromImage(Canvas);
Artist.PageUnit = GraphicsUnit.Pixel;
Artist.DrawString("Hello", descFont, descBrush, rect, descFormat);
It would have been nice if there were a:
Graphics.DrawRTF(string richText, Rectangle rect)
method, but there isn't.
What is usually done as a replacement? Any help or pointers appreciated.
Regards,
David Bailey.
|
|
|
|
|
Whats wrong with the 4 lines of code you already posted?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi musefan,
I am trying to display RichText not plain text. Or are you saying that the DrawString() command handles rich text as well?
-David.
|
|
|
|
|
No, DrawString() will not auto handle your formatting.
Have a look at this[^] for some ideas.
You could always handle yourself by iterating through each word in the richtextbox then getting its formatting(color, font etc.) before drawing it to the graphics object.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks.
I did not think to loop though the rich text. Might just do that.
The link was useful too.
-David.
|
|
|
|
|
Hi.. Am new to C# and our director gave a project.
Basically, what i want to do is launch an external program and place it within my c# app so when i maximize it, it just maximize within my app. I know how to launch an external program. What i want to know is it is possible to place the launched program in a child form for example.
Any help would be appreciated. Thanks..
|
|
|
|
|
There's an article on here called Windows Tabifier[^] that does what you want.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
how can i open an existing excel file as a new document.
and if user close it from upper left close(X) button of doc,
then it should ask to save the document as a new excel doc file.
amit
modified on Friday, March 20, 2009 7:57 AM
|
|
|
|
|
Hi,
I need to loop over a class' properties(object.GetType().GetProperties()), and if the property implements IEnumerable I need to respond to that, but I cannot find a way to confirm this, any ideas?
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|