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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:51:52+00:00 2026-05-27T01:51:52+00:00

I am able to draw a close button on tab using e.Graphics.Drawimage in OnDrawItem

  • 0

I am able to draw a close button on tab using e.Graphics.Drawimage in OnDrawItem event of TabControl but i want to display the favicon of the website on that tab after the DocumentCompleted event of webbrowser control but i cannot use e.Graphics.Drawimage in DocumentCompleted event.

Is there an alternative way to do this.

Thanks for your help.

  • 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-27T01:51:53+00:00Added an answer on May 27, 2026 at 1:51 am

    OnDrawItem is the correct way. If you do it any other way, your icon will be erased the next time the tab needs to be redrawn (e.g. if you switch to a different tab, or minimize and then restore the window). In WinForms, you should only draw a control from that control’s draw events.

    What you need to do is, in your DocumentCompleted event, save off the icon (e.g. in a field on your UserControl or Form class), and then call Invalidate on the tab control. That will result in your OnDrawItem event getting fired. Your OnDrawItem can then draw the icon, as long as the field has been assigned. Something roughly like this:

    private Image _favicon;
    private void WebBrowser1_DocumentCompleted(...) {
        _favicon = ...get the icon...;
        TabControl1.Invalidate();
    }
    private void TabControl1_OnDrawItem(...) {
        if (_favicon != null)
            e.Graphcs.DrawImage(_favicon, ...);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Python I want to be able to draw text at different angles using
I'm using Emacs, with CLISP and Slime, and want to be able to draw
I want to add an image to a frame but I am not able
I want to be able to draw on to the top of a TextBlock,
I want to draw a stock chart using Google Chart Tools. My self-written webservice
I'm using php and gd library to draw a triangle. I'm able to draw
I want to make user able to draw routes and areas on static images
How do you draw a custom button next to the minimize, maximize and close
I am being able to draw the image using something like the code below:
I want to be able to draw the number of the date (1-31) over

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.