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

  • SEARCH
  • Home
  • 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 9249231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:08:29+00:00 2026-06-18T10:08:29+00:00

I have a Windows Mobile application (C#, .Net framework 2), the codebase of which

  • 0

I have a Windows Mobile application (C#, .Net framework 2), the codebase of which is also now being used to run on Windows 7 and Windows 8. One of the controls that we wrote for this application is a scribble control that allows the user to capture a signature. This control works ok on Windows Mobile and can be used to capture signatures fairly well. On Windows, however, the OnMouseMove override method of a panel control is too slow, or called to infrequently, and the signature becomes very “blocky”. So, for example, if you try capture a circle, on Windows Mobile you get a reasonable circle, but on Windows you end up getting a square because mousemove is not called frequently enough. Here is the OnMouseMove override method of the panel:

protected override void OnMouseMove(MouseEventArgs e)
{
    base.OnMouseMove(e);
    if (!_captureMouseCoordinates) { return; }
    LineToDraw line = new LineToDraw();
    line.StartX = _lastMouseCoordinates.X;
    line.StartY = _lastMouseCoordinates.Y;
    line.EndX = e.X;
    line.EndY = e.Y;
    _points.Add(line);
    _graphicsHandle.DrawLine(_scribblePen, line.StartX, line.StartY, line.EndX, line.EndY);            
    // Refresh rectangle for the line drawn
    Point leftCorner = new Point();
    Size rectangleSize = new Size();
    // Case 1: line down, right
    if (line.StartX <= line.EndX && line.StartY <= line.EndY) 
    {
        leftCorner.X = line.StartX;
        leftCorner.Y = line.StartY;
    }
    // Case 2: Line up, right
    if (line.StartX <= line.EndX && line.StartY >= line.EndY) 
    {
         leftCorner.X = line.StartX;
         leftCorner.Y = line.EndY;
    }
    // Case 3: Line up, left
    if (line.StartX >= line.EndX && line.StartY >= line.EndY) 
    {
        leftCorner.X = line.EndX;
        leftCorner.Y = line.EndY;
    }
    // Case 4: Line down, left
    if (line.StartX >= line.EndX && line.StartY <= line.EndY) 
    {
        leftCorner.X = line.EndX;
        leftCorner.Y = line.StartY;
    }
    rectangleSize.Height = Math.Abs(line.EndY-line.StartY)+1;
    rectangleSize.Width = Math.Abs(line.EndX-line.StartX)+1;
    // save last mouse co-ordinates
    _lastMouseCoordinates.X = line.EndX;
    _lastMouseCoordinates.Y = line.EndY;
    Invalidate(new Rectangle(leftCorner.X,leftCorner.Y, rectangleSize.Width, rectangleSize.Height));
}

The _captureMouseCoordinates boolean member variable in the code above is being set on the ‘mousedown’ event handler.

I notice that if I comment out the invalidate in this method and only invalidate on mouseup that the signature then is much smoother, but then you don’t get to see the signature while it is being drawn. Does anyone have any ideas how I could go about getting this signature control to perform better so that the signatures produced by it are smoother and yet still be able to give feedback to the user as the lines are being drawn.

  • 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-06-18T10:08:31+00:00Added an answer on June 18, 2026 at 10:08 am

    I don’t know where _graphicsHandle is – but you should generally never save Graphics objects. Let all rendering be in Invalidate().

    Create two collections:

    List<Point> _currentStroke
    List<List<Point>> _allStrokes
    

    MouseMove:

    _currentStroke.Add(e.Location)
    

    MouseUp

       _allStrokes.Add(_currentStroke)
    

    On each OnPaint

       foreach(var stroke in _allStrokes)
           {g.DrawLines(pen, stroke.ToArray());}
       if(_currentStroke.Count > 1)
           g.DrawLines(pen, _currentStroke)
    

    (Obviously add all supporting code).

    You should have no performance issues.

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

Sidebar

Related Questions

I have a .NET application that is being targeted to run on Windows Mobile
i have an windows mobile application written in c# compact framework which use barcode
We have a windows mobile 6.5 gaming application which uses openGL . Now we
I have a .NET Windows Mobile 5.0 application that is used for data collection.
I have issues with .NET CF 3.5 application on Windows Mobile 6.5 on Motorola
In my Windows Mobile .NET application I have a simple array of object with
I'm developing a Windows Mobile 5.0 and above application with .Net Compact Framework 2.0
I'm developing a Windows Mobile 5.0 or above application with .Net Compact Framework 2.0
I'm developing a Windows Mobile 5.0 or above application with .Net Compact Framework 2.0
I'm developing a Windows Mobile 5.0 and above application with C#, .NET Compact Framework

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.