Quantcast
Channel: c# - If condition: mouse key clicked and bAlpha - Stack Overflow
Viewing all articles
Browse latest Browse all 3

c# - If condition: mouse key clicked and bAlpha

$
0
0

In the topic below there were some suggestions on how to create a switch for two methods
with one button:
how-can-i-switch-between-two-methods-in-one-button-with-every-click

How could I achieve something like this with one specific Mouse button(switching between two LayeredWindowsAttributes for example)?

Or how could I code the following?
Right Clicked && bAlpha = 10: Set transparency value to 255
Right Clicked && bAlpha = 255: Set transparency value to 10

The main problem here is probably that I don't know how I check for bAlpha as if condition.

This is how I set the bAlpha value:

private void Form1_MouseDown(object sender, MouseEventArgs e)
  {
   SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) | WS_EX_LAYERED);

        if (e.Button == MouseButtons.Right)
        {
            SetLayeredWindowAttributes(Handle, 0, 10, LWA_ALPHA);
            //SetLayeredWindowAttributes(Handle, 0, 255, LWA_ALPHA);
        }
  }

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images