KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

copy a picture form camera into form

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
pvds
KiXforms Follower
KiXforms Follower


Joined: 01 Apr 2003
Posts: 19
Location: Netherlands

PostPosted: Mon Jul 09, 2007 8:19 am    Post subject: copy a picture form camera into form Reply with quote

HI,

When I explore "My Computer" when I connect a USB camera I can see this camera in the Scanner en Camera's section.

When I open the camara I can take a picture and I can copy this picture to my HD.
Is it posible to load this picture from the camera into a kixforms form?

Kind Regards,
Peter
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jul 09, 2007 1:19 pm    Post subject: Reply with quote

Here's one way to load a picture into a form.

Code:

Break On

$System = CreateObject("Kixforms.System")

$Form = $System.Form()
$Form.ClientWidth = 640
$Form.ClientHeight = 480
$Form.Closing = "Form_Closing()"
$Form.FontSize = 10
$Form.Text = "Picture Viewer"

$MainMenu = $System.MainMenu()

$FileMenu = $MainMenu.MenuItems.Add($System.MenuItem("File"))

$OpenMenu = $FileMenu.MenuItems.Add($System.MenuItem("Open..."))
$OpenMenu.Click = "OpenMenu_Click()"

$= $FileMenu.MenuItems.Add($System.MenuItem("-"))

$ExitMenu = $FileMenu.MenuItems.Add($System.MenuItem("Exit"))
$ExitMenu.Click = "ExitMenu_Click()"

$Form.Menu = $MainMenu

$PictureBox = $Form.Controls.Add($System.PictureBox())
$PictureBox.Dock = $System.DockStyle_Fill
$PictureBox.BackColor = $System.Color.Gray
$PictureBox.SizeMode = $System.PictureBoxSizeMode_CenterImage

$StatusBar1 = $Form.Controls.Add($System.StatusBar())

$OpenFileDialog = $System.OpenFileDialog()
$OpenFileDialog.Filter = "Picture Files|*.bmp;*.jpg;*.gif;*.png|All Files (*.*)|*.*"
$OpenFileDialog.DefaultExt = "kix"
$OpenFileDialog.InitialDirectory = @CURDIR

$Form.Center
$Form.Show

While $Form.Visible
   $=Execute($System.DoEvents)
Loop

Exit 0

Function Form_Closing()
 $e = $System.EventArgs
 $e.Cancel = 1
 $Form.Hide
EndFunction

Function ExitMenu_Click()
 $Form.Hide
EndFunction

Function OpenMenu_Click()

 If $OpenFileDialog.ShowDialog <> $System.DialogResult_Ok
  Return
 Endif

 $Bitmap = $System.Bitmap.FromFile($OpenFileDialog.FileName)

 $PictureBox.Image = $Bitmap

EndFunction
Back to top
View user's profile Send private message
pvds
KiXforms Follower
KiXforms Follower


Joined: 01 Apr 2003
Posts: 19
Location: Netherlands

PostPosted: Mon Jul 09, 2007 4:44 pm    Post subject: Reply with quote

Shawn,

It works fine Thanks.

Happy me Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group