Thunderbolt-equipped iMacs prior to iMac (Retina 5K, 27-inch, Late 2014) (see this document), like your iMac (Mid 2011), support Target Display mode:
Target Display Mode lets you use your iMac as the external display for
another, “primary” computer.
Thunderbolt-only solution
NOTE: This won't work for iMac (Retina 5K, 27-inch, Late 2014) and later iMac models as they don't support Target Display Mode.
If you happen to own a laptop with a Thunderbolt port follow these simple steps to extend your display (Thunderbolt to Thunderbolt cable required) (from KB PH4469):
- Connect the Thunderbolt cable to the Thunderbolt ports on each computer.
- Make sure the iMac and the primary computer are turned on and awake.
- Press ⌘F2 on the keyboard of the iMac.
(As a side note: Older iMacs with Mini DisplayPort also support Target Display Mode. The steps to configure and enable Target Display mode are very similar.).
A comment on DVI to Thunderbolt adaptors
You can't use Mini DisplayPort to DVI or VGA adaptors:

to connect a computer with a DVI/VGA port to a Thunderbolt display (from this thread):
I can confirm that Mini DisplayPort to DVI converter works ONLY from a
Mini DisplayPort computer port to a DVI display. The reverse direction
is not supported by those converters,
There is some hope, though, as the post goes on to say:
but there are other much more
expensive ones that will convert DVI computer ports to Mini
DisplayPort display.
The poster is probably refering to a product mentioned earlier in the thread: the Kanex C247D Single-Link DVI to Mini DisplayPort Converter, advertised like this:
Connect a (...) LED Cinema Display to your DVI-equipped
MacBook Pro, Mac Mini, or PC with this (...) Kanex solution.
However, opinions diverge on whether it will work with a Thunderbolt display at all:
I am sure that Kanex don't do anything that will help you no matter
how expensive it may be.
As far as I am aware, and I have done a lot of reading about this, you
can connect an older display to the new Thunderbolt port of a new MAC
but you CANNOT connect the Thunderbolt display to anything other than
a MAC with a Thunderbolt port. The Kanex thing works from a
Thunderbolt port into an older display, DVI or whatever but you cannot
convert MAC DVI into Thunderbolt......I think
I've noticed that the LED Cinema Display is listed as a Mini DisplayPort display (from http://support.apple.com/kb/SP502):

so the adaptor may indeed only work with Mini DisplayPort displays, not with Thunderbolt displays, and as far as I can tell, your iMac will act like a Thunderbolt display.
It's up to you to try it, although $129.90 (as of this writing) is a steep price to pay for the Kanex adaptor just to test it.
Software-based solution
If the solutions described above aren't feasible or cost-effective, you can use several software solutions. One is Air Display:
Use your iPad, iPhone, Android, Mac or Windows PC as a second (or
third) monitor with no messy cables or wires

There is a free trial version here.
Note: Windows 7 Starter edition is not supported.