| ofs | hex dump | ascii |
|---|
| 0000 | ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 48 00 48 00 00 ff ed 1d e8 50 68 6f 74 6f 73 68 6f | ......JFIF.....H.H......Photosho |
| 0020 | 70 20 33 2e 30 00 38 42 49 4d 04 04 00 00 00 00 00 27 1c 01 5a 00 03 1b 25 47 1c 02 00 00 02 00 | p.3.0.8BIM.......'..Z...%G...... |
| 0040 | 00 1c 02 37 00 08 32 30 31 31 31 31 30 37 1c 02 3c 00 06 31 36 32 31 34 38 00 38 42 49 4d 04 25 | ...7..20111107..<..162148.8BIM.% |
| 0060 | 00 00 00 00 00 10 8c a6 f6 40 eb 03 cf 11 31 2a 1d f0 ba 3e ac d8 38 42 49 4d 04 3a 00 00 00 00 | .........@....1*...>..8BIM.:.... |
| 0080 | 00 8f 00 00 00 10 00 00 00 01 00 00 00 00 00 0b 70 72 69 6e 74 4f 75 74 70 75 74 00 00 00 04 00 | ................printOutput..... |
| 00a0 | 00 00 00 50 73 74 53 62 6f 6f 6c 01 00 00 00 00 49 6e 74 65 65 6e 75 6d 00 00 00 00 49 6e 74 65 | ...PstSbool.....Inteenum....Inte |
| 00c0 | 00 00 00 00 43 6c 72 6d 00 00 00 0f 70 72 69 6e 74 53 69 78 74 65 65 6e 42 69 74 62 6f 6f 6c 00 | ....Clrm....printSixteenBitbool. |
| 00e0 | 00 00 00 0b 70 72 69 6e 74 65 72 4e 61 6d 65 54 45 58 54 00 00 00 0d 00 4c 00 65 00 78 00 6d 00 | ....printerNameTEXT.....L.e.x.m. |
| 0100 | 61 00 72 00 6b 00 20 00 43 00 35 00 31 00 30 00 00 00 38 42 49 4d 04 3b 00 00 00 00 01 b2 00 00 | a.r.k...C.5.1.0...8BIM.;........ |
| 0120 | 00 10 00 00 00 01 00 00 00 00 00 12 70 72 69 6e 74 4f 75 74 70 75 74 4f 70 74 69 6f 6e 73 00 00 | ............printOutputOptions.. |
| 0140 | 00 12 00 00 00 00 43 70 74 6e 62 6f 6f 6c 00 00 00 00 00 43 6c 62 72 62 6f 6f 6c 00 00 00 00 00 | ......Cptnbool.....Clbrbool..... |
| 0160 | 52 67 73 4d 62 6f 6f 6c 00 00 00 00 00 43 72 6e 43 62 6f 6f 6c 00 00 00 00 00 43 6e 74 43 62 6f | RgsMbool.....CrnCbool.....CntCbo |
| 0180 | 6f 6c 00 00 00 00 00 4c 62 6c 73 62 6f 6f 6c 00 00 00 00 00 4e 67 74 76 62 6f 6f 6c 00 00 00 00 | ol.....Lblsbool.....Ngtvbool.... |
| 01a0 | 00 45 6d 6c 44 62 6f 6f 6c 00 00 00 00 00 49 6e 74 72 62 6f 6f 6c 00 00 00 00 00 42 63 6b 67 4f | .EmlDbool.....Intrbool.....BckgO |
| 01c0 | 62 6a 63 00 00 00 01 00 00 00 00 00 00 52 47 42 43 00 00 00 03 00 00 00 00 52 64 20 20 64 6f 75 | bjc......using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.SharedUI.Helpers;
namespace Tango.MachineStudio.Common.Controls
{
/// <summary>
/// Represents an MDI-style container
/// </summary>
/// <seealso cref="System.Windows.Controls.UserControl" />
/// <seealso cref="System.Windows.Markup.IComponentConnector" />
/// <seealso cref="System.Windows.Markup.IStyleConnector" />
public partial class MdiContainerControl : UserControl
{
private const int MIN_SIZE = 200;
public MdiContainerControl()
{
InitializeComponent();
}
public IEnumerable ItemsSource
{
get { return (IEnumerable)GetValue(ItemsSourceProperty); }
set { SetValue(ItemsSourceProperty, value); }
}
public static readonly DependencyProperty ItemsSourceProperty =
DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(MdiContainerControl), new PropertyMetadata(null));
private void OnControlDragging(object sender, DragDeltaEventArgs e)
{
var mdiControl = GetSenderTag<MdiChild>(sender);
mdiControl.Location = new Point(mdiControl.Location.X + e.HorizontalChange, mdiControl.Location.Y + e.VerticalChange);
FitCanvas();
}
private T GetSenderTag<T>(object sender) where T : class
{
return (T)((sender as FrameworkElement).Tag);
}
private void FitCanvas()
{
Canvas canvas = GetCanvas();
canvas.Width = canvas.Children.OfType<FrameworkElement>().Max(x => Canvas.GetLeft(x) + x.ActualWidth);
canvas.Height = canvas.Children.OfType<FrameworkElement>().Max(x => Canvas.GetTop(x) + x.ActualHeight);
}
private Canvas GetCanvas()
{
return itemsControl.FindChild<Canvas>("canvas");
}
private void OnControlMouseDown(object sender, MouseButtonEventArgs e)
{
Canvas.SetZIndex(sender as FrameworkElement, GetCanvas().Children.OfType<FrameworkElement>().Max(x => Canvas.GetZIndex(x) + 1));
}
private void OnControlSizeRight(object sender, DragDeltaEventArgs e)
{
var mdiControl = GetSenderTag<MdiChild>(sender);
if (double.IsNaN(mdiControl.View.Width)) mdiControl.View.Width = mdiControl.View.ActualWidth;
if (mdiControl.View.Width + e.HorizontalChange > MIN_SIZE) mdiControl.View.Width += e.HorizontalChange;
}
private void OnControlSizeBottom(object sender, DragDeltaEventArgs e)
{
var mdiControl = GetSenderTag<MdiChild>(sender);
if (double.IsNaN(mdiControl.View.Height)) mdiControl.View.Height = mdiControl.View.ActualHeight;
if (mdiControl.View.Height + e.VerticalChange > MIN_SIZE) mdiControl.View.Height += e.VerticalChange;
}
private void OnControlResize(object sender, DragDeltaEventArgs e)
{
var mdiControl = GetSenderTag<MdiChild>(sender);
if (double.IsNaN(mdiControl.View.Height)) mdiControl.View.Height = mdiControl.View.ActualHeight;
if (double.IsNaN(mdiControl.View.Width)) mdiControl.View.Width = mdiControl.View.ActualWidth;
if (mdiControl.View.Height + e.VerticalChange > MIN_SIZE) mdiControl.View.Height += e.VerticalChange;
if (mdiControl.View.Width + e.HorizontalChange > MIN_SIZE) mdiControl.View.Width += e.HorizontalChange;
}
private void OnControlClosed(object sender, RoutedEventArgs e)
{
(ItemsSource as IList).Remove(GetSenderTag<MdiChild>(sender));
}
}
}
|