Page 1 of 1

Show picture from file T21C

Posted: Wed Aug 28, 2013 10:37 am
by Joe
Hi,

TA150 (T15B) ->

Code: Select all

Form form = (Form) this;
			string fName = @"\FlashDrive\Project\Project Files\Design1.png";
			Bitmap bMap = new Bitmap(fName);
			Image img = Image.FromHbitmap(bMap.GetHbitmap());
			
			PictureBox pb = new PictureBox();
			pb.Width = 258;
			pb.Height = 136;
			pb.Left = 2;
			pb.Top = 2;
			pb.SizeMode = PictureBoxSizeMode.StretchImage;
			pb.Image = img;
			form.Controls.Add(pb);
T21C with RunTime (WPF) -> ???

Something like this:

Code: Select all

string fName = @"m:\design1.bmp"; ?
BitmapImage Design = new BitmapImage(new Uri(fName)); ?
Thanks for reply

Regards

Joe

Re: Show picture from file T21C

Posted: Thu Aug 29, 2013 5:09 am
by Joe
Hi,

:?: How show picture from file in project for iX RunTime (T21C)?

This code does not work. What is wrong? ->

Code: Select all

void Screen1_Opened(System.Object sender, System.EventArgs e)
		{
			BitmapImage src = new BitmapImage();

			src.BeginInit();

			src.UriSource = new Uri(@"C:\Picture1.png");

			src.CacheOption = BitmapCacheOption.OnLoad;

			src.EndInit();
			
			Picture1.Source = src;
		}
Thanks for any reply

Joe

Re: Show picture from file T21C

Posted: Thu Aug 29, 2013 9:11 am
by mark.monroe
First add a Image control to your screen.
Snap 2013-08-29 at 09.07.05.jpg
Snap 2013-08-29 at 09.07.05.jpg (66.2 KiB) Viewed 8419 times
Snap 2013-08-29 at 09.07.31.jpg
Snap 2013-08-29 at 09.07.31.jpg (116.11 KiB) Viewed 8419 times
Next add an image control to your screen. Then put the below code in the screen event you want to use to trigger the image display:

Code: Select all

this.Image1.Source = new BitmapImage(new Uri(@"C:\Users\path\Desktop\screenshots\test.png"));
Snap 2013-08-29 at 09.08.14.jpg
Snap 2013-08-29 at 09.08.14.jpg (39.93 KiB) Viewed 8419 times

Re: Show picture from file T21C

Posted: Fri Aug 30, 2013 4:12 am
by Joe
Hi Mark,

thanks for the valuable advice ..

Ragards

Joe