HeaderPane
Main
Hide
Share Link
Print

SetColorSample Method, SftPictureObject Object

Defines the picture object as a color sample.

Syntax

C#void object.SetColorSample(uint SampleColor, uint FrameColor);
VB.NETobject.SetColorSample(ByVal SampleColor As UInteger, ByVal FrameColor As UInteger)
C++HRESULT object->SetColorSample(OLE_COLOR SampleColor, OLE_COLOR FrameColor);
CHRESULT object->raw_SetColorSample(OLE_COLOR SampleColor, OLE_COLOR FrameColor);

object

A SftPictureObject object.

SampleColor

Defines the color sample. For information about color properties, please visit the applicable section "Using SftDate/OCX with ...".

FrameColor

Defines the border color. For information about color properties, please visit the applicable section "Using SftDate/OCX with ...".

Comments

The SetColorSample method defines the picture object as a color sample.

The SftPictureObject.Type property is set to sftTypeColorSample.

The SftPictureObject.Height and SftPictureObject.Width properties should be used to define the requested image size.

The color sample can also be defined using the SftPictureObject.SampleColor and SftPictureObject.FrameColor properties.

Examples

C# View entire sample code

                day.ForeColor = Ole(Color.Firebrick);
                day.BackColor = Ole(Color.MistyRose);
                day.ToolTip = "Christmas Day";
                day = dates.Add(new DateTime(today.Year, 1, 15), SftDateRecurrenceConstants.recurrenceSftDateMonthly);
                day.Enabled = false;
                day.ToolTip = "Closed for inventory";
                day = dates.Add(monday, SftDateRecurrenceConstants.recurrenceSftDateWeekly);
                day.ForeColor = Ole(Color.RoyalBlue);
                day.Picture.SetColorSample(Ole(Color.RoyalBlue), Ole(Color.RoyalBlue));
                day.ToolTip = "Team meeting";
            });
        }

        // any day of any calendar can be changed here; this colors weekends that aren't special dates
        private void DayFormatting(SftDateDayFormatting day) {
            if (checkWeekends.Checked && day.Weekend && day.SpecialDate < 0)

VB.NET View entire sample code

                            day.ForeColor = Ole(Color.Firebrick)
                            day.BackColor = Ole(Color.MistyRose)
                            day.ToolTip = "Christmas Day"
                            day = dates.Add(New Date(today.Year, 1, 15), SftDateRecurrenceConstants.recurrenceSftDateMonthly)
                            day.Enabled = False
                            day.ToolTip = "Closed for inventory"
                            day = dates.Add(monday, SftDateRecurrenceConstants.recurrenceSftDateWeekly)
                            day.ForeColor = Ole(Color.RoyalBlue)
                            day.Picture.SetColorSample(Ole(Color.RoyalBlue), Ole(Color.RoyalBlue))
                            day.ToolTip = "Team meeting"
                        End Sub)
    End Sub

    ' any day of any calendar can be changed here; this colors weekends that aren't special dates
    Private Sub FormatDay(day As SftDateDayFormatting)
        If checkWeekends.Checked AndAlso day.Weekend AndAlso day.SpecialDate < 0 Then day.ForeColor = Ole(Color.IndianRed)

C++ View entire sample code

        day->ForeColor = RGB(178, 34, 34);
        day->BackColor = RGB(255, 228, 225);
        day->ToolTip = L"Christmas Day";
        day = dates->Add(MakeDate(today.wYear, 1, 15), recurrenceSftDateMonthly);
        day->Enabled = VARIANT_FALSE;
        day->ToolTip = L"Closed for inventory";
        day = dates->Add(monday, recurrenceSftDateWeekly);
        day->ForeColor = RGB(65, 105, 225);
        day->Picture->SetColorSample(RGB(65, 105, 225), RGB(65, 105, 225));
        day->ToolTip = L"Team meeting";
    });
}

void CMainDlg::OnOption(UINT id)
{
    int sel = 0;

See Also SftPictureObject Object | Object Hierarchy


Last Updated 11/29/2026 - (email)
© 2026 Softel vdm, Inc.