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

Picturebox does not show the picture when code is ran......

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


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Wed Oct 19, 2005 6:27 pm    Post subject: Picturebox does not show the picture when code is ran...... Reply with quote

Maybe I'm just a dumbass.....who knows.
Did a form in KF.NET desinger and added a picturebox to a form. Added a picture to the picture box (.jpg/.bmp picture). Designer shows the picture but when i create the code and run it the picture is not there. The picturebox is but no picture in it.

Looked at the code and this is what the designer spits out. No reference to what picture to show and where to get it.
It was so easy in the "old KF" but cant get my brain around it now Crying or Very sad
Code:

Break On
$System = CreateObject("Kixforms.System")
If NOT $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf

$Form2 = $System.Form()
$Form2.Left = 0
$Form2.StartPosition = 0  ;FormStartPosition_Manual
$Form2.Size = $System.Size(608,434) ;(Width,Height)
$Form2.Text = "Form2"
$Form2.Top = 0


$PictureBox1 = $System.PictureBox()
$PictureBox1.BorderStyle = 1  ;FixedSingle
$PictureBox1.Height = 156
$PictureBox1.Left = 118
$PictureBox1.SizeMode = 1  ;StretchImage
$PictureBox1.Top = 111
$PictureBox1.Width = 324
$nul = $Form2.Controls.Add($PictureBox1)

$Form2.Show  ;Displays the Form

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

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Wed Oct 19, 2005 6:31 pm    Post subject: Reply with quote

;************* PictureBox1 **************
$PictureBox1 = $Form.Controls.PictureBox("PictureBox1", 0, 0, 300, 139)
$PictureBox1.BackColor = 255,255,255
$PictureBox1.BorderStyle = 0
$PictureBox1.Picture = 'AHCA-IT.bmp'
;**************************************
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Wed Oct 19, 2005 6:59 pm    Post subject: Reply with quote

This code errors out on two lines.

The firts line:
Error expected ')'

The second line:
Unknown command

This the way to add a picture to a picturebox in KF.NEt? Looks like "old kf".

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Wed Oct 19, 2005 7:08 pm    Post subject: Reply with quote

yep... this is the old way...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Wed Oct 19, 2005 7:13 pm    Post subject: Reply with quote

Damn Mad
Need it in the .NET way cause I'm building a little app in KF.NET.

And the search continues.......... Sad

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Oct 19, 2005 9:00 pm    Post subject: Reply with quote

Its still easy ...

$PictureBox1.Image = $System.Bitmap("filenname")
Back to top
View user's profile Send private message
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Wed Oct 19, 2005 9:07 pm    Post subject: Reply with quote

Yeeeeeeeha. Works great.
Tried searching in the documentation but failed.

Shawn you da man but you knew that already I guess.
Looking at the same code for some hours just got me all Stupid

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Oct 19, 2005 9:15 pm    Post subject: Reply with quote

lol, no probs ...

One thing is ... I can see why its confusing in the chm just how to do this. The PictureBox.Image property wants "an image" but it doesn't really say how to construct one - especially since you cant really construct "an image" per se. You can only construct a bitmap, which is "an image" (because it inherits from the Image class).

Anyway - the other thing is that now there are a few options for setting the image, like ...

$PictureBox.Image = $System.Bitmap("filename")

$PictureBox.Image = $System.Bitmap.FromFile("filename")

$PictureBox.Image = $System.Bitmap.FromBase64String("string")

$PictureBox.Image = $System.Bitmap.FromSize($System.Size(100,100))

and a few more to come I'm sure.
Back to top
View user's profile Send private message
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Thu Oct 20, 2005 7:37 am    Post subject: Reply with quote

Ok. Thanx for the info.

Ussed this one and no probs anymore. Picture shows perfectly.
Are there any pro's and con's to using BMP's or JPG's?

Code:

$PictureBox.Image = $System.Bitmap(@scriptdir + "\picture.jpg")

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
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