Refresh Problem

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    21 posts
    Member since:
    Nov 2007

    Posted 17 Nov 2007 Link to this post

    Hello
    I might be doing something wrong with Calendar.. but I really do not know waht.
    I want to show some elements (dates) highlighted: All are introduced in array. And I copy/paste& modify the demo of "Element Render" to do it.
    But the problem is that after that, the calendar is like Not Enabled, but when I minimize the application and click to maximize again, it renders and is enabled, or ready to click. Is like there is a final "refresh" or "invalidate". to make a final redraw... 

    (BTW I suppose that this can be done with Specialdays... but I get problems on how to create the template... I havent found a proper example about how to inicialzate the new RadHostItem (control)... What control...is not the calendar itself.

    Thanks. And bare with me... its my first day with the controls....

    --------------------

    Private Sub RadCalendar2_ElementRender(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RenderElementEventArgs) Handles RadCalendar2.ElementRender

     

     

    'If Me.DatesList.SelectedItem Is Nothing Then

    ' Return

    'End If

    'Comprobar que e.Day.Date esta en la luista

    'Try/Catch

    Dim ProcessOK As Boolean

    Dim idx As Integer

    Try

    ProcessOK = False

    If Me._CALEN_DatesSet IsNot Nothing Then

    For idx = 0 To Me._CALEN_DatesSet.Length - 1

    If Me._CALEN_DatesSet(idx).Equals(e.Day.Date) Then

    ProcessOK = True

    Exit For

    End If

    Next

    End If

     

    If ProcessOK Then

    ' e.Element.Text = e.Day.Date.Day.ToString ''Me.radTextBox1.Text

    e.Element.DrawFill = True

    If Me._CALEN_cellBackColor = Color.Empty Then

    _CALEN_cellBackColor = e.Element.BackColor

    End If

    e.Element.ForeColor = Color.Black

    e.Element.BackColor = Color.Orange

    e.Element.BackColor2 = Color.Yellow

    ' e.Element.BackColor = _CALEN_cellBackColorSEL 'CType((CType(Me.ColorList.SelectedItem, RadComboBoxItem)).Value, Color)

    e.Element.Invalidate()

    Else

    If _CALEN_cellBackColor <> Color.Empty Then

    e.Element.BackColor = _CALEN_cellBackColor

    End If

    If Not (TryCast(e.Element, Telerik.WinControls.UI.CalendarCellElement)).Selected Then

    e.Element.DrawFill = False

    Else

    TryCast(e.Element, Telerik.WinControls.UI.CalendarCellElement).Selected = True

    e.Element.DrawFill = True

    End If

    End If

    Catch ex As Exception

    My.Application.SendError(ex, "Error", ErrorReport.MessageImage.Denied, " ")

    ProcessOK = False

    Finally

    End Try

     

    End Sub

  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 20 Nov 2007 Link to this post

    Hi Daniel,

    Thank you for writing.

    Below is a bit modified version of your code, which highlights a few dates from a list:

    ProcessOK As Boolean = False     
        
                Dim dates As List(Of DateTime) = New List(Of DateTime)()     
                dates.Add(New DateTime(2005, 10, 1, 0, 0, 0, 0))     
                dates.Add(New DateTime(2005, 10, 2, 0, 0, 0, 0))     
                dates.Add(New DateTime(2005, 10, 3, 0, 0, 0, 0))     
                dates.Add(New DateTime(2005, 10, 4, 0, 0, 0, 0))     
        
                Dim i As Integer = 0     
                Do While i < dates.Count     
                    If dates(i).Date.Equals(e.Day.DateThen     
                        ProcessOK = True     
                    End If     
                    i += 1     
                Loop     
        
                If ProcessOK Then     
                    e.Element.DrawFill = True     
        
                    If cellBackColor = Color.Empty Then     
                        cellBackColor = e.Element.BackColor     
                    End If     
        
                    e.Element.BackColor = Color.Orange     
                    e.Element.Invalidate()     
                Else     
                    If cellBackColor <> Color.Empty Then     
                        e.Element.BackColor = cellBackColor     
                    End If     
        
                    If Not(TryCast(e.Element, CalendarCellElement)).Selected Then     
                        e.Element.DrawFill = False     
                    Else     
                        (TryCast(e.Element, CalendarCellElement)).Selected = True     
                        e.Element.DrawFill = True     
                    End If     
                End If     
        
                ProcessOK = False    
     

    Please contact me if you have further questions.

    Regards,
    Boyko Markov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top