Пример #1
0
		TabItem DrawOneFinalPage (GraphicsHandling GraphicsHandlingInstance, String PageID)
			{
			double TargetAspectRatio = GraphicsHandlingInstance.TargetPictureWidth / GraphicsHandlingInstance.TargetPictureHeight;
			double ResizingFactor = GraphicsHandlingInstance.TargetPictureWidth / DrawingWidth;
			Thickness BorderThickness = new Thickness ();
			BorderThickness.Left = 3;
			BorderThickness.Right = 3;
			BorderThickness.Top = 3;
			BorderThickness.Bottom = 3;
			BrushConverter BRConverter = new BrushConverter ();
			TabItem NewItem = new TabItem ();
			NewItem.ContextMenuOpening += new ContextMenuEventHandler (NewItem_ContextMenuOpening);
			NewItem.Tag = PageID;
			PicturesTabControl.Items.Add (NewItem);
			PicturesTabControl.SelectedItem = NewItem;
			int PageIndex = GraphicsHandlingInstance.PageIDsToPlay.FindIndex (delegate (String Entry)
			    { return (PageID == Entry); } );
			Grid TabItemGrid = m_XAML.CreateGrid (new int [] { 1 }, new int [] { 20, 1 });
			String PlayTime = " (" + GraphicsHandlingInstance.GetPageDuration (PageID).ToString () + ")";
			String PageName = "Seite " + Convert.ToString (PageIndex + 1) + PlayTime;
			NewItem.Content = TabItemGrid;

			NewItem.Header = PageName;

			Image JustifiedImage = new Image ();
			JustifiedImage.ContextMenuOpening += new ContextMenuEventHandler (JustifiedImage_ContextMenuOpening);
			RedrawInformation RedrawData = new RedrawInformation (PageID, ++PageIndex, JustifiedImage);
			JustifiedImage.Tag = RedrawData;
			BitmapSource ImageSource = GraphicsHandlingInstance.GetCreatedFrameBitmapSource (RedrawData);
			if (!String.IsNullOrEmpty (m_WebLinkData))
				{
				m_WebSizing.Width /= (float) ResizingFactor;
				m_WebSizing.Height /= (float) ResizingFactor;
				return NewItem;
				}
			JustifiedImage.BeginInit ();
			JustifiedImage.Source = ImageSource;
			JustifiedImage.Width = GraphicsHandlingInstance.TargetPictureWidth / ResizingFactor;
			JustifiedImage.EndInit ();
			Border ImageBorder = new Border ();
			TabItemGrid.Children.Add (ImageBorder);
			ImageBorder.BorderThickness = BorderThickness;
			ImageBorder.BorderBrush = (Brush) BRConverter.ConvertFromString ("Black");
			ImageBorder.Child = JustifiedImage;
			ImageBorder.Width = (GraphicsHandlingInstance.TargetPictureWidth / ResizingFactor) + BorderThickness.Left + BorderThickness.Right;
			ImageBorder.Height = (GraphicsHandlingInstance.TargetPictureHeight / ResizingFactor) + BorderThickness.Top + BorderThickness.Bottom;
			Grid.SetColumn (ImageBorder, 0);
			Grid.SetRow (ImageBorder, 0);

			Grid DescriptionTextGrid = m_XAML.CreateGrid (new int [] { 70, 30 }, new int [] { 10 });
			TabItemGrid.Children.Add (DescriptionTextGrid);
			Grid.SetColumn (DescriptionTextGrid, 0);
			Grid.SetRow (DescriptionTextGrid, 1);
			TextBox BasePictureText = new TextBox ();
			DescriptionTextGrid.Children.Add (BasePictureText);
			Grid.SetColumn (BasePictureText, 1);
			Grid.SetRow (BasePictureText, 0);
			BasePictureText.Text = "(" + Convert.ToString ((int) GraphicsHandlingInstance.TargetPictureWidth) + " * "
				+ Convert.ToString ((int) GraphicsHandlingInstance.TargetPictureHeight) + " - "
				+ String.Format ("{0:0.000}", GraphicsHandlingInstance.TargetPictureWidth 
				/ GraphicsHandlingInstance.TargetPictureHeight) + ") " + PageName;
			BasePictureText.TextAlignment = TextAlignment.Right;
			return NewItem;
			}