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 480719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:55:17+00:00 2026-05-13T00:55:17+00:00

I am trying to draw a rectangle on a windows mobile phone. Draw the

  • 0

I am trying to draw a rectangle on a windows mobile phone.

  1. Draw the rectangle
  2. Fill the rectangle with a color
  3. Draw it on to the phone.
  4. Give it a event handler that when a user clicks something happens.

I am unsure how do steps 2, 3 and 4. I see that there is a drawing class called rectangle but I don’t know how to get it on the form.

I then don’t know how I could give it a event handler. I am planning to dynamically make like 12 of these so I have to somehow tell which one is clicked and the color it contains in it.

Thanks

Edit so far I have this but I don’t see it on my form.

 Graphics surface = this.CreateGraphics();
    Pen pen = new Pen(Color.Black, 1f);
    System.Drawing.Rectangle test = new Rectangle(0, 0, 500, 500);
    surface.DrawRectangle(pen, test);
  • 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-13T00:55:17+00:00Added an answer on May 13, 2026 at 12:55 am

    It sounds like you want a colored button. I think the easiest way to do this is to inherit from Control and override its Paint event.

    public class ColoredButton : Control {
        protected override void OnPaint(PaintEventArgs e) {
            Graphics graphics = e.Graphics;
            Pen pen = new Pen(Color.Black, 1f);
            SolidBrush brush = new SolidBrush(Color.Red);
    
            graphics.FillRectangle(brush, 0, 0, Width, Height);
            graphics.DrawRectangle(pen, 0, 0, Width-1, Height-1);
        }
    }
    

    Now just hook into the native control Click event.

    Or if you want fancier controls, take a look at this library

    http://code.msdn.microsoft.com/uiframework

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

Sidebar

Related Questions

I am trying to just draw a Rectangle on a PictureBox that is on
I'm trying to draw a rectangle that is rotated 45° behind the text of
I am trying to draw a rectangle and let the user create it based
I am just trying to draw a rectangle on mouse move event . I
I'm trying to allow the user to draw a rectangle on the canvas (like
I'm trying to draw an NSTextFieldCell subclass that looks like the rounded event item
I am trying to draw a rectangle where the user moves the finger on
I am simply trying to draw a rectangle inside of a panel using flex4.
I'm new with OpenGLES and I was trying to draw a rectangle with alpha
I'm trying to draw an open rectangle using a Polygon: int[] xPoints = {1,1,3,3};

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.