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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:25:40+00:00 2026-05-27T04:25:40+00:00

I am having fun with Visual C++ some time already. And today i decided,

  • 0

I am “having fun” with Visual C++ some time already. And today i decided, i want to draw some colored pixel inside “panel”. The goal is – later, when i will learn how to do that – draw pixels inside panel, taking colors from array. But for now, i just want to create few pixel inside panel.

Lets say i got a panel 20×20, and i want put there 3 pixels somewhere not near edge. And let say every pixel gonna be other color. I was reading a bit and found some ideas, but didnt get anything to work.

Do i need to use that to put single pixel? (i am guessing 3,3,3,3 are cords, corners of rectangle).

Color aColor = Color::Green;
SolidBrush^ aBrush = gcnew SolidBrush(aColor);
e->Graphics->FillRectangle(Brush, 3, 3, 3, 3);

Also, then how to make it draw a pixel into “panel1” WHEN PRESSING A button. Cuz if i put that code directly in panel1, it should draw these pixel right after compiling right? And i want draw pixels after pressing a button.

Don’t be too rough for me, i am learning it 😉

  • 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-27T04:25:41+00:00Added an answer on May 27, 2026 at 4:25 am

    To set a single pixel, draw a 1-by-1 rectangle.

    e->Graphics->FillRectangle(Brushes::Green, 3, 3, 1, 1);
    

    The last two parameters are width and height.

    This code needs to be in a Paint handler.
    It will then draw the pixel at all times.

    To only draw the pixel once you click a button, set a flag in your class when you click the button, and put the drawing code in an if statement.

    You should then call panel->Invalidate() to force the panel to repaint so that your drawing appears.

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

Sidebar

Related Questions

so I'm having a lot of fun with Perl at home for some time
I am beginning some experimentation in writing a kernel and having fun doing it.
I'm having some fun trying to get my head around some MVP stuf, as
Say if I want to return the result having fun of the triple. I
I am having fun with google maps and was after some assistance. Basically I
Having some fun with MySQL by asking it difficult questions. Essentially i have a
Having some fun with t-sql and sp_executesql (test output below). The last piece of
Iam having a fun time with implementing SHA1 and HMAC methods in a iPhone
I'm having a littl fun with ASP.Net data binding today, basically I have two
I'm currently having fun trying to learn some of the Boost libary. I'm currently

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.