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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:14:10+00:00 2026-05-26T01:14:10+00:00

I am writing a program in Visual C# 2010 that has several icons on

  • 0

I am writing a program in Visual C# 2010 that has several icons on the form. When the mouse is placed over the icon (which is just an image) I want the icon to b highlighted via a border around the icon. In visual basic i can make a transparent rectangle with a colored border and position it over the icon. In C#, i can do the same however until i call invalidate multiple borders appear. The problem with calling invalidate is that my program is doing something in the background every second so the border keeps flashing (re-drawing).

Anyone got any ideas how i can implement this?

  • 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-26T01:14:10+00:00Added an answer on May 26, 2026 at 1:14 am

    You didn’t say how you draw the border but from your description you are creating a graphics context for this. Don’t do this, it’s wrong. Instead, draw inside the Paint element of either the control or the its parent container.

    The Paint event handler could look as follows:

    private void yourControl_Paint(object sender, PaintEventArgs e)
    {
        if (! HasFocus(yourControl))
            return;
        Graphics g = e.Graphics;
        using (Pen p = new Pen(Color.FromArgb(128, 0, 0, 128)))
            g.DrawRectangle(p, 0, 0, yourControl.Width -1, yourControl.Height - 1);
    }
    

    This uses a hypothetical HasFocus method to determine whether this control should have a focus rectangle.

    By the way, this is identical in VB and C#.

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

Sidebar

Related Questions

I'm writing an MPI program (Visual Studio 2k8 + MSMPI) that uses Boost::thread to
I'm pretty new to C# and Visual Studio. I'm writing a small program that
I am writing a program which has two panes (via CSplitter ), however I
I'm writing a program that uses the textbox in visual C# to read a
I am writing a small program in Visual C++ 2010. This is code of
I am writing a Visual C# program that executes a continuous loop of operations
I am writing a program that has to access a MySQL database. To do
I'm writing a program for my visual basic class that computes the prices of
I am writing a program in C for windows using visual studio 2010. I
I'm writing a program in Visual Basic 2010. It's a HMI (Human-Machine Interface) and

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.