Creating A Simple DotNet MonthCalendar And Changing Its Colors

new.gif NEW in 3ds Max 9: The following example creates a simple dialog with a MonthCalendar dotNet control and assigns a mousedown event handler which prints the properties, methods and events:

Script:

rollout test "test" height:200 width:220

(

?dotNetControl f1 "MonthCalendar" align:#left height:180 width:200

?on f1 mousedown val do

?(

??format "in mousedown handler: arg: %\n" val

??format "showproperties:\n"

??showproperties val

??format "showmethods:\n"

??showmethods val

??format "showevents:\n"

??showevents val

??format "getpropnames : %\n" (getpropnames val)

??format "prop values:\n"

?)

)

createdialog test escapeEnable:true

?

?

After evaluation, we have a dialog showing a Month Calendar DotNet Contol with default settings. We can see the constructor of the control using the dotnet.showconstructors() method:

--see the constructor of the control

dotnet.showConstructors test.f1

System.Windows.Forms.MonthCalendar()

true

?

dotNet_MonthCalendar_Default.gif

?

Now let's change the calendar's appearance by modifying its colors:

--First we list all properties of the control

--and look to find those controlling some of its colors:

showproperties test.f1

.AccessibilityObject : , read-only

.AccessibleDefaultActionDescription :

.AccessibleDescription :

.AccessibleName :

.AccessibleRole :

.AllowDrop :

.Anchor :

.AnnuallyBoldedDates :

.AutoScrollOffset :

.AutoSize :

.BackColor :

.BackgroundImage :

.BackgroundImageLayout :

.BindingContext :

.BoldedDates :

.Bottom : , read-only

.Bounds :

.CalendarDimensions :

.CanFocus : , read-only

.CanSelect : , read-only

.Capture :

.CausesValidation :

.CheckForIllegalCrossThreadCalls : , static

.ClientRectangle : , read-only

.ClientSize :

.CompanyName : , read-only

.Container : , read-only

.ContainsFocus : , read-only

.ContextMenu :

.ContextMenuStrip :

.Controls : , read-only

.Created : , read-only

.Cursor :

.DataBindings : , read-only

.DefaultBackColor : , read-only, static

.DefaultFont : , read-only, static

.DefaultForeColor : , read-only, static

.DisplayRectangle : , read-only

.Disposing : , read-only

.Dock :

.Enabled :

.FirstDayOfWeek :

.Focused : , read-only

.Font :

.ForeColor :

.Handle : , read-only

.HasChildren : , read-only

.Height :

.ImeMode :

.InvokeRequired : , read-only

.IsAccessible :

.IsDisposed : , read-only

.IsHandleCreated : , read-only

.IsMirrored : , read-only

.LayoutEngine : , read-only

.Left :

.Location :

.Margin :

.MaxDate :

.MaximumSize :

.MaxSelectionCount :

.MinDate :

.MinimumSize :

.ModifierKeys : , read-only, static

.MonthlyBoldedDates :

.MouseButtons : , read-only, static

.MousePosition : , read-only, static

.Name :

.Padding :

.Parent :

.PreferredSize : , read-only

.ProductName : , read-only

.ProductVersion : , read-only

.RecreatingHandle : , read-only

.Region :

.Right : , read-only

.RightToLeft :

.RightToLeftLayout :

.ScrollChange :

.SelectionEnd :

.SelectionRange :

.SelectionStart :

.ShowToday :

.ShowTodayCircle :

.ShowWeekNumbers :

.SingleMonthSize : , read-only

.Site :

.Size :

?

.TabIndex :

.TabStop :

.Tag :

.Text :

.TitleBackColor :

.TitleForeColor :

.TodayDate :

.TodayDateSet : , read-only

.Top :

.TopLevelControl : , read-only

.TrailingForeColor :

.UseWaitCursor :

.Visible :

.Width :

.WindowTarget :

true

?

?

We want to change the color properties of the control.
Let's take a look at their
own properties first:

showproperties test.f1.ForeColor --see all properties of the color

.A : , read-only

.AliceBlue : , read-only, static

.AntiqueWhite : , read-only, static

.Aqua : , read-only, static

.Aquamarine : , read-only, static

.Azure : , read-only, static

.B : , read-only

.Beige : , read-only, static

.Bisque : , read-only, static

.Black : , read-only, static

.BlanchedAlmond : , read-only, static

.Blue : , read-only, static

.BlueViolet : , read-only, static

.Brown : , read-only, static

.BurlyWood : , read-only, static

.CadetBlue : , read-only, static

.Chartreuse : , read-only, static

.Chocolate : , read-only, static

.Coral : , read-only, static

.CornflowerBlue : , read-only, static

.Cornsilk : , read-only, static

.Crimson : , read-only, static

.Cyan : , read-only, static

.DarkBlue : , read-only, static

.DarkCyan : , read-only, static

.DarkGoldenrod : , read-only, static

.DarkGray : , read-only, static

.DarkGreen : , read-only, static

.DarkKhaki : , read-only, static

.DarkMagenta : , read-only, static

.DarkOliveGreen : , read-only, static

.DarkOrange : , read-only, static

.DarkOrchid : , read-only, static

.DarkRed : , read-only, static

.DarkSalmon : , read-only, static

.DarkSeaGreen : , read-only, static

.DarkSlateBlue : , read-only, static

.DarkSlateGray : , read-only, static

.DarkTurquoise : , read-only, static

.DarkViolet : , read-only, static

.DeepPink : , read-only, static

.DeepSkyBlue : , read-only, static

.DimGray : , read-only, static

.DodgerBlue : , read-only, static

.Firebrick : , read-only, static

.FloralWhite : , read-only, static

.ForestGreen : , read-only, static

.Fuchsia : , read-only, static

.G : , read-only

.Gainsboro : , read-only, static

.GhostWhite : , read-only, static

.Gold : , read-only, static

.Goldenrod : , read-only, static

.Gray : , read-only, static

.Green : , read-only, static

.GreenYellow : , read-only, static

.Honeydew : , read-only, static

.HotPink : , read-only, static

.IndianRed : , read-only, static

.Indigo : , read-only, static

.IsEmpty : , read-only

.IsKnownColor : , read-only

.IsNamedColor : , read-only

.IsSystemColor : , read-only

.Ivory : , read-only, static

.Khaki : , read-only, static

.Lavender : , read-only, static

.LavenderBlush : , read-only, static

.LawnGreen : , read-only, static

.LemonChiffon : , read-only, static

.LightBlue : , read-only, static

.LightCoral : , read-only, static

.LightCyan : , read-only, static

.LightGoldenrodYellow : , read-only, static

.LightGray : , read-only, static

.LightGreen : , read-only, static

.LightPink : , read-only, static

.LightSalmon : , read-only, static

.LightSeaGreen : , read-only, static

.LightSkyBlue : , read-only, static

.LightSlateGray : , read-only, static

.LightSteelBlue : , read-only, static

.LightYellow : , read-only, static

.Lime : , read-only, static

.LimeGreen : , read-only, static

.Linen : , read-only, static

.Magenta : , read-only, static

.Maroon : , read-only, static

.MediumAquamarine : , read-only, static

.MediumBlue : , read-only, static

.MediumOrchid : , read-only, static

.MediumPurple : , read-only, static

.MediumSeaGreen : , read-only, static

.MediumSlateBlue : , read-only, static

.MediumSpringGreen : , read-only, static

.MediumTurquoise : , read-only, static

.MediumVioletRed : , read-only, static

.MidnightBlue : , read-only, static

.MintCream : , read-only, static

.MistyRose : , read-only, static

.Moccasin : , read-only, static

.Name : , read-only

.NavajoWhite : , read-only, static

.Navy : , read-only, static

.OldLace : , read-only, static

.Olive : , read-only, static

.OliveDrab : , read-only, static

.Orange : , read-only, static

.OrangeRed : , read-only, static

.Orchid : , read-only, static

.PaleGoldenrod : , read-only, static

.PaleGreen : , read-only, static

.PaleTurquoise : , read-only, static

.PaleVioletRed : , read-only, static

.PapayaWhip : , read-only, static

.PeachPuff : , read-only, static

.Peru : , read-only, static

.Pink : , read-only, static

.Plum : , read-only, static

.PowderBlue : , read-only, static

.Purple : , read-only, static

.R : , read-only

.Red : , read-only, static

.RosyBrown : , read-only, static

.RoyalBlue : , read-only, static

.SaddleBrown : , read-only, static

.Salmon : , read-only, static

.SandyBrown : , read-only, static

.SeaGreen : , read-only, static

.SeaShell : , read-only, static

.Sienna : , read-only, static

.Silver : , read-only, static

.SkyBlue : , read-only, static

.SlateBlue : , read-only, static

.SlateGray : , read-only, static

.Snow : , read-only, static

.SpringGreen : , read-only, static

.SteelBlue : , read-only, static

.Tan : , read-only, static

.Teal : , read-only, static

.Thistle : , read-only, static

.Tomato : , read-only, static

.Transparent : , read-only, static

.Turquoise : , read-only, static

.Violet : , read-only, static

.Wheat : , read-only, static

.White : , read-only, static

.WhiteSmoke : , read-only, static

.Yellow : , read-only, static

.YellowGreen : , read-only, static

.Empty : , read-only, static

true

?

Looks like the color property itself has properties, some of them read-only definitions of typical colors! This means that we can set the .ForeColor and .BackColor properties to the static read-only values they already defined:

test.f1.ForeColor = test.f1.ForeColor.Blue

dotNetObject:System.Drawing.Color

test.f1.BackColor = test.f1.BackColor.Yellow

dotNetObject:System.Drawing.Color

test.f1.TitleBackColor = test.f1.TitleBackColor.Tomato

dotNetObject:System.Drawing.Color

?

dotNet_MonthCalendar_Colored.gif

?

See also

DotNet In MAXScript