|
Hello every one
I am phasing some issues while i am tring to save a image..
My application works as follows
It is a application in which i am using a tablet to to let the user write free hand
I am able to do the first part by creating a bitmap and graphic object. I am capturing points and drawing lines between them
My next objective is to load a existing image and let the user draw over it and save it...
I am able to do it but when i save it back it gives a GDI error as “A generic error occurred in GDI+.”
I also have a option to let the user clear the old image and create a new one. When i do it i am able to save
The codes are as follows
form load
'Lode a existing image
picDraw.Image = System.Drawing.Image.FromFile(im_path)
'Associating the graphics object to Picture box
bm = New Bitmap(picDraw.Width, picDraw.Height)
g = Graphics.FromImage(bm)
'Draw on the Graphics object.
g.FillRectangle(New SolidBrush(Color.White), _
0, 0, picDraw.Width, picDraw.Height)
'Load the prescription to be edited
g.DrawImage(picDraw.Image, 0, 0)
Clear the image
' Draw on the Graphics object.
g.FillRectangle(New SolidBrush(Color.White), _
0, 0, picDraw.Width, picDraw.Height)
picDraw.Image = Nothing
Save the image
'Update the picture box with the latest bitmap
bm = picDraw.Image
'Save the bitmap as Image on the stated path
bm.Save(path_string, System.Drawing.Imaging.ImageFormat.Gif)
There is a timer which executes after every 50 milliseconds, hear i load the bitmap's contents in the picture box
picDraw.Image = bm
Can any one plz hep me out
-- modified at 9:47 Monday 26th November, 2007
|
|
|
|
|
Hi,
some comments that may or may not help you:
1.
"A generic error occurred in GDI+.” is the general message you get when something goes
wrong inside GDI+, the graphics subsystem. If it occurs while trying to save, it
may mean disk full, bad file name, ... or fill locked.
2.
Image.FromFile() keeps the file locked as long as the Image object lives.
Image.FromStream() does not do that.
3.
Taken together, if you try to save to the same filename you used to load an image from,
and that image is still alive, then you should go for FromStream().
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks a lot...
after posting this query did some more research i am able to find that when i want to over right the old file i am not able to do it...
is it another way to handle it...
I think there is a crude way but i am not satisfied with it...
The crude way i think should work is that copy the file to be loaded on as a temporary file at a different location and over right the original file
now with ur input i think the things should work
|
|
|
|
|
One more issue..
how do i read file from dis by FromStream()
|
|
|
|
|
|
hi all
i have a textbox and i am trying to add some special characters to the textbox as the text typed.
like user type 2000, that would be 2,000 and can be read as 2000 when i use the value.
the second thing is in lost focus of textbox the text converted to 2,000 to $2,000.00.
do some one has any suggestion.
thanks in advance
help everyone
|
|
|
|
|
use mask edit box...
on leave event change the mask...
|
|
|
|
|
Buongiorno a tutti, io avrei un problemino. ho vb 2005 e non riesco ad inviarfe email dall'applicazione, ho usato la classe system.net.mail ma non riesco a settare l'autenticazione del server smtp necessaria.
qualcuno può aiutarmi...
grazie.
ecco il codice che uso
Dim Message As System.Net.Mail.MailMessage
Dim SmtpMessage As New System.Net.Mail.SmtpClient
Message = New System.Net.Mail.MailMessage(Mittente, Destinatario)
Message.Body = ("Prova Messaggio")
SmtpMessage.Send(Message)
grazie per l'aiuto
|
|
|
|
|
Can you post this in English, so that more people can get the problem and try suggesting a solution?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
hi all
i have two froms, frmnew and the other one is frmupdate.
frmnew is set the very first form to open when the application run.
both forms contains a menu bars having two buttons on them.
one button for exit the application and the other button allows the other form to open(.show).
the code is something like
Me.Close()<br />
Me.Dispose()<br />
Application.DoEvents()<br />
frmupdatemodified.Show()
the last line frmupdatemodified.Show() shows the error cannot-access-a-disposed-object.
what is going wrong please tell to solve the problem.
thanks in advance
help everyone
|
|
|
|
|
frmupdatemodified has already been closed and disposed. When you dispose of it, set it to nothing, and then you can check if you need to reinitialise it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi christian thanks for reply
i check it out, i am not disposing the frmupdate, and if i miss something can u tell me how can i figure it out.
i tried this also but it doesn't work
Me.Close()<br />
Me.Dispose()<br />
Application.DoEvents()<br />
frmupdatemodified.Dispose()<br />
frmupdatemodified = Nothing<br />
frmupdatemodified.Show()
can you tell me how it can be done
thanks
help everyone
NO ONE LIVES FOREVER
|
|
|
|
|
eyes2007 wrote: i check it out, i am not disposing the frmupdate, and if i miss something can u tell me how can i figure it out.
i tried this also but it doesn't work
Me.Close()<br />
Me.Dispose()<br />
Application.DoEvents()<br />
frmupdatemodified.Dispose()<br />
frmupdatemodified = Nothing<br />
frmupdatemodified.Show()
You have only tried part of Christian's suggestion... you need to re-instantiate the form if you need to re-use it. At the .Show(), the object fromupdatemodified doesn't exist.
Another point - the Me in the above sample... is it the form where you created the frmupdatemodified form object? In that case, since you have already called Me.Dispose, any objects created will also cease to exist.
|
|
|
|
|
Hallow can anybody help me
In my project we are maintaining separate folder for individual users for their attachments registeration.
The problem is when admin delete the user we are deleting the folder created for that user’s attachment. It is working properly but after deleting the folder our session is automatically expired and redirected to session out page how, why and where am not able to fix the session.
I actually don’t want session to get cleared what is the problem in my code I don’t know my code is as bellow.
<br />
Dim ServerPathDel As String = ConfigurationManager.AppSettings("MapPath") & "Uploads\" & Session("@UserId") & "\ "<br />
If Directory.Exists(ServerPathDel) Then Directory.Delete(ServerPathDel, True)<br />
Thanks Shivashankar.C
The Value Has Its Value Only Its Value Is Valied
modified on Tuesday, March 25, 2008 8:05 AM
|
|
|
|
|
Hi
In my asp vb.net project on root i create one folder named menu in that menu i create two folder named ACC,
Branch ther i put respective .js file. In the root i create Master folder and stored my pages BUt the menu does not displayed properly and also if i click on menu it dont work. but the pages which are stored on root are working
very fine .
<
<title>Supplier_Mst
<% if Session("designation")="Branch" then %>
<% End if%>
<% if Session("designation")="Admin" then %>
<% End if%>
<% if Session("designation")="PMT" then %>
<% End if%>
<% if Session("designation")="Accountant" then %>
<% End if%>
>
code added in html is given below
img folder is there on root.
Pl advice me how to solve this problem.
Regards
Sonia
|
|
|
|
|
soniasan wrote: i put respective .js file
So, you meant to post this in the ASP.NET forum then ? Actually, it's probably a web dev question, not an ASP.NET one. It sure is not a VB question.
It looks to me like you're using some sort of javascript menu. As we have no idea which menu you're using, how do you expect us to help you ? Certainly, the code you're posting doesn't tell us anything.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
just a guess but you might want to try removing the
../
from the start of your src attributes..
... and I presume the < and > tags surrounding your code are just accidents...
Otherwise I have no idea.
|
|
|
|
|
hi
how can i find in the code if another form is open or not??
Regards
Nishkarsh
|
|
|
|
|
What do you mean by form ? Form defined in your app ? Another app altogether ? A specific form in another app altogether ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi...
by form i mean another form in the same application...(not MDI)
My application hase more then one form which i keep on hiding and showing...
|
|
|
|
|
Hi,
if you hide and show forms, you must have a reference to it, so look at myForm.Visible
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
i want a code for smart card in VB. the smart card is of campus card type like for library card, canteen card, ID card, attendence card...
So, the main problem is abt. interface bet. pc & reader.So if anybody have any idea abt. it or any code.plz provide...
cc@don
|
|
|
|
|
Do your own homework!
|
|
|
|
|
For such a sweet looking person, you have a real nasty streak in you. Do keep it up.
|
|
|
|
|
Hi,
I Have form in which I have 3 tabs.
The tabs should tougle based on the button click.
But if I press Ctrl+Tab or Ctrl+Shift+Tab, it still toggles.
How do I stop this using coding in Dot Net.
Regards,
Jantu.
Thanks and Regards,
|
|
|
|