|
I have created a bitmap class and loaded an image from a jpg image, and now need to save the bitmap as a 24-bit .bmp file. However using the default .save method saves at 32-bit by default. I can't figure out how to change this so that it will save to 24-bit, as this is what i need. Do you need to declare it when you first declare the bitmap, or only when you save it?
Thanks for the help.
|
|
|
|
|
You must create bitmap with 24 bit pixel format:
Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);
Best regards, Alexey.
|
|
|
|
|
Hi i am having some problems with my progressbar. i am copying a file and i am wanting the progressbar to show the progress of the file that is being copied using file.copy(path,path2). I did some research and this is what i have
syncbar1.Maximum = Convert.ToInt32(path2);
but it isn't gradually increasing. could someone help me with this?
thnx in advance
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi again
Maximum is the maximum value that the progress can have (usually 100 or 100%). You need to be changing the Value property of the progress bar:
syncbar1.Value += 1;
Does that help?
|
|
|
|
|
Hey Sean! whats up man. Yeah i think i am on the right track because the is because the syncbar is moving up but it only moves up to 1 tick.
File.Copy(path, path2);
syncbar1.Value += 1;
syncbar1.Maximum = Convert.ToInt32(path2.Length);
what i'm wanting to do is have the progressbar show the percentage of the file being copied. Like if only 43% of the file is copied it should only show 43% on the progressbar.
Don't be overcome by evil, but overcome evil with good
-- modified at 20:35 Thursday 4th May, 2006
|
|
|
|
|
Yeah ok I see what your trying to do. I have never tried to do this but I do know that File.Copy() just copies a file; no progress reporting. I know of a Win32 function (called CopyFileEx ) that you can use to do what you need for your program. It uses a callback function to give you the progress of the file copy. As you said earlier you are just learning C# so this might be a bit advanced for you. But if you have any questions just post a question here on CP and I'm sure someone will be able to help
Here is the function definition[^] and here is the documentation[^] on MSDN
I would try it myself for you but I dont have the time
Hope this works for you
|
|
|
|
|
Alright man i'll check it out right now. thanks alot man. I appreciate it!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hey, I actually did a little searching on that function and I found an example of it being used. The example is a bit different than what you want but I can modify it so that it will work for you Do you want me to do this and post the code? Or do you have it working now?
|
|
|
|
|
To be honest man i haven't been able to use the page you posted. Last night i did however read the MSDN documentation on it. But I didn't have too much time last night to work on it because it was busy at work. If you'd like you can still post the example. I'm still going to check the page you posted and see what i can come up with also. That way i'll be able to learn what is actually going on!
After i get this project completed I'm going to send you the source of this project. You've helped me out alot with it! I might also put it up on sourceforge.net. But beware it is REAL newb code . I've just been working on a small project so i can get some hands on while i read the "Microsoft C# Step By Step".
Peace
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Yeah to be honest I like to know whats going on with my code too. I'll try and get a file copy thing going with that function and will post some examples with some comments to walk you thought what it is doing.
Sounds good I'd like to see it when it's done. Don't worry if your code is a bit inefficient (it can't look worse than the first program I wrote ). Every project you do you gain experience and pick up some knowledge of how to do something new
|
|
|
|
|
Whats up man. I tried working with the page you sent me but i couldn't get it working. It was giving me punctuation errors like ";" at the end of every line. i'm pretty sure i am just not using it right . I was browsing msdn and i came across DllImportAttribute Class[^]. I'm going to work on it again today and see what i can come up with.
Peace
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Yup the DllImport is what you need to get the method I have thrown together a small example for using this function. I can send you the source code for the project (posting too much code makes it confusing). What version of visual studio are you using?
|
|
|
|
|
I am using visual studio 2005. Thanks again for all the for all the help man! Once i get to work tommorow i will send you the source.;)
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi.
I need a sample code that using socket I can in one application write a stream on a port and in another application on another machine can read that stream.
You soppose that these two machines are connected to each other using LAN.
Best wishes
|
|
|
|
|
Well if you can't find sample socket code on the internet you didn't look! There are more socket code samples on the internet than just about anything else and that problably includes porn.
sockets.com[^]
led mike
|
|
|
|
|
|
Can anybody help me to know how to send emails using C#.NET v1.0. Please provide me necessary coding to perform this.
I am a student
|
|
|
|
|
|
http://dotnetopenmail.sourceforge.net/faq.html
Above link is to open source C# library for sending e-mails with attachments, as HTML, Text, etc.
It works fine in .NET 2.0, and I can't find anything on SourceForge or the home site above that says it DOES NOT WORK on 1.1, or 1.0, but if you have any doubt go to the Forums on the page linked to above and post a message.
best, Bill
"The greater the social and cultural distances between people, the more magical the light that can spring from their contact." Milan Kundera in Testaments Trahis
|
|
|
|
|
Hi all. My C# app registers itself using the IStillImage interface, and the RegisterLaunchApplication method, such that when we connect a camera, our program is listed in the box that comes up, and from there we can run the software. Recently, it's become the case that launching the app this way causes it to freeze, although running it normally never does. There are no parameters passed through, nothing should run any different to if I double click on the app. What happens is, it shows a second thread in task manager, which, if you go to the process, goes to explorer.exe. This thread is the only one not responding at first, then the other one also dies, and Windows informs you that you need to close the app, etc. There is definately no visible UI to go along with the other thread.
Any suggestions are most welcome.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ThreadingApartment?
|
|
|
|
|
Hello,
With following code i can filter (with the GetSodas sql-query) data out of my database, and get the total of records which can be found.
int totaal = aanbodTableAdapter.CountSodas().Value;
So far so good.
Now, I want to get 1 single record (which i filter by the id) out of the GetSodas-query.
I tried this:
button1.Text = aanbodTableAdapter.GetSodas().FindByid(1).description;
But I get an error:
<br />
System.NullReferenceException was unhandled<br />
Message="Object reference not set to an instance of an object."<br />
What do I do wrong?
Thanks!
|
|
|
|
|
Well, you should first break this down so each call is on a new line. Then work out where you're getting null, and you can try to fix it from there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't really know what you are trying to say ..
I know exactly where I get the error (as said in first post), but I can't fix it ..
|
|
|
|
|
JelleM wrote: know exactly where I get the error
No, you do not.
button1.Text = aanbodTableAdapter.GetSodas().FindByid(1).description;
button1 could be null. There's two method calls and a property call, each of which could fail due to a null reference. So, you need to call GetSodas, place the result in a variable. Then use that to call Findbyid. Then, access the description property. FindByid would be my guess, but it's best not to guess, make sure, then you know where to look.
Christian Graus - Microsoft MVP - C++
|
|
|
|