473,788 Members | 3,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button BorderSize Issue...

I have come across something that I cannot seem to find a solution for and
would like to know if anyone else has either seen the same thing and/or (even
better) has a solution.

If I set the BorderSize for a flat-style button on a Windows form, the
border is correctly drawn in the designer but it is drawn as being one pixel
wider at runtime. For example, if I set the BorderSize equal to 1, in the
designer, the border will be drawn 1 pixel wide but at runtime it will be 2
pixels wide. The only setting that seems to work like it should is a setting
of 0.

Am I missing something? Any suggestions as to why it works this way and/or
any ideas of how to fix it?

Thank you,

Jason Richmeier
May 26 '06 #1
3 1216
Hi Jason,

Thank you for posting.

The reason of the button's border size being drawn a little wider at
runtime is that the button gets focus. If the focus is moved to other
controls on the form, the border size of the button will be restored to 1
pixel.

Hope this helps.
Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =======
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=============== =============== =============== =======

May 29 '06 #2
Thank you for the response.

I understand what you are saying now. The reason I didn't notice the
behavior you describe before is the button was the only control on the form
that could receive focus. Once I threw a second button (which could receive
focus) on the form, the thick border went away as you described.

Something that I had tried was to derive a new class from the Button class
and override the ShowFocusCues property to always return false. This did not
appear to produce the behavior that I was looking for.

Since I could not figure out a solution to the problem, I ended up creating
a new (very specific) button class that was owner-drawn. Everything appears
to be working as I want with this button.

Thank you,

Jason Richmeier

"Linda Liu [MSFT]" wrote:
Hi Jason,

Thank you for posting.

The reason of the button's border size being drawn a little wider at
runtime is that the button gets focus. If the focus is moved to other
controls on the form, the border size of the button will be restored to 1
pixel.

Hope this helps.
Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =======
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=============== =============== =============== =======

May 30 '06 #3
Hi Jason,

Thank you for your reply and the detailed additional feedback on how you
were successful in resolving this issue. Your solution will benefit many
other users.

If you have any other questions or concerns, please don't hesitate to
contact us. It is always our pleasure to be of assistance.
Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =======
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=============== =============== =============== =======

May 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2371
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked) framenewinstall.CircuitNumber.checked=false; switch (transport) { case 0: Helpdesk.innerText="No Info Needed";
14
2633
by: clintonG | last post by:
This is an appeal for peer support sent to Microsoft as will be noted in closing. The Login control does not include a Cancel button. The only option is to convert the Login control to a template which is not such a bad thing in itself but it means all other controls in the application must also be converted to templates to maintain a consistent UI. So much for writing 70% less code when foolish morons release a control with no cancel...
9
1534
by: Ant | last post by:
Hi, I'm wondering if anybody can tell me what the Validate document button is used for & how to use it. When I deliberately put some tag in that shouldn't be there, (such as an extra body tag) & use this buton, nothing happens. Can anybody tell me what it's used for? Many thanks for your help Ant
14
4972
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
1
2870
by: Janiek Buysrogge | last post by:
Hi, Is there a way to achieve the same looks for a flatstyle button in ..NET 1.1 as is done in .NET 2.0 with these properties: FlatAppearance.BorderSize = 0; FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent; FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; I'm backporting a button and now the border shows, along with the
5
3008
by: ns21 | last post by:
How can the browser back button be disabled If the form is submitting information to other pages or submitting to itself or using redirections. I tried the tweaks like history.forward(1) in each page to prevent user to navigate back but its not very effective. The server side scripting is done using ASP. you may ask that why at first place I want to disable the browser back
2
17044
by: Martijn Mulder | last post by:
I want my buttons to look like and behave like the 'Tools' in, for example, MSPaint. The border of the button is invisible, the image just 'hangs' in the gray background. When the mouse pointer is moved over the button, the border shows. Clicking the button first indents the picture and on releasing the mouse button the selection is visible with a dark border and a lighter shade of gray as background color. How can I achieve this?
6
2726
by: sgottenyc | last post by:
Hello, If you could assist me with the following situation, I would be very grateful. I have a table of data retrieved from database displayed on screen. To each row of data, I have added action buttons, such as "Edit", "Add", and "Comment". Since I do not know how many rows of data will be retrieved - and therefore how many buttons I need - I am using button arrays for each button, like so: echo "<input type=\"submit\"...
7
1300
by: =?Utf-8?B?QW50?= | last post by:
Hi, If I place a button on either a Web form or an HTML form, when I run the page in a browser, the button stretches right across the screen. This happens with our Enterprise Visual Studio at work & the Web developer Express edition I have at home. Has anybody experienced this problem? Many thanks for any ideas on how to fix it.
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.