bonjour à tous,

Je suis sous D7 et j'utilise les TdatetimePicker afin de sélectionner une date et les numéro de semaine me sont indispensables.

Je fais donc afficher les semaines avec le code suivant dans le dropdown

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var
  LStyle: Integer;
  LReqRect: TRect;
  LMaxTodayWidth: Integer;
begin
  with Sender do
  begin
    // set style to include week numbers
    LStyle := GetWindowLong(CalendarHandle, GWL_STYLE);
    SetWindowLong(CalendarHandle, GWL_STYLE, LStyle or MCS_WEEKNUMBERS);
    FillChar(LReqRect, SizeOf(TRect), 0);
    // get required rect
    Win32Check(MonthCal_GetMinReqRect(CalendarHandle, LReqRect));
    // get max today String width
    LMaxTodayWidth := MonthCal_GetMaxTodayWidth(CalendarHandle);
    // adjust rect width to fit today String
    if LMaxTodayWidth > LReqRect.Right then
      LReqRect.Right := LMaxTodayWidth;
    // set new height & width
    SetWindowPos(CalendarHandle, 0, 0, 0, LReqRect.Right, LReqRect.Bottom,
      SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOZORDER);
  end;
end;
Cela fonctionne bien sous XP ou serveur 2003 mais j'ai un problème de numéro de semaine sous Vista ou 2008. La première semaine (du 4 au 10 janvier) commence à 2 et décale donc toutes les semaines affichées.
La largeur du DateTimePicker n'est plus assez grande non plus. Je suis obligé de l'élargir.

Quelqu'un a-t-il une solution ?
Faut-il tapper sur les programmeurs de Microsoft pour qu'ils corrigent ?

merci de votre aide