.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Disposing when hower AND CTRL is activated AND left mouse button is pressed ????

Posted By:      Posted Date: October 24, 2010    Points: 0   Category :Windows Application

I want to let the user get rid of some designelements (PictureBoxes) on a form very fast.

This code can do it IF the user holds down the CTRL-key AND moves the mouse cursor over the designelements.

    private void signal_MouseHover(object sender, EventArgs e)
      Cursor.Current = Cursors.Hand;
      if (commonThings.ctrlActivated)

I have two problems witch I can't solve:

1) I want to secure wrong deleting of designelements by ALSO test that the LEFT-mouse key is pressed togather with CTRL (there is no "buttons" with the e !)

2) the Hover-event is a little delayed, so the deleting is in fact a little slow

How can this be done ?


Best regards KSor, Denmark

View Complete Post

More Related Resource Links

Selecting Datagrid Row when Right mouse button is Pressed.


How can i select the datagrid row when i click the right mouse button. I need to show the context menu in the datagrid but i am able to generate the context menu but selected row i not changing.

How can i solve this issue.


Saugat K.C.

How can I align Left the text into a Button?

I've tried: Code Snippet Button button = new Button(); button.Width = 200; TextBlock textBlock = new TextBlock(); textBlock.Text = "Aligned text" textBlock.TextAlignment = TextAlignment.Left; button.Content = textBlock;   but it is not working.

two functions with same mouse button

i allow the user to rotate with left and move the image around the canvas with  right mouse button. i assign a bool value to know which mouse button was pressed and then move to there mouseMove functions, is there a way to do this with only on mouse button as i need other button for other purpose?

Handling Ctrl + Shift + Click on Button control

Hi All, I have to Button control in my Windows form. I have to handle 2 types of click events on this button. 1. Ctrl + Shift + Click //Allow the user to do some special task. 2. Click //Allow the user to perform normal task only. How could I handle Ctrl + Shift + Click ? Please help me out.

Open ContextMenuStrip on left mouse click on NotifyIcon

Hi,I was working with an application and faced this problem, I have this code :public partial class Form2 : Form    {        public Form2()        {            InitializeComponent();        }        private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)        {            if (e.Button == MouseButtons.Left)            {                contextMenuStrip1.Show(this, Control.MousePosition); // Or any other overload            }        }        private void Form2_Load(object sender, EventArgs e)        {            notifyIcon1.Icon = Icon;        }    }Here, in design mode, i have set contextMenuStrip1 as notifyIcon1's ContextMenuStrip. When I right click on notifyIcon1, it opens the context menu and when I click somewhere else, it closes. But with my code opens the contextmenu on left click and when I open context menu that way, it shows in taskbar and doesn't close when I click some where else.In short, I want to open contextmenustrip when user left clicks and right clicks on the notifyicon and it works well with right click by default but not with left click. And I want to avoid using SendMessage to send left click message.Is there any way I can work this out?

Keeping a button pressed


hey everyone

I have a question about button behavior.

There is a left column with a stackpanel (vertical) and I've created a rectangle , changed some settings (what this guy did http://www.youtube.com/watch?v=6d6yWhWH4U4) .

Now I have the buttons and each behavior is ok, changed some colors in onmouseover and pressed.

I want to keep a button pressed once it has been clicked to view a panel. Kind of a tab control but the tabs are buttons.

Don't know if it makes sense or not, or if there is another way to get this done, I'm all ears.


Thanks in advance

kind regards




how to show footertemplate textbox value in another textbox on button mouse over


Hi everyone..THis is my aspx code

<asp:TextBox id="FooterTB" runat="server" Width="89px" Text='<%# DataBinder.Eval(Container, "DataItem.2") %>' Height="18px" ForeColor="Teal" Font-Size="10pt" Font-Names="Palatino Linotype" Font-Bold="True"></asp:TextBox> 

<asp:TextBox ID="TextBox1" runat="server" Style="z-index: 130; left: 122px; position: absolute;
            top: 5px" Font-Bold="True" Font-Names="Palatino Linotype" Font-Size="10pt" ForeColor="Teal" ></asp:TextBox>

<asp:Button ID="Button2" runat="server" BackColor="Transparent" BorderColor="Transparent"
                BorderStyle="Dashed" BorderWidth="1px" Font-Bold="True" Font-Names="Palatino Linotype"
                Font-Size="10pt" ForeColor="#FFFFFF" Height="40px" OnClick="Button2_Click" Style="z-index: 100;
                left: 162px; background-image: url(images/btn_5.png); position: absolute; top: 20px;
                background-color: transparent" Text="Save" Width="94px

CustomValidator which button pressed


I am CustomValidator to vlidate some data.There are 3 static buttons and some dynamically creating buttons in that page.

I just need to check validation when I press the save button.For all other button click I do not want to call the validation.
How do I tell that in the Validation function?

<asp:CustomValidator ID="CustomValidator1" runat="server"
        ErrorMessage="CustomValidator" ControlToValidate="DropDownList1"
         ClientValidationFunction="MyCustomValidation" ></asp:CustomValidator>

 function MyCustomValidation(objSource, objArgs)

//Proceed if the control pressed is cmdSave button.

    var Specialty = document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].text;

    if (Specialty == "Select an option")
objArgs.IsValid = false;
objArgs.IsValid = true;


MediaElement - Video freeze after Ctrl+Alt+Delete is pressed



Why do my video frozen when I do Ctrl+alt+delete and go back to the WPF application? Any idea?

string videoSource = "somevideofile";
MediaElement HomePageVideo;

void init()
  HomePageVideo.Source = new System.Uri(videoSource);

  HomePageGrid.IsEnabled = true;
  HomePageGrid.IsHitTestVisible = true;
  HomePageGrid.Opacity = 1;
  HomePageGrid.Visibility = Visibility.Visible;


void play()
   HomePageVideo.Position = new TimeSpan(0, 0, 18);

<Grid Name="HomePageGrid" Visibility="Hidden" Background="Black" Opacity="0">
  <MediaElement Name="HomePageVideo" Width="1280" Height="720" LoadedBehavior=

how to detect enter button pressed in private void button_click()


Hi, I am currently doing a project which control an external software using visual studio 2005. There is a button in the form. after I press the button, an external software will be opened. I am able to control it using mouseclick and sendkeys method. however, I need also to detect the enter button pressed by the user. Is there any idea??

For example

private void button1_Click( object sender, EventArgse)


    if(enter button pressed by user)





what can I write in the If statement?? Or I need to put other command in order to detect the enter button pressed??





Why nothing happens when PasswordRecovery submit button pressed?

<asp:PasswordRecovery runat="server" id="passwordrecovery" BackColor="white" BorderColor="#CCCC99" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="1em" QuestionLabelText="Question: In what city were you born?" QuestionLabelStyle="z-index:25" cssclass="square" UserNameInstructionText="To receive your password, first enter your User Name :" SuccessPageUrl="success.aspx">
	<InstructionTextStyle Font-Italic="True" ForeColor="Black" />
		<table id="user" class="passwordrecovery" border="0" cellpadding="5" cellspacing="0" style="border-collapse:collapse;">
				<table border="0" cellpadding="16">
					<tr class="titlebar">
						<td align="center" colspan="2" class="titlespacing"></td>
						<td align="center" colspan="2" style="color:Black;font-style:italic;">
						To receive your password, first enter your User Name :</td>

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

A Simple and Extensible Radio Button Style GridView

The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

How to highlight datagrid or GridView row on mouse over?

This article will show how you can Ajax with GridView to display popup messages when mouse moves over certain column. In the demo project I have added first column as an image column with a help icon in it. This kind of implements a feature that if you want more information about the row you can move mouse over this icon, a asynchronous request is sent to server for data about that row and when call returns the returned message is show as a popup message.

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Radio Button Event

Here I have explained the events of radio button with javascript.
Let me explain the scenarion first,
We are having two radio button say radioobtn1 and radiobtn2. If I click on the button 1 then I need to show one DIVor FORM. same as when I click on radiobtn 2. I have given the code for the above scenarion.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend