vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
sevDataGrid - Gönnen Sie Ihrem SQL-Kommando diesen krönenden Abschluß!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Visual-Basic Einsteiger
Re: Kalender erstellen 
Autor: Zardoz
Datum: 12.06.11 18:58

Hallo Oly,
erweitere den Code mal so:
Private Color1&(), BlueDay() As Boolean
 
Private Sub Form_Load()
 
  Call Kalender
 
End Sub
 
Private Sub Kalender()
 
  Dim Tage&, Jahr&, i&, j&, WT&
  Dim Dtm1 As Date, Dtm2 As Date
 
  Jahr = Year(Now)
  With MSFlexGrid1
    .Redraw = False
    .Clear
    .Rows = 13
    .Cols = 38
    .FixedRows = 1
    .FixedCols = 1
    ReDim Color1(.FixedRows To .Rows - 1, .FixedCols To .Cols - 1)
    ReDim BlueDay(.FixedRows To .Rows - 1, .FixedCols To .Cols - 1)
    .Font.Size = 14
    .Font.Bold = True
    .ColAlignment(-1) = flexAlignCenterCenter
    .ColWidth(-1) = 40 * Screen.TwipsPerPixelX
    .RowHeight(-1) = 30 * Screen.TwipsPerPixelX
    .ColWidth(0) = 120 * Screen.TwipsPerPixelX
    .ColAlignment(0) = flexAlignLeftCenter
    .Row = 0
    .Col = 0
    .CellAlignment = flexAlignCenterCenter
    .TextMatrix(0, 0) = "> " & Jahr & " <"
    .ScrollTrack = True
    .ScrollBars = flexScrollBarBoth
    For i = .FixedCols To .Cols - 1
      .TextMatrix(0, i) = WeekdayName(1 + ((i - 1) Mod 7), True, vbMonday)
    Next i
    For i = 1 To 12
      Dtm1 = "01." & Format$(i, "00") & "." & Jahr
      If i = 12 Then
        Tage = 31
      Else
        Dtm2 = "01." & Format$(i + 1, "00") & "." & Jahr
        Tage = DateDiff("d", Dtm1, Dtm2)
      End If
      WT = Weekday(Dtm1, vbMonday)
      .TextMatrix(i, 0) = MonthName(i, False)
      For j = 1 To Tage
        .TextMatrix(i, j + WT - 1) = j
      Next j
    Next i
    .FillStyle = flexFillRepeat
    For i = .FixedRows To .Rows - 1 Step 2
      .Row = i
      .Col = .FixedCols
      .RowSel = i
      .ColSel = .Cols - 1
      .CellBackColor = RGB(255, 255, 222)
    Next i
    For i = 7 To .Cols - 1 Step 7
      .Row = .FixedRows
      .Col = i
      .RowSel = .Rows - 1
      .ColSel = i
      .CellBackColor = RGB(255, 160, 160)
      .CellForeColor = vbWhite
    Next i
    .FillStyle = flexFillSingle
    For i = .FixedRows To .Rows - 1
      .Row = i
      For j = .FixedCols To .Cols - 1
        .Col = j
        Color1(i, j) = .CellBackColor
      Next j
    Next i
    .Row = .FixedRows
    .Col = .FixedCols
    .ZOrder vbBringToFront
    .Redraw = True
  End With
 
End Sub
 
Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As _
  Single, y As Single)
 
  Dim i&, j&, C1&, C2&, S1&, S2&
 
  If Button = vbLeftButton Then
    With MSFlexGrid1
      .Redraw = False
      C1 = .Col
      C2 = .ColSel
      S1 = IIf(.RowSel < .Row, -1, 1)
      S2 = IIf(.ColSel < .Col, -1, 1)
      For i = .Row To .RowSel Step S1
        .Row = i
        For j = C1 To C2 Step S2
          If Trim$(.TextMatrix(i, j)) <> "" Then
            .Col = j
            If BlueDay(i, j) = True Then
              .CellBackColor = Color1(i, j)
            Else
              .CellBackColor = RGB(128, 128, 255)
            End If
            BlueDay(i, j) = Not BlueDay(i, j)
          End If
        Next j
      Next i
      .Redraw = True
    End With
  End If
 
End Sub

Gruss,

Zardoz

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Kalender erstellen3.422Oly06.06.11 13:56
Re: Kalender erstellen2.079Zardoz06.06.11 15:18
Re: Kalender erstellen2.835Oly07.06.11 00:28
Re: Kalender erstellen1.767Oly11.06.11 18:18
Re: Kalender erstellen1.748Zardoz11.06.11 22:21
Re: Kalender erstellen1.695Oly12.06.11 11:37
Re: Kalender erstellen1.623Zardoz12.06.11 19:13
Re: Kalender erstellen1.516Oly13.06.11 13:54
Re: Kalender erstellen1.543Oly12.06.11 14:00
Re: Kalender erstellen1.603Zardoz12.06.11 18:58
Re: Kalender erstellen1.469Oly13.06.11 13:16
Re: Kalender erstellen1.443Zardoz14.06.11 13:51
Re: Kalender erstellen1.559Oly14.06.11 14:43
Re: Kalender erstellen1.438Zardoz16.06.11 14:05
Re: Kalender erstellen1.517Oly17.06.11 07:33
Re: Kalender erstellen1.507Zardoz19.06.11 20:17
Re: Kalender erstellen1.497Oly19.06.11 20:21
Re: Kalender erstellen1.472Franki12.06.11 03:03

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel