void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.btnClear = ((System.Windows.Controls.Button)(target)); #line 17 "..\..\MainWindow.xaml" this.btnClear.Click += new System.Windows.RoutedEventHandler(this.btnClear_Click); #line default #line hidden return; case 2: this.MatchPercentage = ((System.Windows.Controls.Label)(target)); return; case 3: this.icSelected = ((System.Windows.Controls.InkCanvas)(target)); return; case 4: this.imgCapturedImage = ((System.Windows.Controls.Image)(target)); return; case 5: this.imgSelected = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myCanvas = ((System.Windows.Controls.Canvas)(target)); return; case 2: this.myImage = ((System.Windows.Controls.Image)(target)); return; case 3: this.myInkCanvas = ((System.Windows.Controls.InkCanvas)(target)); return; case 4: #line 20 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myInkCanvas = ((System.Windows.Controls.InkCanvas)(target)); #line 8 "..\..\Window1.xaml" this.myInkCanvas.Gesture += new System.Windows.Controls.InkCanvasGestureEventHandler(this.OnGesture); #line default #line hidden #line 8 "..\..\Window1.xaml" this.myInkCanvas.Loaded += new System.Windows.RoutedEventHandler(this.onLoaded); #line default #line hidden #line 8 "..\..\Window1.xaml" this.myInkCanvas.StrokeCollected += new System.Windows.Controls.InkCanvasStrokeCollectedEventHandler(this.onStrokeCollected); #line default #line hidden #line 8 "..\..\Window1.xaml" this.myInkCanvas.StrokeErasing += new System.Windows.Controls.InkCanvasStrokeErasingEventHandler(this.onStrokeErasing); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\..\..\Views\UserControls\UserControl_Passive.xaml" ((Prototype_Heacy_client.Views.UserControls.UserControl_Passive)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden return; case 2: this.InfoBar = ((System.Windows.Controls.Grid)(target)); return; case 3: this.PassiveCanvas = ((System.Windows.Controls.InkCanvas)(target)); return; case 4: this.PassiveCanvasPath = ((System.Windows.Shapes.Path)(target)); return; } this._contentLoaded = true; }
//В конструкторе осуществляется настройка параметров InkCanvas public Draw(InkCanvas surface) { this.Surface = surface; Surface.EditingMode = InkCanvasEditingMode.None; Surface.UseCustomCursor = true; Surface.Cursor = Cursors.Arrow; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.selection = ((System.Windows.Controls.Button)(target)); #line 11 "..\..\MainWindow.xaml" this.selection.Click += new System.Windows.RoutedEventHandler(this.selection_Click); #line default #line hidden return; case 2: this.drawing = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\MainWindow.xaml" this.drawing.Click += new System.Windows.RoutedEventHandler(this.drawing_Click); #line default #line hidden return; case 3: this.inkcanvas = ((System.Windows.Controls.InkCanvas)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Visualize answer sheet /// </summary> /// <param name="filePath">Path to answer data file</param> /// <param name="inkCanvas">Stroke drawing canvas</param> /// <param name="answerStepGraphCanvas">Answer step graph drawing canvas</param> /// <param name="showAnswerStepGraph">Draw answer step graph</param> /// <param name="colorAnswerSteps">Color strokes by each answer step</param> /// <param name="showAnswerStepBox">Draw bounding box of answer step</param> public void VisualizeAnswerSheet(string filePath, InkCanvas inkCanvas, Canvas answerStepGraphCanvas, bool showAnswerStepGraph = false, bool colorAnswerSteps = false, bool showAnswerStepBox = false) { List<AnalysisPenStroke> strokes = this.analyzer.LoadStrokesFromFile(filePath); inkCanvas.Strokes.Clear(); answerStepGraphCanvas.Children.Clear(); List<AnswerStep> ansGroupList = this.analyzer.GroupAnswerStep(strokes); if (colorAnswerSteps) { ColorAnswerGroupStrokes(ansGroupList, inkCanvas); } else { ColorAnswerGroupStrokes(ansGroupList, inkCanvas, true); } if (showAnswerStepBox) { VisualizeAnswerGroupBoundingBox(ansGroupList, answerStepGraphCanvas); } if (showAnswerStepGraph) { DrawAnswerGroupGraph(ansGroupList, answerStepGraphCanvas); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 4 "..\..\..\MainWindow.xaml" ((B410315508.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.ink1 = ((System.Windows.Controls.InkCanvas)(target)); return; case 3: this.button1 = ((System.Windows.Controls.Button)(target)); #line 8 "..\..\..\MainWindow.xaml" this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click); #line default #line hidden return; case 4: this.wrapPanel1 = ((System.Windows.Controls.WrapPanel)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 11 "..\..\MainWindow.xaml" ((KinectDrawing.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: this.camera = ((System.Windows.Controls.Image)(target)); return; case 3: this.canvas = ((System.Windows.Controls.Canvas)(target)); return; case 4: this.trail = ((System.Windows.Controls.InkCanvas)(target)); return; case 5: this.textBox = ((System.Windows.Controls.TextBox)(target)); return; } this._contentLoaded = true; }
public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { var p = e.GetPosition(inkCanvas); if (p != point) { point = p; GetBrush(pts, (s) => { if (StrokeResult != null) inkCanvas.Strokes.Remove(StrokeResult); DrawingAttributes drawingAttributes = new DrawingAttributes { Color = inkCanvas.DefaultDrawingAttributes.Color, Width = inkCanvas.DefaultDrawingAttributes.Width, StylusTip = StylusTip.Ellipse, IgnorePressure = true, FitToCurve = true }; StrokeResult = new BrushStroke(s, drawingAttributes); inkCanvas.Strokes.Add(StrokeResult); } ); } } }
public override void OnMouseMove(System.Windows.Controls.InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { bottomRight = e.GetPosition(inkCanvas); if (topLeft != bottomRight) { StylusPointCollection pts = new StylusPointCollection(); GetTriangle(pts, (s) => { if (StrokeResult != null) { inkCanvas.Strokes.Remove(StrokeResult); } DrawingAttributes drawingAttributes = new DrawingAttributes { Color = inkCanvas.DefaultDrawingAttributes.Color, Width = inkCanvas.DefaultDrawingAttributes.Width, StylusTip = StylusTip.Ellipse, IgnorePressure = true, FitToCurve = true }; var BackgroundColor = inkCanvas.DefaultDrawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor); drawingAttributes.AddPropertyData(DrawAttributesGuid.BackgroundColor, BackgroundColor); StrokeResult = new TriangleStroke(s, drawingAttributes); inkCanvas.Strokes.Add(StrokeResult); } ); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.inkBoard = ((System.Windows.Controls.InkCanvas)(target)); #line 11 "..\..\SurfaceWindow1.xaml" this.inkBoard.AddHandler(Microsoft.Surface.Presentation.Contacts.PreviewContactDownEvent, new Microsoft.Surface.Presentation.ContactEventHandler(this.onContactDown)); #line default #line hidden #line 11 "..\..\SurfaceWindow1.xaml" this.inkBoard.AddHandler(Microsoft.Surface.Presentation.Contacts.PreviewContactUpEvent, new Microsoft.Surface.Presentation.ContactEventHandler(this.onContactUp)); #line default #line hidden #line 12 "..\..\SurfaceWindow1.xaml" this.inkBoard.AddHandler(Microsoft.Surface.Presentation.Contacts.PreviewContactChangedEvent, new Microsoft.Surface.Presentation.ContactEventHandler(this.onContactDown)); #line default #line hidden return; case 2: this.iCapturedFrame = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.parentStack = ((System.Windows.Controls.StackPanel)(target)); return; case 2: this.menuStack = ((System.Windows.Controls.StackPanel)(target)); return; case 3: this.btnSave = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\MainWindow.xaml" this.btnSave.Click += new System.Windows.RoutedEventHandler(this.BtnSave_Click); #line default #line hidden return; case 4: this.inkCanvas1 = ((System.Windows.Controls.InkCanvas)(target)); return; } this._contentLoaded = true; }
private InkCanvasAnnotation( Point textLocation, InkCanvas InkCanvas) { if (InkCanvas == null) throw new ArgumentNullException("InkCanvas"); _InkCanvas = InkCanvas; this.HookInkCanvasEvents(true); Size InkCanvasSize = _InkCanvas.RenderSize; if (InkCanvasSize.Height == 0 || InkCanvasSize.Width == 0) throw new ArgumentException("InkCanvas has invalid dimensions"); // Determine the relative location of the TextBlock. _horizPercent = textLocation.X / InkCanvasSize.Width; _vertPercent = textLocation.Y / InkCanvasSize.Height; // Create the adorner which displays the annotation. _adorner = new InkCanvasAnnotationAdorner( this, _InkCanvas, textLocation); this.InstallAdorner(); }
public void CreateStackMoveDelta() { var canvas = new InkCanvas(); var contentBuffer = new ContentBuffer(); var moveDeltaProcessor = new StackMoveDeltaProcessor(canvas, contentBuffer, "presentationSpace"); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.inkCanvas1 = ((System.Windows.Controls.InkCanvas)(target)); return; case 2: this.btnSaveImage = ((System.Windows.Controls.Button)(target)); #line 19 "..\..\..\MainWindow.xaml" this.btnSaveImage.Click += new System.Windows.RoutedEventHandler(this.btnSaveInkCanvas); #line default #line hidden return; case 3: this.resultText = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.btnClearImage = ((System.Windows.Controls.Button)(target)); #line 23 "..\..\..\MainWindow.xaml" this.btnClearImage.Click += new System.Windows.RoutedEventHandler(this.btnSaveImage_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\..\WinDraw4.xaml" ((PenDemo.WinDraw4)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: this.ic = ((System.Windows.Controls.InkCanvas)(target)); return; case 3: this.btnClear = ((System.Windows.Controls.Button)(target)); return; case 4: this.btnReplay = ((System.Windows.Controls.Button)(target)); return; } this._contentLoaded = true; }
public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { endPoint = e.GetPosition(inkCanvas); if (startPoint != endPoint) { StylusPointCollection pts = new StylusPointCollection(); GetLine(pts, (s) => { if (StrokeResult != null) inkCanvas.Strokes.Remove(StrokeResult); DrawingAttributes drawingAttributes = new DrawingAttributes { Color = inkCanvas.DefaultDrawingAttributes.Color, Width = inkCanvas.DefaultDrawingAttributes.Width, StylusTip = StylusTip.Ellipse, IgnorePressure = true, FitToCurve = true }; StrokeResult = new ArrowLineStroke(s, drawingAttributes); inkCanvas.Strokes.Add(StrokeResult); } ); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.CanvasDeTinta = ((System.Windows.Controls.InkCanvas)(target)); return; case 2: #line 20 "..\..\..\InkRecogDemo\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 3: this.textBox = ((System.Windows.Controls.TextBox)(target)); return; case 4: this.Recognize = ((System.Windows.Controls.Button)(target)); #line 26 "..\..\..\InkRecogDemo\MainWindow.xaml" this.Recognize.Click += new System.Windows.RoutedEventHandler(this.Recognize_Click); #line default #line hidden return; } this._contentLoaded = true; }
protected static void AddControl(IDiagram buttonHolder, InkCanvas parentControl) { var ret = new FlexButton.FlexButton { DataContext = buttonHolder, ContextMenu = ButtonContextMenu }; ret.CommandParameter = buttonHolder; parentControl.Children.Add(ret); var heightBinding = new Binding("Height") { Source = buttonHolder, Mode = BindingMode.TwoWay }; var widthBinding = new Binding("Width") { Source = buttonHolder, Mode = BindingMode.TwoWay }; var xBinding = new Binding("X") { Source = buttonHolder, Mode = BindingMode.TwoWay }; var yBinding = new Binding("Y") { Source = buttonHolder, Mode = BindingMode.TwoWay }; var captionBinding = new Binding("Caption") { Source = buttonHolder, Mode = BindingMode.TwoWay }; var radiusBinding = new Binding("CornerRadius") { Source = buttonHolder, Mode = BindingMode.TwoWay }; var buttonColorBinding = new Binding("ButtonColor") { Source = buttonHolder, Mode = BindingMode.TwoWay }; var commandBinding = new Binding("Command") { Source = buttonHolder, Mode = BindingMode.OneWay }; var enabledBinding = new Binding("IsEnabled") { Source = buttonHolder, Mode = BindingMode.OneWay }; var transformBinding = new Binding("RenderTransform") { Source = buttonHolder, Mode = BindingMode.OneWay }; ret.SetBinding(LeftProperty, xBinding); ret.SetBinding(TopProperty, yBinding); ret.SetBinding(HeightProperty, heightBinding); ret.SetBinding(WidthProperty, widthBinding); ret.SetBinding(ContentControl.ContentProperty, captionBinding); ret.SetBinding(FlexButton.FlexButton.CornerRadiusProperty, radiusBinding); ret.SetBinding(FlexButton.FlexButton.ButtonColorProperty, buttonColorBinding); ret.SetBinding(ButtonBase.CommandProperty, commandBinding); ret.SetBinding(RenderTransformProperty, transformBinding); ret.SetBinding(IsEnabledProperty, enabledBinding); }
/// <summary> /// Visualize answer sheet comparison /// </summary> /// <param name="filePath1">Path to answer 1 file</param> /// <param name="filePath2">Path to answer 2 file</param> /// <param name="inkCanvas1">Stroke drawing canvas of answer 1</param> /// <param name="inkCanvas2">Stroke drawing canvas of answer 2</param> /// <param name="graphCanvas">Answer step graph drawing canvas</param> /// <param name="colorAnswerSteps">Color strokes by each answer step</param> public void VisualizeAnswerSheetComparison(string filePath1, string filePath2, InkCanvas inkCanvas1, InkCanvas inkCanvas2, Canvas graphCanvas, bool colorAnswerSteps = false) { List<AnalysisPenStroke> strokes1 = this.analyzer.LoadStrokesFromFile(filePath1); List<AnalysisPenStroke> strokes2 = this.analyzer.LoadStrokesFromFile(filePath2); inkCanvas1.Strokes.Clear(); inkCanvas2.Strokes.Clear(); graphCanvas.Children.Clear(); List<AnswerStep> ansGroupList1 = this.analyzer.GroupAnswerStep(strokes1); List<AnswerStep> ansGroupList2 = this.analyzer.GroupAnswerStep(strokes2); if (colorAnswerSteps) { ColorAnswerGroupStrokes(ansGroupList1, inkCanvas1); ColorAnswerGroupStrokes(ansGroupList2, inkCanvas2); } else { ColorAnswerGroupStrokes(ansGroupList1, inkCanvas1, true); ColorAnswerGroupStrokes(ansGroupList2, inkCanvas2, true); } VisualizeAnswerGroupBoundingBox(ansGroupList1, graphCanvas); VisualizeAnswerGroupBoundingBox(ansGroupList2, graphCanvas, new Point(Config.OutputCanvasWidth, 0)); DPMatchingResult matchingResult = this.analyzer.CalcAnswerProcessSimilarity(ansGroupList1, ansGroupList2); VisualizeMatchingResult(ansGroupList1, ansGroupList2, matchingResult, graphCanvas, new Point(Config.OutputCanvasWidth, 0)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.InkPad = ((InkPad.MainWindow)(target)); return; case 2: this.inkCanvas1 = ((System.Windows.Controls.InkCanvas)(target)); return; case 3: this.button1 = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\MainWindow.xaml" this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click); #line default #line hidden return; case 4: this.button2 = ((System.Windows.Controls.Button)(target)); #line 13 "..\..\MainWindow.xaml" this.button2.Click += new System.Windows.RoutedEventHandler(this.button2_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\MainWindow.xaml" ((MakeImageCensored.MainWindow)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown); #line default #line hidden return; case 2: this.CanvasBorder = ((System.Windows.Controls.Border)(target)); return; case 3: this.inkCanvas = ((System.Windows.Controls.InkCanvas)(target)); return; case 4: #line 15 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Btn_Open); #line default #line hidden return; case 5: #line 16 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Btn_Clear); #line default #line hidden return; case 6: #line 17 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Btn_Process); #line default #line hidden return; case 7: #line 18 "..\..\MainWindow.xaml" ((System.Windows.Controls.TextBox)(target)).TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TextBox_TextChanged); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 7 "..\..\..\View\EditorViewMinimal.xaml" ((CalicoMock.EditorViewMinimal)(target)).Closed += new System.EventHandler(this.Window_Closed); #line default #line hidden #line 8 "..\..\..\View\EditorViewMinimal.xaml" ((CalicoMock.EditorViewMinimal)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden #line 9 "..\..\..\View\EditorViewMinimal.xaml" ((CalicoMock.EditorViewMinimal)(target)).Activated += new System.EventHandler(this.Window_Activated); #line default #line hidden return; case 2: this.MainGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.icCanvas = ((System.Windows.Controls.InkCanvas)(target)); #line 31 "..\..\..\View\EditorViewMinimal.xaml" this.icCanvas.SelectionChanged += new System.EventHandler(this.inkCanvas_SelectionChanged); #line default #line hidden #line 32 "..\..\..\View\EditorViewMinimal.xaml" this.icCanvas.StrokeCollected += new System.Windows.Controls.InkCanvasStrokeCollectedEventHandler(this.inkCanvas_StrokeCollected); #line default #line hidden #line 33 "..\..\..\View\EditorViewMinimal.xaml" this.icCanvas.StrokeErasing += new System.Windows.Controls.InkCanvasStrokeErasingEventHandler(this.inkCanvas_StrokeErasing); #line default #line hidden #line 34 "..\..\..\View\EditorViewMinimal.xaml" this.icCanvas.SelectionMoved += new System.EventHandler(this.inkCanvas_SelectionMoved); #line default #line hidden return; } this._contentLoaded = true; }
private void WpfPaintHost() { System.Windows.Controls.InkCanvas wpfCanvas = new System.Windows.Controls.InkCanvas(); wpfCanvas.EditingMode = InkCanvasEditingMode.InkAndGesture; elementHost1.Dock = DockStyle.Fill; elementHost1.Child = wpfCanvas; dataGridView2.Controls.Add(elementHost1); }
// REFACTOR THIS TO A STATIC CLASS public DrawingCanvasHelper(SessionManager _activeSessionManager, InkCanvas _PageInkCanvas, ScatterView _Container, Ellipse _CurrentColor, Image _ColorWheel) { this.ActiveSessionManager = _activeSessionManager; this.PageInkCanvas = _PageInkCanvas; this.Container = _Container; this.CurrentColor = _CurrentColor; this.ColorWheel = _ColorWheel; }
public static void LoadImage(InkCanvas inkCanvas) { var image = LoadImage(); if (image != null) { inkCanvas.Children.Add(image); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.wind = ((lab3_12.MainWindow)(target)); return; case 2: this.RadioButton_Ink = ((System.Windows.Controls.RadioButton)(target)); return; case 3: this.RadioButton_Select = ((System.Windows.Controls.RadioButton)(target)); return; case 4: this.RadioButton_EraseByStroke = ((System.Windows.Controls.RadioButton)(target)); return; case 6: #line 39 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click_1); #line default #line hidden return; case 7: #line 40 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click); #line default #line hidden return; case 8: this.inkcanvas1 = ((System.Windows.Controls.InkCanvas)(target)); return; case 9: this.combobox1 = ((System.Windows.Controls.ComboBox)(target)); return; case 10: this.slider1 = ((System.Windows.Controls.Slider)(target)); #line 61 "..\..\MainWindow.xaml" this.slider1.PreviewMouseUp += new System.Windows.Input.MouseButtonEventHandler(this.slider1_PreviewMouseUp); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 13 "..\..\Client.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute_1); #line default #line hidden #line 13 "..\..\Client.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed_1); #line default #line hidden return; case 2: #line 15 "..\..\Client.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute_1); #line default #line hidden #line 15 "..\..\Client.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed_3); #line default #line hidden return; case 3: this.border = ((System.Windows.Controls.Border)(target)); return; case 4: this.caption = ((System.Windows.Controls.DockPanel)(target)); #line 24 "..\..\Client.xaml" this.caption.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.DragMoveWindow); #line default #line hidden return; case 5: this.canvas = ((System.Windows.Controls.InkCanvas)(target)); return; case 6: this.board = ((BoardControls.BoardTextBox)(target)); return; } this._contentLoaded = true; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); canvas = GetTemplateChild("Canvas") as InkCanvas; paintButton = GetTemplateChild("PaintBtn") as Button; clearButton = GetTemplateChild("ClearBtn") as Button; paintButton.Click += PaintButtonOnClick; clearButton.Click += ClearButtonOnClick; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.canvas1 = ((System.Windows.Controls.InkCanvas)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.inkCanvas1 = ((System.Windows.Controls.InkCanvas)(target)); return; } this._contentLoaded = true; }
public SelectAdorner(InkCanvas inkCanvas, Point? dragStartPoint) : base(inkCanvas) { this.inkCanvas = inkCanvas; this.startPoint = dragStartPoint; this.endPoint = Mouse.GetPosition(inkCanvas); pen = new Pen(Brushes.LightSlateGray, 1); pen.DashStyle = new DashStyle(new double[] { 2 }, 1); }
//will probably make this multiple canvases public void Recompose(InkCanvas inkCanvas) { this.inkCanvas = inkCanvas; timer = new DispatcherTimer(); CreateStroke(); timer.Interval = new TimeSpan(0, 0, 0, 0, 10); timer.Tick += Timer_Tick; timer.Start(); }
public static void ApplyTextModifications(Text txt, InkCanvas canvas) { txt.TextContent = txt.TextContent.ToUpper(); txt.TextSize = 72; txt.FontWeight = FontWeights.Bold; Text.SetTxtWidthAndHeight(txt); var position = canvas.CanvasTopCenterCoordinates(txt.Width, txt.Height); canvas.SetObjectPositionOnCanvas(txt, position.X, position.Y); }
//------------------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------------------- #region Constructors /// <summary> /// InkCanvasSelection has an internal constructor to prevent direct instantiation /// </summary> /// <param name="inkCanvas">inkCanvas</param> internal InkCanvasSelection(InkCanvas inkCanvas) { //validate if (inkCanvas == null) { throw new ArgumentNullException("inkCanvas"); } _inkCanvas = inkCanvas; _inkCanvas.FeedbackAdorner.UpdateBounds(Rect.Empty); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyTabControl = ((System.Windows.Controls.TabControl)(target)); return; case 2: this.InkToolBar = ((System.Windows.Controls.ToolBar)(target)); return; case 3: this.inkRadio = ((System.Windows.Controls.RadioButton)(target)); return; case 4: this.eraseRadio = ((System.Windows.Controls.RadioButton)(target)); return; case 5: this.selectRadio = ((System.Windows.Controls.RadioButton)(target)); return; case 6: this.comboColors = ((System.Windows.Controls.ComboBox)(target)); return; case 7: this.btnSave = ((System.Windows.Controls.Button)(target)); return; case 8: this.btnLoad = ((System.Windows.Controls.Button)(target)); return; case 9: this.btnClear = ((System.Windows.Controls.Button)(target)); return; case 10: this.MyInkCanvas = ((System.Windows.Controls.InkCanvas)(target)); return; case 11: this.mySB = ((System.Windows.Controls.Primitives.ScrollBar)(target)); return; case 12: this.labelSBThumb = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
public TouchRecognizeAutomata(InkCanvas canvas) { _Canvas = canvas; _modeRecognizer = new TouchModeRecognizer(canvas); _modeRecognizer.IsEnableCollect = true; canvas.PreviewTouchDown += new EventHandler<TouchEventArgs>(canvas_PreviewTouchDown); canvas.PreviewTouchMove += new EventHandler<TouchEventArgs>(canvas_PreviewTouchMove); canvas.PreviewTouchUp += new EventHandler<TouchEventArgs>(canvas_PreviewTouchUp); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.inkcanvas_C = ((Good_Teacher.Controls.InkCanvas_Control)(target)); return; case 2: this.inkCanvas = ((System.Windows.Controls.InkCanvas)(target)); return; case 3: this.Rect_BackColor = ((System.Windows.Shapes.Rectangle)(target)); return; case 4: #line 23 "..\..\..\Controls\InkCanvas_Control.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonColor_Click); #line default #line hidden return; case 5: this.CB_PaintSize = ((System.Windows.Controls.ComboBox)(target)); #line 27 "..\..\..\Controls\InkCanvas_Control.xaml" this.CB_PaintSize.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.CB_PaintSize_SelectionChanged); #line default #line hidden return; case 6: this.Button_Draw = ((Good_Teacher.Controls.SelectButton)(target)); return; case 7: this.Button_Eraser = ((Good_Teacher.Controls.SelectButton)(target)); return; case 8: this.Button_ExportOut = ((Good_Teacher.Controls.FlatButton)(target)); return; case 9: this.Button_EraseAll = ((Good_Teacher.Controls.FlatButton)(target)); return; } this._contentLoaded = true; }
//private void InkCanvas_MouseDown(object sender, MouseButtonEventArgs e) //{ // if (e.ButtonState == MouseButtonState.Pressed) // currentPoint = e.GetPosition(this); // if (_shape == "arrow") // { // _startPoint = e.GetPosition(this); // } //} private void btnClear_Click(object sender, RoutedEventArgs e) { cvs.Children.Clear(); InkCanvas inkCanvas = new InkCanvas(); inkCanvas.Name = "InkCanvas"; inkCanvas.Background = Brushes.White; inkCanvas.Opacity = .01; inkCanvas.Height = System.Windows.SystemParameters.PrimaryScreenHeight; inkCanvas.Width = System.Windows.SystemParameters.PrimaryScreenWidth; Mouse.OverrideCursor = Cursors.Arrow; cvs.Children.Add(inkCanvas); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 16 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_Ellipse); #line default #line hidden return; case 2: #line 19 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_Rectangle); #line default #line hidden return; case 3: #line 22 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_Line); #line default #line hidden return; case 4: #line 25 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_Triangle); #line default #line hidden return; case 5: this.can = ((System.Windows.Controls.InkCanvas)(target)); #line 29 "..\..\..\MainWindow.xaml" this.can.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.can_MouseDown); #line default #line hidden return; } this._contentLoaded = true; }
//------------------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------------------- #region Constructors /// <summary> /// Constructor /// </summary> /// <param name="editingCoordinator">EditngCoordinator instance</param> /// <param name="inkCanvas">InkCanvas instance</param> internal EditingBehavior(EditingCoordinator editingCoordinator, InkCanvas inkCanvas) { if (inkCanvas == null) { throw new ArgumentNullException("inkCanvas"); } if (editingCoordinator == null) { throw new ArgumentNullException("editingCoordinator"); } _inkCanvas = inkCanvas; _editingCoordinator = editingCoordinator; }
public InkCanvasAnnotationAdorner( InkCanvasAnnotation InkCanvasAnnotation, InkCanvas adornedInkCanvas, Point location) : base(adornedInkCanvas) { _location = location; _control = new InkCanvasAnnotationControl(InkCanvasAnnotation); base.AddLogicalChild(_control); base.AddVisualChild(_control); }
// IACore,IAWinFx // C:\Program Files\Reference Assemblies\Microsoft\Tablet PC\v1.7 // IALoader // C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin // それぞれのライブラリは「Windows SDK for Windows Server 2008 and .NET Framework 3.5」で取得できる // http://www.microsoft.com/en-us/download/confirmation.aspx?id=11310 private string InkAnalyze( InkCanvas canvas ) { InkAnalyzer theInkAnalyzer = new InkAnalyzer(); // キャンバスに描かれた文字を認識するためにアナライザにストロークをセット theInkAnalyzer.AddStrokes( canvas.Strokes ); theInkAnalyzer.SetStrokesType( canvas.Strokes, StrokeType.Writing ); // 文字を解析 theInkAnalyzer.Analyze(); // 文字を解析した結果の第1候補を返す return theInkAnalyzer.GetRecognizedString(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.BrushSlider = ((System.Windows.Controls.Slider)(target)); #line 15 "..\..\MainWindow.xaml" this.BrushSlider.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.BrushSizeSlider_ValueChanged); #line default #line hidden return; case 2: this.BrushColorCombo = ((System.Windows.Controls.ComboBox)(target)); #line 17 "..\..\MainWindow.xaml" this.BrushColorCombo.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.BrushColorCombo_SelectionChanged); #line default #line hidden return; case 3: this.BrushStateCombo = ((System.Windows.Controls.ComboBox)(target)); #line 28 "..\..\MainWindow.xaml" this.BrushStateCombo.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.BrushStateCombo_SelectionChanged); #line default #line hidden return; case 4: this.BrushShapesCombo = ((System.Windows.Controls.ComboBox)(target)); #line 43 "..\..\MainWindow.xaml" this.BrushShapesCombo.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.BrushShapesCombo_SelectionChanged); #line default #line hidden return; case 5: this.PaintCanvas = ((System.Windows.Controls.InkCanvas)(target)); return; } this._contentLoaded = true; }
public SessionManager(InkCanvas targetInkCanvas, Canvas root) { CurrentProject = new Project(); CurrentProject.DefaultCanvasSettings.Height = root.Height/3; CurrentProject.DefaultCanvasSettings.Width = root.Width/3; AddNewPageToProject(); _targetInkCanvas = targetInkCanvas; CommonGestureManager = GestureManager.LoadFromFile("gestures.xml"); ActivePenMode = PenMode.Draw; NotifyPropertyChanged("CurrentProject"); NotifyPropertyChanged("ActivePenMode"); NotifyPropertyChanged("ActivePenSettings"); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Win = ((WPFAppTest.MainWindow)(target)); return; case 2: #line 13 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 3: #line 14 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 4: #line 15 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2); #line default #line hidden return; case 5: #line 16 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_3); #line default #line hidden return; case 6: this.canvas = ((System.Windows.Controls.InkCanvas)(target)); return; } this._contentLoaded = true; }
//------------------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------------------- #region Constructors internal ClipboardProcessor(InkCanvas inkCanvas) { if ( inkCanvas == null ) { throw new ArgumentNullException("inkCanvas"); } _inkCanvas = inkCanvas; // Create our default preferred list - Only InkCanvasClipboardFormat.Isf is supported. _preferredClipboardData = new Dictionary<InkCanvasClipboardFormat, ClipboardData>(); _preferredClipboardData.Add(InkCanvasClipboardFormat.InkSerializedFormat, new ISFClipboardData()); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.wind = ((lab3_12.MainWindow)(target)); return; case 2: #line 33 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click_1); #line default #line hidden return; case 3: #line 34 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click); #line default #line hidden return; case 4: this.inkcanvas1 = ((System.Windows.Controls.InkCanvas)(target)); return; case 5: this.combobox1 = ((System.Windows.Controls.ComboBox)(target)); return; case 6: this.slider1 = ((System.Windows.Controls.Slider)(target)); #line 56 "..\..\MainWindow.xaml" this.slider1.PreviewMouseUp += new System.Windows.Input.MouseButtonEventHandler(this.slider1_PreviewMouseUp); #line default #line hidden return; case 7: this.lbEditingModes = ((System.Windows.Controls.ListBox)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.textBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 2: this.textBlock1 = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.textBlock2 = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.checkBox = ((System.Windows.Controls.CheckBox)(target)); return; case 5: this.textBlock3 = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.textBox = ((System.Windows.Controls.TextBox)(target)); return; case 7: this.canvasView = ((System.Windows.Controls.Viewbox)(target)); return; case 8: this.CustomerSignatureCanvas = ((System.Windows.Controls.InkCanvas)(target)); return; case 9: this.viewBt = ((System.Windows.Controls.Button)(target)); return; case 10: this.button1 = ((System.Windows.Controls.Button)(target)); return; case 11: this.checkBox1 = ((System.Windows.Controls.CheckBox)(target)); return; } this._contentLoaded = true; }
public void insertStrokes(InkAnalyzer analyzer, InkCanvas mainInkCanvas, InkCanvas insertionCanvas) { double bestY = -10000; ContextNode selectedNode = null; foreach (ContextNode node in analyzer.FindLeafNodes()) { double y1 = strokeToBeReplaced.GetBounds().Y; double y2 = node.Strokes.GetBounds().Y; if (y1 - y2 > 0 && y1 - y2 < y1 - bestY) { bestY = y2; selectedNode = node; } } if (bestY == -10000) { bestY = strokeToBeReplaced.GetBounds().Y; } StrokeCollection strokeCollection = insertionCanvas.Strokes.Clone(); insertionCanvas.Strokes.Clear(); double bestX = strokeToBeReplaced.GetBounds().X; double strokeX = strokeCollection.GetBounds().X; double strokeY = strokeCollection.GetBounds().Y; Matrix inkTransform = new Matrix(); inkTransform.Translate(bestX - strokeX + 20, bestY - strokeY); strokeCollection.Transform(inkTransform, false); double width = strokeCollection.GetBounds().Width + Constants.SPACING; double startX = strokeCollection.GetBounds().X; Matrix transform = new Matrix(); transform.Translate(width, 0); if (selectedNode != null) { for (int i = 0; i < selectedNode.ParentNode.SubNodes.Count; i++) { ContextNode siblingNode = selectedNode.ParentNode.SubNodes[i]; for (int j = 0; j < siblingNode.Strokes.Count; j++) { Stroke stroke = siblingNode.Strokes[j]; double offsetX = stroke.GetBounds().X; if (offsetX > startX) { stroke.Transform(transform, false); } } } } mainInkCanvas.Strokes.Add(strokeCollection); mainInkCanvas.Strokes.Remove(strokeToBeReplaced); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 15 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.circule_clicked); #line default #line hidden return; case 2: #line 16 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.line_clicked); #line default #line hidden return; case 3: #line 17 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.curve_clicked); #line default #line hidden return; case 4: this.canvas = ((System.Windows.Controls.InkCanvas)(target)); #line 19 "..\..\MainWindow.xaml" this.canvas.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.preview_mouseup); #line default #line hidden #line 19 "..\..\MainWindow.xaml" this.canvas.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.preview_mousedown); #line default #line hidden return; } this._contentLoaded = true; }
public void hookup(InkCanvas invoker) { this.invoker = invoker; invoker.StylusButtonDown += invoker_StylusButtonDown; invoker.StylusButtonUp += invoker_StylusButtonUp; invoker.StylusDown += invoker_StylusDown; invoker.StylusEnter += invoker_StylusEnter; invoker.StylusInAirMove += invoker_StylusInAirMove; invoker.StylusInRange += invoker_StylusInRange; invoker.StylusLeave += invoker_StylusLeave; invoker.StylusMove += invoker_StylusMove; invoker.StylusOutOfRange += invoker_StylusOutOfRange; invoker.StylusSystemGesture += invoker_StylusSystemGesture; invoker.StylusUp += invoker_StylusUp; }
public RuleSample(IGTRules _parent, List<String> gdl, InkCanvas canvas) { InitializeComponent(); foreach (string s in gdl) { rule.Items.Add(s); } parent = _parent; thumbnail.Strokes.Add(canvas.Strokes); viewbox.Width = canvas.ActualWidth / 3; viewbox.Height = canvas.ActualHeight / 3; thumbnail.EditingMode = SurfaceInkEditingMode.None; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.textBox = ((System.Windows.Controls.TextBox)(target)); return; case 2: this.canvasTinta = ((System.Windows.Controls.InkCanvas)(target)); return; case 3: this.Borrar = ((System.Windows.Controls.Button)(target)); #line 25 "..\..\MainWindow.xaml" this.Borrar.Click += new System.Windows.RoutedEventHandler(this.Borrar_Click); #line default #line hidden return; case 4: this.Modo1 = ((System.Windows.Controls.RadioButton)(target)); #line 35 "..\..\MainWindow.xaml" this.Modo1.Checked += new System.Windows.RoutedEventHandler(this.Modo1_Checked); #line default #line hidden return; case 5: this.Modo2 = ((System.Windows.Controls.RadioButton)(target)); #line 36 "..\..\MainWindow.xaml" this.Modo2.Checked += new System.Windows.RoutedEventHandler(this.Modo2_Checked); #line default #line hidden return; case 6: this.FeedbackText = ((System.Windows.Controls.TextBox)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.canvas = ((System.Windows.Controls.InkCanvas)(target)); #line 10 "..\..\WhiteBoard.xaml" this.canvas.KeyDown += new System.Windows.Input.KeyEventHandler(this.Canvas_KeyDown); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.inkCanvas1 = ((System.Windows.Controls.InkCanvas)(target)); #line 68 "..\..\UDPView.xaml" this.inkCanvas1.Gesture += new System.Windows.Controls.InkCanvasGestureEventHandler(this.inkCanvas1_Gesture); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.CheckA = ((System.Windows.Controls.CheckBox)(target)); #line 10 "..\..\MainWindow.xaml" this.CheckA.Checked += new System.Windows.RoutedEventHandler(this.CheckBox_A); #line default #line hidden return; case 2: this.CheckB = ((System.Windows.Controls.CheckBox)(target)); #line 11 "..\..\MainWindow.xaml" this.CheckB.Checked += new System.Windows.RoutedEventHandler(this.CheckBox_B); #line default #line hidden return; case 3: this.xAxis = ((System.Windows.Controls.TextBox)(target)); return; case 4: this.yAxis = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.drawingBoard = ((System.Windows.Controls.InkCanvas)(target)); return; case 6: #line 15 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; } this._contentLoaded = true; }
/// <summary> /// InkCanvasFeedbackAdorner Constructor /// </summary> /// <param name="inkCanvas">The adorned InkCanvas</param> internal InkCanvasFeedbackAdorner(InkCanvas inkCanvas) : base(( inkCanvas != null ? inkCanvas.InnerCanvas : null )) { if ( inkCanvas == null ) throw new ArgumentNullException("inkCanvas"); // Initialize the internal data _inkCanvas = inkCanvas; _adornerBorderPen = new Pen(Brushes.Black, 1.0); DoubleCollection dashes = new DoubleCollection( ); dashes.Add(4.5); dashes.Add(4.5); _adornerBorderPen.DashStyle = new DashStyle(dashes, 2.25); _adornerBorderPen.DashCap = PenLineCap.Flat; }
public static void ApplyCenterPictureModifications(Picture pic, InkCanvas canvas) { var rel = pic.Width/pic.Height; if (pic.Width >= pic.Height) { pic.Width = canvas.Width*2/3.5; pic.Height = pic.Width/rel; } else { pic.Height = canvas.Height*2/3; pic.Width = pic.Height*rel; } var position = canvas.CanvasCenterCoordinates(pic.Width, pic.Height); var shiftDown = canvas.Height/12; canvas.SetObjectPositionOnCanvas(pic, position.X, position.Y + shiftDown); }