Click here to Skip to main content
15,892,927 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionExtending MonthCalendar Control Pin
Member 271340117-Dec-08 10:07
Member 271340117-Dec-08 10:07 
AnswerRe: Extending MonthCalendar Control Pin
Dave Kreskowiak18-Dec-08 4:03
mveDave Kreskowiak18-Dec-08 4:03 
GeneralRe: Extending MonthCalendar Control Pin
smurfman8718-Dec-08 10:45
smurfman8718-Dec-08 10:45 
GeneralRe: Extending MonthCalendar Control Pin
Dave Kreskowiak18-Dec-08 10:53
mveDave Kreskowiak18-Dec-08 10:53 
GeneralRe: Extending MonthCalendar Control Pin
smurfman8718-Dec-08 11:04
smurfman8718-Dec-08 11:04 
GeneralRe: Extending MonthCalendar Control Pin
Dave Kreskowiak18-Dec-08 16:44
mveDave Kreskowiak18-Dec-08 16:44 
GeneralRe: Extending MonthCalendar Control Pin
smurfman8719-Dec-08 3:30
smurfman8719-Dec-08 3:30 
GeneralRe: Extending MonthCalendar Control Pin
smurfman8719-Dec-08 6:09
smurfman8719-Dec-08 6:09 
So I have been messing around with the whole OnPaint and that Conversion thing where the g as graphics was added and so forth.

Here is where I am at.

I re-wrote the OnPaint Sub and included the logic from the ConvertedAnonymousMethod2 and changed the code the for the highlighteddates.foreach(addressof ConvertedAnonymousMethod2)

This is what I came up with...

Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    MyBase.OnPaint(e)
    Dim g As Graphics = e.Graphics
    'Dim backgroundRect As Rectangle
    'highlightedDates.ForEach(AddressOf ConvertedAnonymousMethod2)

    For Each [date] As HighlightedDates In highlightedDates
        Dim backgroundRect = New Rectangle([date].Position.Y * dayBox.Width + 1, _
                                           [date].Position.X * dayBox.Height + dayTop, _
                                           dayBox.Width, dayBox.Height)

        If [date].BackgroundColor <> Color.Empty Then
            Using brush As Brush = New SolidBrush([date].BackgroundColor)
                g.FillRectangle(brush, backgroundRect)
            End Using
        End If
        If [date].Bold OrElse [date].DateColor <> Color.Empty Then
            Using textFont As New Font(Font, (IIf([date].Bold, FontStyle.Bold, FontStyle.Regular)))
                TextRenderer.DrawText(g, [date].[Date].Day.ToString(), _
                                      textFont, backgroundRect, [date].DateColor, _
                                      TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)
            End Using
        End If
        If [date].BoxColor <> Color.Empty Then
            Using pen As New Pen([date].BoxColor)
                Dim boxRect As New Rectangle([date].Position.Y * dayBox.Width + 1, _
                                             [date].Position.X * dayBox.Height + dayTop, _
                                             dayBox.Width, dayBox.Height)
                g.DrawRectangle(pen, boxRect)
            End Using
        End If
    Next
End Sub


So the whole thing compiles and I can add my ExtendedMonthCalendar as an object on my test form. And it draws a calendar - with no errors.

So this becomes where I am totally dumb.

The control appears on the form, but I can't do anything with it. Ie, I have non of the original functionality of the MonthCalendar control, and I can't even code into my form the adding of dates.

The other whacky thing is that the Hard Coded Date example in the New sub, ie December 1, 2008 is always at position of top left of the calendar control and is behaving weird.

As always I apprecaite the learning.

J
QuestionHelp: ASP.NET Ajax client-side framework failed to load. [modified] Pin
Kip Smith17-Dec-08 10:00
Kip Smith17-Dec-08 10:00 
AnswerRe: Help: ASP.NET Ajax client-side framework failed to load. Pin
Christian Graus17-Dec-08 17:04
protectorChristian Graus17-Dec-08 17:04 
AnswerRe: Help: ASP.NET Ajax client-side framework failed to load. Pin
Kip Smith18-Dec-08 4:11
Kip Smith18-Dec-08 4:11 
Questionhow to send and read data through serial port using visual studio 2005? Pin
vivekmenon170617-Dec-08 8:03
vivekmenon170617-Dec-08 8:03 
AnswerRe: how to send and read data through serial port using visual studio 2005? Pin
Ben Fair17-Dec-08 8:51
Ben Fair17-Dec-08 8:51 
GeneralRe: how to send and read data through serial port using visual studio 2005? Pin
Luc Pattyn17-Dec-08 8:57
sitebuilderLuc Pattyn17-Dec-08 8:57 
QuestionOOOOOOOPS!!!!! Pin
kshincsk17-Dec-08 7:58
kshincsk17-Dec-08 7:58 
GeneralRe: OOOOOOOPS!!!!! Pin
Luc Pattyn17-Dec-08 9:00
sitebuilderLuc Pattyn17-Dec-08 9:00 
QuestionMulti User Application with Access database Pin
kshincsk17-Dec-08 7:56
kshincsk17-Dec-08 7:56 
AnswerRe: Multi User Application with Access database Pin
Dave Kreskowiak18-Dec-08 2:10
mveDave Kreskowiak18-Dec-08 2:10 
GeneralRe: Multi User Application with Access database Pin
kshincsk19-Dec-08 4:10
kshincsk19-Dec-08 4:10 
GeneralRe: Multi User Application with Access database Pin
Dave Kreskowiak19-Dec-08 12:08
mveDave Kreskowiak19-Dec-08 12:08 
GeneralRe: Multi User Application with Access database Pin
kshincsk22-Dec-08 1:05
kshincsk22-Dec-08 1:05 
GeneralRe: Multi User Application with Access database Pin
Dave Kreskowiak22-Dec-08 2:12
mveDave Kreskowiak22-Dec-08 2:12 
Question[Message Deleted] Pin
MS Lee17-Dec-08 4:22
MS Lee17-Dec-08 4:22 
AnswerRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
Tom Deketelaere17-Dec-08 4:52
professionalTom Deketelaere17-Dec-08 4:52 
GeneralRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
Jon_Boy17-Dec-08 6:09
Jon_Boy17-Dec-08 6:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.