|
I'd go the easy way out & create two datasets that collect the information I want to display & bind the grids to them.
I think I'm going to call my next project "Chuck Norris". It's a sure way to guarantee it's unbreakable.
• • •
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
I am working on an application in which i save save html files which have ISO-8859-1 encoding (The html files are in spanish).
I use stream writer to save the source of the files as html files.
The problem is the encoding options available in the system.text.Encoding class are
ASCII
UTF7
UTF32
UTF8
Unicode
so when I save the page it changes certain characters.
Can Any 1 suggest which encoding i should use ...
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
Encoding.Default should do the job
|
|
|
|
|
Thanks it worked for me
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
Those are only the predefined encodings. You can create an encoding for any code page that the system supports using the Encoding.GetEncoding method. Check the documentation for the Encoding class for all the available encodings.
---
single minded; short sighted; long gone;
|
|
|
|
|
How to save into a file a graphics?
I tried this but not working
Graphics g = pictureBox1.CreateGraphics();
Pen p = new Pen(Color.Black);
g.DrawRectangle(p, 1, 1, 100, 20);
Bitmap bit = new Bitmap(482, 150, g);
bit.Save("c:\\image.bmp");
And if i draw something into a picturebox, how to save it into a file?
I tried this but not working
Graphics g = pictureBox1.CreateGraphics();
Pen p = new Pen(Color.Black);
gg.DrawRectangle(p, 1, 1, 100, 50);
gg.DrawRectangle(p, 2, 10, 50, 30);
Bitmap bb = new Bitmap(pictureBox1.Image);
bb.Save("c:\\image.bmp");
Help me please!
http://pmartike.deviantart.com/
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
The CreateGraphics method creates a Graphics object for drawing on the control. There is no specific CreateGraphics method that creates a Graphics object for drawing on the image in a PictureBox . You are just drawing on the screen, that does not affect the image in the PictureBox .
You have to create a Graphics object for the bitmap so that you can draw the graphics on the bitmap instead of on the screen.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks, you're right
i solved the problem...
http://pmartike.deviantart.com/
|
|
|
|
|
pmartike wrote: pictureBox1.CreateGraphics();
To further clarify, you should never do this
1 - it's a waste of a picture box, the picture box does nothing
2 - if your form is obscured, what you drew will be erased
Draw in your paint event, or create a Bitmap and assign it to the picture box. Draw on it first if you want to, and save it, if you want to do that.
pmartike wrote: Bitmap bb = new Bitmap(pictureBox1.Image);
The issue here is that there is no image inside the picture box, you need to put one in there, and even if you do, CreateGraphics won't do anything to it. It's more like you are drawing on a layer above the control, a layer that is not permanent.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
your & my problem both are same ,read my today(june,27) post
"Problem about bitmap in Visual Studio C Sharp.NET ?"
i solve my half problem by following code:
Bitmap bmp = new Bitmap(pictureBox2.Width, pictureBox2.Height);<br />
Graphics g = Graphics.FromImage(bmp);<br />
Pen p = new Pen(Color.Red, 5);<br />
g.DrawEllipse(p, e.X, e.Y, 5, 7); <br />
pictureBox2.Image = bmp;
*first read my post, if you get any solution then please inform me
|
|
|
|
|
i can't find your post
i resolved my problem too:
<br />
Bitmap bit = new Bitmap(244, 200);<br />
Graphics g = Graphics.FromImage(bit);<br />
g.DrawRectangle(WhitePen, 10,10, 100, 50);<br />
bit.Save("c:\\image.bmp"); <br />
Can you give a link with your post?
http://pmartike.deviantart.com/
|
|
|
|
|
|
When shd we make function static in C#..
We will be able to call function using the class Name. Wat is the advantages of that and wat are the scenarios where we would use static functions
|
|
|
|
|
Sounds like a homework/interview question.
Google for the answers, and if you still don't understand something, be specific with your quesion.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Tell me a scenario where we are forced to make a function static
|
|
|
|
|
Hello,
I think you really should do what have been suggested bevor!
Is the reason why you posted the question again (which is very rude for the one who tried to help you) that you haven't understood the answer?
I give you a help to search for at google:
"Singleton"
All the best,
Martin
|
|
|
|
|
I have this suspicion you thanked me with that 1 vote, but I'll give you the benefit of the doubt.
To answer your question: Singletons. Factory methods. Helper classes. Lots of other scenarios where your function should/does not need to do anything with the instance variables.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Vikram A Punathambekar wrote: I have this suspicion you thanked me with that 1 vote
This really sucks!!!
That's why I posted this suggestion[^]
Got my '5' to bring it back in shape!
All the best,
Martin
|
|
|
|
|
Heh, I'm happy to share what little I know, but these little things can be annoying. C'est la vie.
I find it amazing that people like CG, Guffa, you, and a few others plow on with little to no rewards. I'd be happy if I were half as helpful as one of you.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Vikram A Punathambekar wrote: I find it amazing that people like CG, Guffa, you, and a few others plow on with little to no rewards
There are rewards.
1. Occasionally people thank us.
2. It exercises the brain so it helps retain the information we have, even if we aren't working on a project that uses it at this time.
3. If you are helpful enough you get a different icon next to your name.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
I should have included you as well in my list.
What I meant was that people don't get paid for answering these questions like they do for writing code for their employers.
I sometimes forget instant gratification is a myth. However, I'm still young, still learning and determined to 'plow on' like you guys.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Here's a thought, if a function has no state, then why would you want to have to create an object instance, to call it ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
That may be a little beyond him
I think I'm going to call my next project "Chuck Norris". It's a sure way to guarantee it's unbreakable.
• • •
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
If it is, then there's no point in giving a more direct answer
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
When you can't use the keyword 'this'. (It's basically what Christian said above )
|
|
|
|