|
|
I want to transfer a class instance on internet and encrypt this instance. But the encryption classes requieres byte[]. how can I get the byte[] representation of an instance?
|
|
|
|
|
|
I know PHP and Java, and I'm just starting to learn C#, so I don't know many of the C# methods.
I'm trying to write a method that will open a bmp image and save it on the hard drive. I want to compile the image with the program, so I added it as an item in the Solution Explorer, but now I dont know how to access it.
What method do I use to access it?
Thanks
|
|
|
|
|
wetdog500 wrote:
so I added it as an item in the Solution Explorer
Umm.. what exactly did u added and how?
To open a bitmap and save it somewhere else on ur machine you could say:
System.Drawing.Bitmap myB = new System.Drawing.Bitmap(@"C:\myBitmap.bmp");<br />
<br />
myB.Save("......");
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
In the Solutions Explorer I right clicked on my project's name then went to 'Add', 'Add Existing Item...'.
Next I selected a .bmp image and hit enter.
Does that help?
|
|
|
|
|
wetdog500 wrote:
In the Solutions Explorer I right clicked on my project's name then went to 'Add', 'Add Existing Item...'.
Well, not really. What you did, is just adding a specific bitmap image as a resource into your solution. If all u need is opening a bitmap during runtime and save it somewhere else, you just have to follow the small code sample I provided you with before.. or something similar.
Hope this helps
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanks, but what path do I use to access the image?
|
|
|
|
|
Well, that's up to you.
I think that you would want your users to be able to specify the path to a bitmapt for themselves by browsing for a specific file or typing down the filename path for themselves. It wouldn't really made much sense to just specify a fixed filename path in your code right?
A simple example:
You could drop two textboxes and a button on your form. The users would then type a path to a bitmap in the first textbox, the new path to which the bitmap will be copied in the second textbox (if it does exists under that path), and finally press the button to actually copy the bitmap.
On the button click event you could have something like this:
Bitmap myBitmap = new Bitmap(this.textbox1.text);<br />
<br />
myBitmap.Save(this.textbox2.text);
A small tip:
Btw, you would have to provide some checkups. E.g. make sure that the path names the user provided are valid before attempting to load a bitmap. Or, make sure that the user HAS provided paths for both textboxes.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
No, I'm sorry I didn't explain myself well enough.
I want to have the user copy a resource in my program, not on the hard disk, to a loction on their hard disk.
How do I access that resource?
|
|
|
|
|
wetdog500 wrote:
How do I access that resource?
To programmatically access one of your resources you could say something like:
Assembly myAssembly = GetExecutingAssembly();
Stream resourceStream = myAssembly.GetManifestResourceStream("myBitmap.bmp");
Bitmap image = new Bitmap(resourceStream);
wetdog500 wrote:
I want to have the user copy a resource in my program
I am not sure whether you can do that. Resources are part of your assembly and are included in it every time you compile your program
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
|
It's alright. Glad I could help
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
|
I didn't know you could do that but it makes sense now that I think about it.
"If there is a God, atheism must seem to Him as less of an insult than religion." - Edmond de Goncourt
|
|
|
|
|
It is cool indeed, although I have to assume your example is contrived since just using "3.1415927" would have avoided boxing the numeric value (as well as a call to the member function 'ToString() ').
In general, gratuitous boxing/unboxing is discouraged because of its performance cost, although the ability to box/unbox value types clearly serves a purpose, and is ingrained into the .Net Framework - the ArrayList type is a perfect example.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
|
Neither. The framework doesn't return 'pi' until you have at least 20 significant digits.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
|
how to display combox in property grid??
simple data type is ok, see this article:
http://www.c-sharpcorner.com/Code/2004/June/PropertyG ridInCSharp.asp
|
|
|
|
|
I have installed window service succesfully (and the system event log also said so); however the service doesnt appear on Sevices at Adminstative tool so i can't start it. Therefore, what I did wrong ?
|
|
|
|
|
If you started the services panel before you installed your service, hitting F5 to refresh may be all that is needed. If shutting down and restarting the Services panel doesn't display your service, then your service must not have been actually installed. Check every relevant log that you can find to see what might have happened.
(Since you're in a C# forum, I assume you wrote the service yourself and used InstallUtil to install ther service. If that is the case, then check your InstallLog files in the directory with your service exe.)
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Have you tried VS 2005 Express Beta 2. Is there something new compared to February CTP? Is at least the documentation more complete?
|
|
|
|
|
Beta 2 has been improved a lot, and it's feature complete. Everything you code in Beta 2 is supposed to be compatible with RTM. It also has a go-live license.
|
|
|
|
|
How to I convert System.Drawing.KnownColor.{item} to a System.Color color. My one attempt at using ColorConverter raised a very nice object exception. Anyone know?
Thx.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|