Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6928059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:08:05+00:00 2026-05-27T11:08:05+00:00

I simply want the user to be able to draw on the screen with

  • 0

I simply want the user to be able to draw on the screen with some sort of pointer.

I already have the code working that captures the pointer’s position, but I can’t figure out how to place the pixels or shapes or whatever onto the screen.

I found this useful tutorial:
http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=137

And I’ve been looking at the documentation here:
http://msdn.microsoft.com/en-us/library/windows/apps/hh465055(v=VS.85).aspx

No luck so far. =( The tutorial is for Windows Phone 7, so it’s a little bit different. =\ Help, please? =)

And this is what I have so far.

The drawing part:

    private void Image_PointerPressed(object sender, PointerEventArgs e)
    {
        Debug.WriteLine("Image_PointerPressed");
        isTracing = true;
    }

    private void Image_PointerReleased(object sender, PointerEventArgs e)
    {
        Debug.WriteLine("Image_PointerReleased");
        isTracing = false;
    }

    private void Image_PointerMoved(object sender, PointerEventArgs e)
    {
        Debug.WriteLine("Image_PointerMoved");
        Debug.WriteLine(e.GetCurrentPoint(this).Position);
        if (isTracing)
        {
            Debug.WriteLine("isTracing");

            Point pos = e.GetCurrentPoint(this).Position;
            Color color = Colors.Green;
            Line line = new Line() { X1 = pos.X, X2 = pos.X + 1, Y1 = pos.Y, Y2 = pos.Y + 1 };
            line.Stroke = new SolidColorBrush(color);
            line.StrokeThickness = 15;
            //// So how do I draw this line onto the screen?? ////

        }

    }

For reference, stuff elsewhere in the code:


    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.IO;
    using System.Linq;
    using System.Threading.Tasks;
    using Multimedia.FFmpeg;
    using Windows.Foundation;
    using Windows.Storage;
    using Windows.Storage.Pickers;
    using Windows.Storage.Streams;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Shapes;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Input;

    bool isTracing = false;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:08:06+00:00Added an answer on May 27, 2026 at 11:08 am

    Short form:

    • Add Lines and Rectangles to a panel
    • Manipulate a bitmap directly
    • Use an HTML5 Canvas element in a JavaScript/HTML project
    • Write the whole thing in C++/DirectX

    There is no way in Metro/XAML to override an OnRender() method or the like. Your options are to add existing graphical elements (eg from the Shapes namespace) to a Canvas or other Panel, or to directly manipulate the pixels in a bitmap and push that bitmap into an Image element.

    Metro/C# only has retained-mode graphics drawing, which means the only thing it will render is objects that have been added to the view hierarchy. What you’re looking for is some kind of immediate-mode graphics drawing, eg

    myCanvas.DrawLine( fromPoint, toPoint );
    

    This can be done in a JavaScript/HTML project using HTML5’s Canvas object. Which, sadly, is the way I’m leaning for such a project. It’s unfortunate that Microsoft is not providing an immediate-mode element for XAML projects but that’s the way it is. C++/DirectX is also an option for doing custom drawing but requires a substantial reworking of everything else that you’re doing in the app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview that contains data. I want the user to be able
We want to do some fairly simple analysis of user's C++ code and then
I have a simple Java program that allows a user to draw rectangles on
So all I want to do is simply find a user control I load
I want to write a simple program that determines whether the number the user
I want to implement a simple specialized window manager for presentations (not user-controllable) that
So suppose I have two Models -- Project and Task I want user to
I'm creating an application where the user can draw a line on a screen
The scenario is that i want the user to create a shape in a
So I have this list of option values, and I want a user to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.