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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:20:37+00:00 2026-05-14T03:20:37+00:00

My goal is totally fit image in toolStripButton and toolStripDropDownButton. If a image in

  • 0

My goal is totally fit image in toolStripButton and toolStripDropDownButton.

If a image in the button set with image property, I can not totally fit the image in the button. Because of margin, border, or something of the button.(I don’t know exactly).

So I try to set the image in the button with BackgroudImage property. After I adjust some property(like AutoSize, Size and so on…), I can fit image in button.

but in this case, I can not see background image. It is disappear, when the mouse cursor is located in the button.

How can I solve this problem??

Image Property. I can not remove the gap between images.
alt text

BackgroundImage Property. I can not see the image, when mouse cursor is on the image.
alt text

  • 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-14T03:20:38+00:00Added an answer on May 14, 2026 at 3:20 am

    Well, you found out why it leaves a space around the Image property. You can customize the rendering of the button by assigning the ToolStrip.Renderer property. That could look something like this:

    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            toolStrip1.Renderer = new MyRenderer();
        }
        private class MyRenderer : ToolStripProfessionalRenderer {
            protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e) {
                if (e.Item.BackgroundImage == null) base.OnRenderButtonBackground(e);
                else {
                    Rectangle bounds = new Rectangle(Point.Empty, e.Item.Size);
                    e.Graphics.DrawImage(e.Item.BackgroundImage, bounds);
                    if (e.Item.Pressed) {
                        // Something...
                    }
                    else if (e.Item.Selected) {
                        // Something...
                    }
                    using (Pen pen = new Pen(Color.Black)) {
                        e.Graphics.DrawRectangle(pen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
                    }
                }
            }
        }
    
    }
    

    You’ll have to fill in the // Something… lines and do some kind of drawing that makes it obvious to the user that the button is pressed or selected. Maybe draw a rectangle with a thick Pen, it is up to you.

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

Sidebar

Related Questions

Goal : I wants when I drag image it become fade so we can
I'm re-writing alibrary with a mandate to make it totally allocation free. The goal
Goal: Once i click on the start button on my user interface, i currently
My goal is to have a CMS that is totally self-contained like a flat-file
Goal is to make a dialog that appears on menu_key pressed, but it keeps
Goal: Produce an Excel document with information from 3 associated models that is similar
Goal I am building an Eclipse plugin targeting the 3.7 environment and would like
GOAL : To customize the background view of cell. Here is what I am
Goal: Gain datatype date with year and month Problem: Need to help to convert
Goal: to create a percentage column based off the values of calculated columns. Here's

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.