AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi DateTimePicker, Kalenderwoche, Vista, falsche Darstellung

DateTimePicker, Kalenderwoche, Vista, falsche Darstellung

Ein Thema von hoika · begonnen am 28. Jul 2008 · letzter Beitrag vom 11. Okt 2010
 
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.277 Beiträge
 
Delphi 10.4 Sydney
 
#1

DateTimePicker, Kalenderwoche, Vista, falsche Darstellung

  Alt 28. Jul 2008, 16:10
Hallo #,

mit folgendem Code (aufgerufen im OnDropDown)
kann zur Laufzeit bei einem DateTime Picker
links die Kalenderwoche zusätzlich angezeigt werden.



Delphi-Quellcode:
{
name:
  DTP_AddWeekNumber
usage:
  to add a week number column to the calendar
parameter:
  theDTP
return parameter:
return:
notes:
  - method mustbe called in OnDropDown
dunit: no
}

procedure DTP_AddWeekNumber(theDTP: TDateTimePicker);
const
  MCM_GETMAXTODAYWIDTH = MCM_FIRST + 21;
var
  Style: LongInt;
  hDTP: THandle;

  r: TRect;
  intTodayWidth: Integer;
begin
// Notlösung unter Vista
// if IsWindowsVista then Exit;
  
  {to get a handle of calendar}
  hDTP := DateTime_GetMonthCal(theDTP.Handle);

  {change a style}
  Style := GetWindowLong(hDTP, GWL_STYLE);
  SetWindowLong(hDTP, GWL_STYLE, Style or MCS_WEEKNUMBERS);

  {now we must change the width for calendar because week numbers shifted all strings}
  {1. to get the required rect }
  r := Rect(0, 0, 0, 0);
  SendMessage(hDTP, MCM_GETMINREQRECT, 0, Longint(@r));

  {2. to get the maximum width of the "today" string}
  intTodayWidth := SendMessage(hDTP, MCM_GETMAXTODAYWIDTH, 0, 0);

  {3. adjust rect width to fit the "today" string }
  if intTodayWidth > r.Right then
    r.Right := intTodayWidth;

  {4. to set new the height and width }
  SetWindowPos(hDTP, 0,
              r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top,
              SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOZORDER);
end; { DTP_AddWeekNumber }
Unter Vista wird aber der Sonntag nicht mehr komplett angezeigt ;(

Hat jemand die KW-Anzeige unter Vista schon zum Laufen bekommen ?
Meine "Notlösung": unter Vista nicht anzeigen ;(


Heiko
Heiko
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz