

Şimdi sıra geldi kullanıcının Surface ekranına point ettiği zaman “Hello World!” yazısını yazdırmaya. Bunun için C# code behind’ını kullanacağız. Solution Explorer’dan bu sefer SurfaceWindow1.xaml.cs dosyasını seçiyoruz. Buraya da şu kodları yazıyoruz:
#region OnCanvasContactDown private void OnCanvasContactDown(object sender, ContactEventArgs e) { // Get the position of the current contact. Point contactPosition = e.Contact.GetPosition(this); // Set the X and Y position of HelloWorldLabel // in relation to the canvas. Canvas.SetLeft(HelloWorldLabel, contactPosition.X); Canvas.SetTop(HelloWorldLabel, contactPosition.Y); // Make the label visible. HelloWorldLabel.Visibility = Visibility.Visible; } #endregion
Artık uygulamamız Build etmeye hazır. Run edin ve ilk Surface şaheserinizin tadını çıkarın :)
Pingback: Multi-touch ve Microsoft Surface Makalem Part-13 | Bekir Aytac AGMA