tags:

views:

133

answers:

1

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.

A: 

I have the same problem (only in 64bit Vista and Win7), can anyone find a solution ?

Giannis
Well, my findings are.1. Although, same code will work in XP and not in Vista with Aero theme BUTThe actual problem is in the coding logic.You simply have to show the form/control and THEN set the coordinates. I have tested in Vista and Windows 7. In XP if I set the coordinates first and then show the form/control, it works fine but the same logic does not work fine in Vista/Windows 7.However, if you show the form/control first and then set the coordinates. It will work fine in XP/Windows Vista/Windows 7 with and without aero theme.
Adeel Rehman