Page 1 of 1 1
Topic Options
#169094 - 2006-10-09 07:29 PM Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Hi,

I have a problem deleting a File in KiXforms.NET.
Look at the next posts

Thanks


Edited by pvds (2006-10-09 08:29 PM)

Top
#169095 - 2006-10-09 08:11 PM Re: Need HELP!
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Hi, basically you can not post a question on another board and redirect users from this board to that board even if the boards are related. However if you post your question here as it partains to the code I'm sure most of the ppl here will help you.
Top
#169096 - 2006-10-09 08:17 PM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
APRONK,

Sorry I now I did wrong but I realy need this to be solved here is the origanal post.

Can someone help me to solve this!
After saving a jpg file I want to delete the original I use Dispose but somehow I am not lucky.

problem is in the SaveImage function

Please Help!

Code:
 Break On 

$Rect_Width = 100
$Rect_Height = 100
$Photo = @SCRIPTDIR + "\Foto\lara.jpg"
$New_PhotoPath = @SCRIPTDIR + "\Foto\"
$Empty_Photo = @SCRIPTDIR + "\Foto\Leeg2.jpg"

$System = CreateObject("Kixforms.System")

;$Bitmap = $System.Bitmap($Photo)


$Form = $System.Form
$Form.ClientWidth = 400
$Form.ClientHeight = 600

$Timer1 = $System.timer() ; Create a timer
$Timer1.Interval = 150
$Timer1.Tick = "Check_Photo()"

$Panel1 = $Form.Controls.Add($System.Panel())
$Panel1.Top = 0
$Panel1.Left = 0
$Panel1.Width = 400
$Panel1.Height = 400
$Panel1.BackColor = $System.Color.red
$Panel1.MouseMove = "PanelMouseMove($$System.Sender,$$System.EventArgs)"

$Button1 = $Form.Controls.Add($System.Button())
$Button1.Top = 410
$Button1.Left = 10
$Button1.Text = "Opslaan"
$Button1.Click = "SaveImage($MouseX, $MouseY)"
$Button1.Width = 150

$TextBox1 = $Form.Controls.Add($System.TextBox())
$TextBox1.Top = $Button1.Top + 30
$TextBox1.Left = $Button1.Left
$TextBox1.Text = Nummer

$Label1 = $Form.Controls.Add($System.Label())
$Label1.Top = $Button1.Top + 60
$Label1.Left = $Button1.Left
$Label1.Text = ""
$Label1.Width = 150

$Timer1.Start
;Draw_Rect(0 - $Rect_Width - 10,0)

$Form.Center
$Form.Show

While $Form.Visible
$= Execute($Form.DoEvents)
Loop
Exit 0

Function Draw_Rect($MouseX, $MouseY)
$Bitmap = $System.Bitmap($Photo);
$Plaatje = $System.Graphics.FromImage($Bitmap)
If ($Bitmap <> "")
$Plaatje.DrawRectangle($System.Pen($System.Color.DarkSlateBlue,3),$MouseX,$MouseY,$Rect_Width,$Rect_Height);
$Panel1.BackgroundImage = $Bitmap
$Bitmap = $System.Bitmap($Photo)
$Panel1.Refresh()
EndIf
EndFunction

Function PanelMouseMove($Sender,$EventArgs)
If ($Panel1.MouseButtons & $System.MouseButtons_Left)
$MouseY = $Panel1.MousePosition.y - $form.top - 20
$MouseX = $Panel1.MousePosition.x - $form.Left - $panel1.Left
Draw_Rect($MouseX, $MouseY)
EndIf
EndFunction

Function SaveImage($MouseX, $MouseY)

$check = Val($Textbox1.Text)

If $check = 0 Or Len($check) <> 6
$Label1.Text = "Invul Fout"
Else
If Exist($New_PhotoPath + $Textbox1.Text + ".jpg")
$Label1.Text = "Foto al aanwezig!"
Else
$Timer1.stop

$NewImage = $Bitmap.Clone($MouseX,$MouseY,$Rect_Width,$Rect_Height)
$NewImage.Save($New_PhotoPath + $TextBox1.Text + ".jpg")

$Label1.Text = "Opgeslagen: " + $TextBox1.Text
$TextBox1.Text = "Nummer"

;$System.Pen.Dispose
;? @ERROR

$Bitmap.Dispose
? @ERROR

$NewImage.Dispose
? @ERROR

Del $Photo
? @ERROR

$Panel1.Refresh()
$Timer1.start
EndIf
EndIf
EndFunction

Function Check_Photo()
If Dir($Photo) <> ""
$Timer1.Stop
Draw_Rect($MouseX, $MouseY)
Else
$Label1.Text = "Wacht"
EndIf
EndFunction



Edited by pvds (2006-10-09 10:39 PM)

Top
#169097 - 2006-10-09 09:22 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you not new.
but why don't you just use del?

Top
#169098 - 2006-10-09 09:44 PM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
He Jooel,

look at my script I use Del But it is not working error 32.
And this code make me not happy.

By the way what is your problem with the KiXforms.MSI is it asking for some kind of network volume?
I had this problem and eddited the MSI now it is installing fine could send you a coppy.

Kind Regards,
Peter

Top
#169099 - 2006-10-09 10:54 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I just experienced failed install today.
had to manually unreg and rereg the dll to make it work.
the msi is somehow screwed up.

Top
#169100 - 2006-10-09 11:11 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and the del is not working as you still have the image open.
del will work once you close it.

Top
#169101 - 2006-10-09 11:13 PM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
I do not know how to close the file tried almost everything but I realy do not have a clue.

Send you the MSI at your Gmail acc

Peter

Top
#169102 - 2006-10-09 11:19 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
try setting the $bitmap to 0.
Top
#169103 - 2006-10-09 11:24 PM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
No same result
Top
#169104 - 2006-10-09 11:27 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh, and just a note, you can't send msi's to gmail. it will get dropped. not even inside zip's
Top
#169105 - 2006-10-09 11:31 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
damn. just when typed that reply, it came through. weird. it shouldn't had.


anyways, what's wrong with this MSI?

Top
#169106 - 2006-10-09 11:33 PM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
I tried again.
Unzip and Rename

Top
#169107 - 2006-10-09 11:36 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what you tried?
Top
#169108 - 2006-10-09 11:40 PM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
I tried

$bitmap = ""
$bitmap = 0
$bitmap.Dispose

And sending you the MSI again

Top
#169109 - 2006-10-09 11:43 PM Re: Need HELP!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
then there is an issue with kixforms.
try setting the background image to something else.

wonder does kixforms hold to the file after the cloning.
that would sound odd, but possible.

anyways, I suggest you ask this on kforg/.net forum as you would get the best answer rate there.

Top
#169110 - 2006-10-09 11:54 PM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
I have pu a other bitmap as background image but the result stays the same. I ask on kforg/.net forum maby Shawn nows?

I have to get some sleep now.
Thanks,
Peter

Top
#169111 - 2006-10-10 09:37 AM Re: Need HELP!
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Apparantly this isn't a KixForms problem but a .Net problem I have a similar problem using VB.Net. Haven't figured it out yet either :/
Top
#169112 - 2006-10-13 05:13 AM Re: Need HELP!
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Quote:

Apparantly this isn't a KixForms problem but a .Net problem I have a similar problem using VB.Net. Haven't figured it out yet either :/




This ugly solution did the trick

Code:
 Do 
$Bitmap.dispose
$Panel1.BackgroundImage = $Orginal ; This is other bitmap
Del $photo
Until @ERROR = 0



Edited by pvds (2006-10-13 05:14 AM)

Top
#169113 - 2006-10-13 09:08 AM Re: Need HELP!
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Yeah thats basically what I did in VB, but it's indeed ugly for some reason .Net doesn't release used files.
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1452 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.077 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org