|
Thanx Guffa! It works now
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Guffa was correct. The problem is that your first line of code, Bitmap(@"C:\LEGO.jpg"); , is locking, by design if the Image class Bitmap derives from, the file it loaded for the lifetime of the Bitmap object. So, to get around this limitation, you have to read the .jpg file yourself using a StreamReader, then create the Bitmap from the StreamReader object. This will prevent the file from being locked so you can Save the new image file over the old one without getting that error.
|
|
|
|
|
Thanx Dave, but did you actually try this solution?? Does it work with you?? How can you do it with stream reader?? Did you mean FileStream?? And if so, it still doesnt work even after closing it!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Sorry, using a FileStream works. Yes, I have done it and, yes, it does work. There's something else you're doing, or not doing correctly that's keeping the file locked. See this[^].
|
|
|
|
|
|
Hi
Is there any tools in visual Studio 2008 Team Suite for Team Working (Like Visual Source Safe) ?
if so, can any one give me a useful article for working with it ?
thanks
|
|
|
|
|
Team Foundation Server (TFS) is the source control & bug tracking server from MS, I can't remember if it comes with Visual studio team suite or if you have to buy it separately (Probably depends on if you have an MSDN license or not).
There are other non-ms alternatives to source safe too. Just google for source control. (Subversion, Perforce, CVS, Git are just a few)
(Comparisom of source control software[^])
If you need bug/issue tracking as well, there are also plenty of options (Bugzilla, BugTracker.net, FogBugz, Trac are a few I can think of). (Comparisom of bug tracking software[^])
Simon
|
|
|
|
|
Thanks Simon
can i use Source Safe for Visual Studio 2008, Instead of TFS ?
|
|
|
|
|
Yes you can, but a lot of people are very critical of source safe. We use it and I don't like it. There are plenty of better options out there. If you have MSDN and TFS it is much better, I've used it in the past and it is good. Check out some of the other ones on the list, if you can't afford TFS.
Simon
|
|
|
|
|
I want to implement undo functionality without using predefined function of undo of rich text box
in my application.
Can any one help me?
Thanks in advance.
Regards,
Khaleek Ahmad
|
|
|
|
|
Use the article search function, you will find lots of framworks, like this one[^].
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi friend i want to load to Content of the pdf file using C# can any body help me how i can do this...................
wasim khan
|
|
|
|
|
Do you think posting the same question after about 40 minutes will help? I doubt it.
wasimsharp wrote: i want to load to Content of the pdf file using C#
Try reading the file.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi Wasim,
Refer to the below mentioned link:
Link [^]
I hope this would be helpful.
John Adams
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
i want to save a image form serialization....
hghghgh
|
|
|
|
|
Thats nice. Not really a question though is it?
So, where about are you? Do you have a stream which represents the image? If so, how did you get that image into the stream in the first place?
You've got to give at least a little bit of information to get any help.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
[Serializable]
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
draw();
}
public void draw()
{
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.Red);
g.DrawRectangle(p, 23, 23, 78, 78);
}
using System.IO;
using System.Xml.Serialization;
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private static void Serialize()
{
Form1 obj = new Form1();
XmlSerializer mySerializer = new
XmlSerializer(typeof(Form1));
StreamWriter myWriter = new StreamWriter("C:\\myDrawing.xml");
mySerializer.Serialize(myWriter, obj);
myWriter.Close();
}
private static void DeSerialize()
{
Form1 obj = null;
XmlSerializer mySerializer =
new XmlSerializer(typeof(Form1));
FileStream myFileStream =
new FileStream("C:\\myDrawing.xml", FileMode.Open);
obj= (Form1)mySerializer.Deserialize(myFileStream);
obj.Draw();
}
private void Form2_Load(object sender, EventArgs e)
{
Serialize();
// Form1 f = new Form1();
// putIt objDele = new putIt(f.toi);
//objDele();
}
private void button1_Click(object sender, EventArgs e)
{
DeSerialize();
}
}
now i think its enough for understanding
?
hghghgh
|
|
|
|
|
Here you are serialising form1 - i.e. serialising its properties (text, size, position etc). This does not serialise the graphics. I suggest that if you want to save the graphics drawn at runtime you look at putting them into a bitmap, and saving that instead of using serialisation.
Chris
|
|
|
|
|
i have to save through serialization..
hghghgh
|
|
|
|
|
If you really, really must I think there is something deep within the graphics object for serialising it, but I couldn't tell you what off the top of my head. I suggest you have a look with Reflector at what is inside that might help you.
Chris
|
|
|
|
|
Do your drawing to a bitmap as suggested. Have a property of byte array. Save the bitmap to a memory stream and use the stream's ToArray method to set the data in your property. It should then serialize OK.
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)
|
|
|
|
|
Your code shows nothing related to an image, and as the others stated,
you'll need to create an image to serialize (although your question
is really hard to understand).
System.Drawing.Image is serializable = here's a simple example:
Bitmap bm = new Bitmap(320, 240, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bm);
Pen pen = new Pen(Color.Azure);
g.DrawEllipse(pen, 10, 10, 100, 100);
g.DrawRectangle(pen, 10, 10, 200, 200);
FileStream fs = new FileStream("c:\\serialized_bitmap.dat", FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
try
{
formatter.Serialize(fs, bm);
}
catch (SerializationException )
{
throw;
}
finally
{
fs.Close();
}
Of course, you'll have to create your Image/Bitmap the way you need to.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thx dear!
now i understand.....
hghghgh
|
|
|
|
|
hi Friends,
can any body tell me that how i can load the Pdf file text into rich text box
wasim khan
|
|
|
|
|
You need to use a PDF library.
There are several open source .net PDF libraries, although most only support writing, not reading PDF files. See here[^] (PDF clown looks like the only one that reads PDF files)
There are loads of commercial PDF libraries, just google.
If you don't want to use a library, you'll need to download and read the official Adobe PDF spec[^] before writing your own PDF reader.
Simon
|
|
|
|