Show picture from file T21C

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
Joe
Posts: 27
Joined: Tue Sep 18, 2012 4:53 am

Show picture from file T21C

Post 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

Joe
Posts: 27
Joined: Tue Sep 18, 2012 4:53 am

Re: Show picture from file T21C

Post 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

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Show picture from file T21C

Post 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 8122 times
Snap 2013-08-29 at 09.07.31.jpg
Snap 2013-08-29 at 09.07.31.jpg (116.11 KiB) Viewed 8122 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 8122 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Joe
Posts: 27
Joined: Tue Sep 18, 2012 4:53 am

Re: Show picture from file T21C

Post by Joe »

Hi Mark,

thanks for the valuable advice ..

Ragards

Joe

Post Reply