473,666 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Borderless Button

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?
Nov 20 '06 #1
2 17036
Hey Martijn...
If I understand correctly what you try to achieve:

- Don't use a Button control, but a CheckBox control.

- At design time, set the following properties:
-- Appearance = Button
-- FlatAppearance. BorderColor = whatever you like
-- FlatAppearance. BorderSize = 0
-- FlatAppearance. MouseDownBackCo lor = whatever you like
-- FlatAppearance. MouseOverBackCo lor = whatever you like
-- FlatStyle = Flat

At runtime you can catch the MouseEnter and MouseLeave events if you
like, to display a border when necessary. And catch the CheckedChanged
event (for example) to keep the border around when the button is pressed
(checked).
private void checkBox1_Check edChanged( object sender, EventArgs e )
{
checkBox1.FlatA ppearance.Borde rSize =
(( sender as CheckBox ).Checked ? 1 : 0);
}

private void checkBox1_Mouse Enter( object sender, EventArgs e )
{
checkBox1.FlatA ppearance.Borde rSize = 1;
}

private void checkBox1_Mouse Leave( object sender, EventArgs e )
{
checkBox1.FlatA ppearance.Borde rSize =
( ( sender as CheckBox ).Checked ? 1 : 0 );
}
Of course, you can finetune this to your liking.

Have fun.

David

Martijn Mulder wrote:
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?

Nov 20 '06 #2
Martijn,

The button FlatStyle property can be set to Popup that has the behaviour you
are after. However there is one small problem that the button shows border
evetn when the mouse is not over it. I haven't try to work around this
problem and I think that it might be possible removing the border. I don't
know though.

The behavior that you described was implemented in the old ToolBar
component. It is still there and you can use it, but you need to install it
manually in the toolbox. I tried it and it works as you want with the small
problem that the 3D border that shows up when the mouse hovers over the
button has rounded corners.
--
Stoitcho Goutsev (100)

"Martijn Mulder" <i@mwrote in message
news:45******** *************** @news.wanadoo.n l...
>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?

Nov 20 '06 #3

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

Similar topics

6
15077
by: Nikki | last post by:
Hi, Can anybody help me in solving this problem. I m developing an application in which the main application form is borderless. now i m not able to move the application form with the help of mouse. Thanks,
5
2408
by: trint | last post by:
I've tried everything... function showRemote() { self.name = ""; // names current window as "main" var windowprops = "border=0,titlebar=0,toolbar=0,location=0,directories=0,status=0, " + "menubar=0,scrollbars=0,resizable=0,width=256,height=403"; OpenWindow = window.open("logon2.aspx", "remote", windowprops); // opens remote control
4
6615
by: David Gouge | last post by:
Hi All, I have a borderless form that i can drag around fine when dragging anywhere on the form by using the following code: protected override void WndProc(ref Message m) { const int WM_NCHITTEST = 0x84; const int HTCLIENT = 0x01;
5
2538
by: ThunderMusic | last post by:
Hi I'm currently developping a skinnable form by using a borderless form (Form.FormBorderStyle=None). Is it the right way to go in the first place? if it is. Assuming that when there is no border to the form there is no context menu when you right-click on your form in the start bar too (the one with Restore, Move, Size, Close et al.)... How can I make this context menu work again? Is there a way to tell the form to make it work even if...
1
2707
by: SeanR | last post by:
Hi, I wasn't happy with the customisability of the standard Windows form, so I decided to implement my own. Basically what I did was extend a borderless form and add my own borders and caption bar to it so it looks and functions like a normal bordered sizable form. However the only thing I can't figure out is maximising. When I maximise my form, it fills up the whole screen and covers up the Windows taskbar. I can understand why you...
3
2194
by: Rick | last post by:
I know I seen this before but IO cannot find it. How to you drag a borderless form in Vb.net 2005
8
1965
by: James Arnold | last post by:
I currently have a borderless form, which I am subclassing to allow dragging & dropping: Protected Overrides Sub WndProc(ByRef m As Message) Select Case m.Msg Case 132 'Click & Drag Form m.Result = New IntPtr(2) 'Continue message MyBase.WndProc(m) End Select
5
3276
by: sierra7 | last post by:
Hi I have been writing Access applications for some years now and have moved away from from the 'Switchboard' type of opening form to using a menubar accross the top of the screen and borderless form used as a 'background', which shows a graphic, revision status & contact details etc The menu-bar works fine when clicked by a mouse, but beeps when using an Alt+ letter 'acceleration' key, unless another user-form is already open over the top...
2
4388
by: plevintampabay | last post by:
I have a borderless form in C#. The form has an icon specified in its properties and I also have the same icon specified for the project in the project properties. When I had a border on the form, the icon was displayed in the task bar. But when I set the border to None, the icon no longer displays. The taskbar button only shows the text name of my program. How can I get the icon to display in the taskbar for a borderless form? ...
0
8454
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
8363
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
8883
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...
0
8645
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...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5672
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
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.