This is a detailed tutorial about making a simple screen capture application in C#. You will be learning how to take a screenshot, view it and save it.
This tutorial will show you how to draw a rectangle in C# using mouse. You can normally draw a rectangle by putting the values manually. But that doesn’t always work. Sometimes you’ll require the rectangle to be drawn automatically (without putting values manually). This tutorial will show you how to do that. Let’s begin: (more…)
I was working on an App and needed Drag & Drop support for it. I thought it’ll be complicated but its very easy. Here’s how its done:
For this tutorial I’ll be using a listBox. You can use any control but make sure you set the “AllowDrop” to “true“.
Select the listBox and add the DragEnter event.
Add this code:
private void listBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
// This will make sure that a file has been dropped and not text, folders or anything else
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
// This will allow the files to be dragged into the control
e.Effect = DragDropEffects.All;
The above code first makes sure that files are dragged and not text, folders etc; and then allows the files to be dragged into the control.