Positioning problem in VIsta when Aero Theme is enabled

Posted by Adeel Rehman on Stack Overflow See other posts from Stack Overflow or by Adeel Rehman
Published on 2009-08-18T14:59:23Z Indexed on 2010/06/01 12:03 UTC
Read the original article Hit count: 374

Filed under:
|
|

Hi, I have a Windows form which has tab pages. On a Tab Page, I have a Combo Box. When I click the combobox a drop down opens up just below the combo box to give the impression of a drop down. The drop down is a windows form and this is how I set its position

Popup.Location = control.PointToScreen(parentcontrol.PointToClient(new System.Drawing.Point(0, control.Height)));

Popup = drop down that opens below the combo box (Windows Form) control = my combo box (Combo Box) parentcontrol = the windows form on which the control is present (Parent Form)

Problem:- The X coordinate is not plotted correctly on the screen with Aero theme enabled. This works perfectly fine on XP (with some variance in y due to tablelayout panel i assume). But when i use the same code on Vista with Aero theme enabled the x-cordinate wanders away about 20-30 pixels. If I Turn Aero theme off on Vista, it works fine. I have found the X and Y coordiantes calculated in both cases are the same. But the way Vista draws these coordinates on the screen (when aero theme is enabled) is different.

Is there any solution to this problem?

Thanks, Adeel Rehman.

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms