|
reinux, thank you for your helping.
I think that is what I need.
|
|
|
|
|
I'm trying to implement a module that transmits custom objects through net(between tcp clients), I'm familiar with such thing in Java(ObjectInputStream and ObjectOutputStream). My question is: is there are something like that in C# and how to use it?
Thanx in advance, Evgeny
evgenyus
|
|
|
|
|
Yes there is. Look for the System.Runtime.Serialization namespace. There you'll find a BinaryFormatter and a SoapFormatter class for serializing the objects. You can then use the NetworkStream to transfer them over. Something like
using System.Runtime.Serialization.Formatters;
void SendObject(object o, Stream s)
{
new BinaryFormatter.Serialize(o, s);
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have a .gif I downloaded off the net as an Image type in my code. How can I take that and have it displayed as the icon for my NotifyIcon.Icon ?
/\ |_ E X E GG
|
|
|
|
|
Bitmap b = new Bitmap("filename.gif");
b.Save("d:\newname.ico",System.Drawing.Imaging.ImageFormat.Icon);
Icon c = new Icon("d:\newname.ico");
this.notifyIcon1.Icon = c;
|
|
|
|
|
Have you actually tried this, because I think I did something exactly like that and it didn't work.
/\ |_ E X E GG
|
|
|
|
|
Why? what was the problem? Maybe try convert that .gif to .ico with some application?
David
|
|
|
|
|
Argument Exception, "Argument 'picture' must be a picture that can be used as a Icon."
/\ |_ E X E GG
|
|
|
|
|
|
If I use the code LongHC provided, it dosn't work at runtime. Then if I try to make NotifyIcon.Icon the icon that LongHc's code created I get the same error except in a messagebox in the designer.
---------------------------
Microsoft Visual Studio
---------------------------
Argument 'picture' must be a picture that can be used as a Icon.
---------------------------
OK
---------------------------
/\ |_ E X E GG
|
|
|
|
|
Yeah, I get an ArgumentException, "Argument 'picture' must be a picture that can be used as a Icon."
/\ |_ E X E GG
|
|
|
|
|
Sph, forget CodeProject, I did it myself.
WebRequest requestIcon = WebRequest.Create("http://www.met-office.gov.uk/images/w1x15.gif");
WebResponse responseIcon = requestIcon.GetResponse();
Image image = Image.FromStream(responseIcon.GetResponseStream());
responseIcon.Close();
Bitmap b = new Bitmap(image, 16, 16);
notifyIcon1.Icon = Icon.FromHandle(b.GetHicon());
/\ |_ E X E GG
|
|
|
|
|
How can I add a type Image or any picture/image to a ListView at runtime without using an ImageList .
For example, I have an image type Image , I just want to add it to a row in my ListView .
So far the only way I've been able to do this is by first making a SmallImageList and putting my Image in it, then associating that ImageList with my ListBox , and then setting the ImageIndex to 0 for my Image .
That's alot of work. Can I simply just add an image?
/\ |_ E X E GG
|
|
|
|
|
No, you can't. Even each item in a ListView can have it's own ImageList.
But in no case can you just "add an Image" and move on.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ok, thanks.
/\ |_ E X E GG
|
|
|
|
|
I have a form that I have show up when a lengthy process (doing a search through files) is ongoing basically as a status window. The trouble is that controls don't paint properly.
Below is a link to a picture of what it kind of looks like (the left side of the form didn't capture well for some reason although it actually correctly displays):
Here[^]
How can I resolve this?
John 3:16: "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."
|
|
|
|
|
Without knowing anything about how your searching for files, your threading setup, form and code details, ... There's nothing we can do to help.
All we know is, your searching for files and trying to display a progress form. Since there are about a dozen different ways of doing this, it's a bit hard to help you with a description of "My code doesn't work, help!"
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As Dave said its hard to help you without more details. But my guess would be you do you operation in the same thread as the GUI. If you do this the GUI doesn't get the time to repaint itself. If this is the case you have two options:
1. Make your search in a seperate thread (better).
2. Try to call System.Windows.Forms.Application.DoEvents() regulary - but not too often (faster to implement but not very clean and probably slower).
|
|
|
|
|
My search and the GUI were in a single thread. Thanks for your help and sorry for a lack of more information (to both you and Dave), but I think you have given me the direction in which to go in to solve my problem.
John 3:16: "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."
|
|
|
|
|
I'm working on an image processing application and I was convinced to do this in C#. I am not very familiar in this language and my problem is that I don't know how to display multiple images in the same workspace. I thought this could be solved with PictureBox. Could anyone give me suggestions? I thank thee in advance.
|
|
|
|
|
Its not very clear what exactly you try to do. You can put several pictureboxes onto one form and display one image in each of them. If you want to show several images dynamically you can either add one PictureBox for each image at runtime or have a look a this article.
|
|
|
|
|
I wonder if it is possible to show more than one image in a picturebox.
In Java for example it is easy to display multiple images at specific coordinates in the same box at the same time.
|
|
|
|
|
No the normal PictureBox shows only one image. If you need this you will have to do it yourself. But its easier as you might think. Just create a new class inheriting from control, override the OnPaint method and draw your stuff:
public class MultiImageControl : Control {
private Image[] _images;
private Point[] _points;
public MultiImageControl(Image[] images, Point[] points) {
_images = images;
_points = points;
}
protected override OnPaint(PaintEventArgs pea) {
for (int i = 0; i < _images.Length; i++)
pea.DrawImageUnscaled(_images[i], _positions[i]);
}
}
Note that this will not be accessible in the designer. For this some more work is needed.
|
|
|
|
|
I need a concept about developing web MP3 web application (Play sound.rm.wav online with secure way..)
respectfully yours...
Ameen Abudbush
|
|
|
|
|
i try to request a page with posting some html code but it always throws System.Web.HttpRequestValidationException
with the message "A potentially dangerous Request.Form value was detected from the client (UEventHtmlFrameworkAdmin1:txtarHTML="
|
|
|
|