473,799 Members | 3,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form, Opacity, mouseHover.

Hi All,

I saw the paint.net program, when mouse hover, the color palette
become 100% opacity.

I try the code below, the issue is I also have some other controls
( textbox/button ) in my form, it should be a better way to do it in
fewer codes, right ?

( set all hover function to the same as form ? )

/* CODE */
private void Form1_MouseHove r(object sender, EventArgs e)
{
this.Opacity = 1;

}

private void Form1_MouseLeav e(object sender, EventArgs e)
{
this.Opacity = 0.7;
}

/* CODE */

Best regards,
Boki.

Jul 10 '07 #1
3 4297
On Jul 10, 4:45 pm, Boki <bokit...@ms21. hinet.netwrote:
Hi All,

I saw the paint.net program, when mouse hover, the color palette
become 100% opacity.

I try the code below, the issue is I also have some other controls
( textbox/button ) in my form, it should be a better way to do it in
fewer codes, right ?

( set all hover function to the same as form ? )

/* CODE */

private void Form1_MouseHove r(object sender, EventArgs e)
{
this.Opacity = 1;

}

private void Form1_MouseLeav e(object sender, EventArgs e)
{
this.Opacity = 0.7;
}

/* CODE */

Best regards,
Boki.
I have tried to setup all hover function pointer to same one. but got
latency, no good result.

Boki.

Jul 10 '07 #2
I had the same problem, but finally leaved the whole thing to a timer that
monitors the mouse location each 10 millisecond and changes the form opacity
if the mouse is over the form or not:
// Method to see if the cursor is over your form or not:

private bool HitTest(Form frm)
{
if (Cursor.Positio n.X < frm.Width + frm.Left && Cursor.Position .X >
frm.Left)
{

if (Cursor.Positio n.Y < frm.Height+ frm.Top && Cursor.Position .Y >
frm.Top)
{
return true;

}
}
return false;
}

// Create Timer that monitors cursor location each 10 millisecond and name
it "timerOpaci ty"
// then:

private void timerOpacity_Ti ck(object sender, EventArgs e)
{
if (HitTest(this))
{
this.Opacity = 1.0;
}
else
{
this.Opacity = 0.4;
}
}

"Boki" <bo******@ms21. hinet.netwrote in message
news:11******** **************@ m37g2000prh.goo glegroups.com.. .
On Jul 10, 4:45 pm, Boki <bokit...@ms21. hinet.netwrote:
>Hi All,

I saw the paint.net program, when mouse hover, the color palette
become 100% opacity.

I try the code below, the issue is I also have some other controls
( textbox/button ) in my form, it should be a better way to do it in
fewer codes, right ?

( set all hover function to the same as form ? )

/* CODE */

private void Form1_MouseHove r(object sender, EventArgs e)
{
this.Opacity = 1;

}

private void Form1_MouseLeav e(object sender, EventArgs e)
{
this.Opacity = 0.7;
}

/* CODE */

Best regards,
Boki.

I have tried to setup all hover function pointer to same one. but got
latency, no good result.

Boki.


Jul 10 '07 #3
On Jul 10, 5:08 pm, "herr" <h...@hotmail.c omwrote:
I had the same problem, but finally leaved the whole thing to a timer that
monitors the mouse location each 10 millisecond and changes the form opacity
if the mouse is over the form or not:

// Method to see if the cursor is over your form or not:

private bool HitTest(Form frm)
{
if (Cursor.Positio n.X < frm.Width + frm.Left && Cursor.Position .X >
frm.Left)
{

if (Cursor.Positio n.Y < frm.Height+ frm.Top && Cursor.Position .Y >
frm.Top)
{
return true;

}
}
return false;

}

// Create Timer that monitors cursor location each 10 millisecond and name
it "timerOpaci ty"
// then:

private void timerOpacity_Ti ck(object sender, EventArgs e)
{
if (HitTest(this))
{
this.Opacity = 1.0;
}
else
{
this.Opacity = 0.4;
}

}
"Boki" <bokit...@ms21. hinet.netwrote in message

news:11******** **************@ m37g2000prh.goo glegroups.com.. .
On Jul 10, 4:45 pm, Boki <bokit...@ms21. hinet.netwrote:
Hi All,
I saw the paint.net program, when mouse hover, the color palette
become 100% opacity.
I try the code below, the issue is I also have some other controls
( textbox/button ) in my form, it should be a better way to do it in
fewer codes, right ?
( set all hover function to the same as form ? )
/* CODE */
private void Form1_MouseHove r(object sender, EventArgs e)
{
this.Opacity = 1;
}
private void Form1_MouseLeav e(object sender, EventArgs e)
{
this.Opacity = 0.7;
}
/* CODE */
Best regards,
Boki.
I have tried to setup all hover function pointer to same one. but got
latency, no good result.
Boki.
Thanks, I think it is doable.

But I still thinking the Paint.Net implementation, it works well, and
I think they didn't use a timer to check it.
I am wondering if any other methods. :)

Boki.

Jul 11 '07 #4

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

Similar topics

5
1626
by: Roger | last post by:
Hi All, When the user closes my app I would like the form to disapear slowly, I have tried using the form opacity property in a loop driven by a timer. The form disapears but the app does not end (I have to right click the icon in the task bar and close it). Any idea why? I have this code in the timer event: formdim = formdim - 0.01 Me.Opacity = formdim If formdim = 0.01 Then Timer1.Enabled = False : End
0
967
by: Frank Rizzo | last post by:
Hello, I have a image assigned to the form. Is it possible to implement a feature similar to Form.Opacity for controls. I'd like the controls to be partially transparent, so that the background is partially visible. Is something like this possible? Regards
5
272
by: Brian Shafer | last post by:
Ok, I was playing around with this feature. have it set at 100% now.. but still looks like it is 50% when I run it.... What other feature did i set that is preventing this from resetting? Brian
4
1822
by: tommaso.gastaldi | last post by:
I found useful to use transparent controls like: '---------------------------------------------------------------------------------- Public Class UserControlTransp Inherits System.Windows.Forms.UserControl #Region " Windows Form Designer generated code " .... #End Region
1
1627
by: Cylix | last post by:
I have a form with a irregular background image, let say a circle. I would like the form shows and that fade out and close slowly. I have already done the fade out part by the timmer to set the form opacity. However, I set the transparent key of the form be white in color, when the form start to fade out, The white part of the form is not transparent anymore, How can the white color part of the form keep transparent?
1
2140
by: Oscar | last post by:
Hi, I would like to set the opacity of a form but I dont want the components on the form beeing affected. I just want to have a transparent bakground with non transparant button, labels etc. Is this possiable? //Oscar
16
7463
Atran
by: Atran | last post by:
Hello EveryBody, I write this code but the code not work: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;
3
5014
by: Sin Jeong-hun | last post by:
As far as I know if I change the form's opacity, every control on the form also inherits that opacity. But in many real applications (not application programs), we see opaque text (100% opacity) on a traslucent background, for example text messages on TV. Or look at the title bar text of Aero. Background is translucent but the text is opaque. Is it possible to use 100% opaque text on a traslucent form?
1
1405
by: marciojersey | last post by:
Hi everyone. I'm having a problem with form opacity in my c# application. I have a window with a vrml viewer com control and whenever the window goes into layered mode, the vrml viewer is rendered onto whatever is behind my window instead of its container window. If my window is hovering over the desktop for example, when the window goes into layered mode, the vrml viewer will be rendered onto the desktop. When this happens, my window obscures...
0
9687
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
9541
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
10485
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
10231
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
9073
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...
1
7565
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
5463
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...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
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.