HitTest
-
Dear Guys, I have used the below code for the hit test. It always showing no suitable method found to override error on "protected override void OnInitialized(EventArgs e) Code is below
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;namespace InputExamples2
{
public partial class MousePosition
{
public MousePosition()
{
this.InitializeComponent();// Insert code required on object creation below this point. } protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); DragEllipse.RenderTransform = ellipseTransform; CompositionTarget.Rendering += this.CompositionTarget\_Rendering; } private void CompositionTarget\_Rendering(object sender, EventArgs e) { Point mouse1 = Mouse.GetPosition(firstEllipse); Point mouse2 = Mouse.GetPosition(secondEllipse); Point mouse3 = Mouse.GetPosition(thirdEllipse); Point mouse4 = Mouse.GetPosition(fourthEllipse); firstCoordinates.Content = mouse1.ToString(); secondCoordinates.Content = mouse2.ToString(); thirdCoordinates.Content = mouse3.ToString(); fourthCoordinates.Content = mouse4.ToString(); Point position = Mouse.GetPosition(DragEllipse); ellipseTransform.X += position.X - (DragEllipse.Width / 2); ellipseTransform.Y += position.Y - (DragEllipse.Height / 2); } }
}
Please help me to resolve this error
Ahamed Azeem software Programmer
-
Dear Guys, I have used the below code for the hit test. It always showing no suitable method found to override error on "protected override void OnInitialized(EventArgs e) Code is below
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;namespace InputExamples2
{
public partial class MousePosition
{
public MousePosition()
{
this.InitializeComponent();// Insert code required on object creation below this point. } protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); DragEllipse.RenderTransform = ellipseTransform; CompositionTarget.Rendering += this.CompositionTarget\_Rendering; } private void CompositionTarget\_Rendering(object sender, EventArgs e) { Point mouse1 = Mouse.GetPosition(firstEllipse); Point mouse2 = Mouse.GetPosition(secondEllipse); Point mouse3 = Mouse.GetPosition(thirdEllipse); Point mouse4 = Mouse.GetPosition(fourthEllipse); firstCoordinates.Content = mouse1.ToString(); secondCoordinates.Content = mouse2.ToString(); thirdCoordinates.Content = mouse3.ToString(); fourthCoordinates.Content = mouse4.ToString(); Point position = Mouse.GetPosition(DragEllipse); ellipseTransform.X += position.X - (DragEllipse.Width / 2); ellipseTransform.Y += position.Y - (DragEllipse.Height / 2); } }
}
Please help me to resolve this error
Ahamed Azeem software Programmer
Hi Ahamed, Subscribe to the Initialized event instead:
public YourControl()
{
Initialized += new EventHandler(YourControl_Initialized);
}Cheers, Daniel
Daniel Vaughan Latest News on Twitter Blog: DanielVaughan.Orpius.com Open Source Projects: Calcium SDK, Clog Organization: Outcoder 5 Days Consulting Available in March
-
Hi Ahamed, Subscribe to the Initialized event instead:
public YourControl()
{
Initialized += new EventHandler(YourControl_Initialized);
}Cheers, Daniel
Daniel Vaughan Latest News on Twitter Blog: DanielVaughan.Orpius.com Open Source Projects: Calcium SDK, Clog Organization: Outcoder 5 Days Consulting Available in March
Thanks for your reply Daniel Could you please explain me little more
Ahamed Azeem software Programmer
-
Dear Guys, I have used the below code for the hit test. It always showing no suitable method found to override error on "protected override void OnInitialized(EventArgs e) Code is below
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;namespace InputExamples2
{
public partial class MousePosition
{
public MousePosition()
{
this.InitializeComponent();// Insert code required on object creation below this point. } protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); DragEllipse.RenderTransform = ellipseTransform; CompositionTarget.Rendering += this.CompositionTarget\_Rendering; } private void CompositionTarget\_Rendering(object sender, EventArgs e) { Point mouse1 = Mouse.GetPosition(firstEllipse); Point mouse2 = Mouse.GetPosition(secondEllipse); Point mouse3 = Mouse.GetPosition(thirdEllipse); Point mouse4 = Mouse.GetPosition(fourthEllipse); firstCoordinates.Content = mouse1.ToString(); secondCoordinates.Content = mouse2.ToString(); thirdCoordinates.Content = mouse3.ToString(); fourthCoordinates.Content = mouse4.ToString(); Point position = Mouse.GetPosition(DragEllipse); ellipseTransform.X += position.X - (DragEllipse.Width / 2); ellipseTransform.Y += position.Y - (DragEllipse.Height / 2); } }
}
Please help me to resolve this error
Ahamed Azeem software Programmer
Ahamed Azeem wrote:
public partial class MousePosition
Nothing to override, because you're not inheriting from anything. I'm surprised you're not getting a compiler error, telling you that the different partial class declarations aren't compatible.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of Guardians of Xen (Sci-Fi/Fantasy novel) -
Thanks for your reply Daniel Could you please explain me little more
Ahamed Azeem software Programmer
Ahamed, What is the type of the associated xaml file?
Daniel Vaughan Latest News on Twitter Blog: DanielVaughan.Orpius.com Open Source Projects: Calcium SDK, Clog Organization: Outcoder 5 Days Consulting Available in March
-
Ahamed, What is the type of the associated xaml file?
Daniel Vaughan Latest News on Twitter Blog: DanielVaughan.Orpius.com Open Source Projects: Calcium SDK, Clog Organization: Outcoder 5 Days Consulting Available in March
xaml.cs
Ahamed Azeem software Programmer
-
xaml.cs
Ahamed Azeem software Programmer
That doesn't tell me what the type is. What are the first couple of lines in xaml.cs?
Daniel Vaughan Latest News on Twitter Blog: DanielVaughan.Orpius.com Open Source Projects: Calcium SDK, Clog Organization: Outcoder 5 Days Consulting Available in March
-
That doesn't tell me what the type is. What are the first couple of lines in xaml.cs?
Daniel Vaughan Latest News on Twitter Blog: DanielVaughan.Orpius.com Open Source Projects: Calcium SDK, Clog Organization: Outcoder 5 Days Consulting Available in March
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" x:Class="AnimationExamples.Rotation" x:Name="Page" WindowTitle="Page" FlowDirection="LeftToRight" Width="640" Height="480" WindowWidth="640" WindowHeight="480" >
Ahamed Azeem software Programmer
-
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" x:Class="AnimationExamples.Rotation" x:Name="Page" WindowTitle="Page" FlowDirection="LeftToRight" Width="640" Height="480" WindowWidth="640" WindowHeight="480" >
Ahamed Azeem software Programmer
Sorry for the delay Ahamed. I see that your Page x:Class is "AnimationExamples.Rotation". Change it to "InputExamples2.MousePosition" to match your class name. Cheers, Daniel
Daniel Vaughan Latest News on Twitter Blog: DanielVaughan.Orpius.com Open Source Projects: Calcium SDK, Clog Organization: Outcoder 5 Days Consulting Available in March