Can we access the reusable DaysOfWeek control?

Just wondering if we have access to the PocketOutlook DaysOfWeek control or editor, or if someone else made their own for free use.

I'm looking for something exactly the same as in Outlook Calendar editor repeating template.

  • Open calendar
  • Create new assignment
  • Click "In Progress" then "<Change Template ...>"
  • Click "Next"
  • A control that has SMTWTFS where you can click on a square throughout the day to turn on / off, or use the hardware keys to navigate.

- UPDATE ------------------------

Ok, I just flipped my own control.

Not too hard, I just used 7 LinkLabels with click handlers. Actually the hardest part was around the border (using manual positioning to place the white label just inside the black bar). It's funny that the .NET CF developers thought we didn't need BORDERS.

I have exposed the DaysOfWeek with a Value and a ValueChanged event. Presto, the DaysOfWeek!

0


source to share


2 answers


Here are some code snippets for my homebrew control:

public partial class DaysOfWeekPicker : UserControl
{
    public event EventHandler ValueChanged;

    private DaysOfWeek myValue;

    [DefaultValue (0)]
    public DaysOfWeek Value
    {
        get { return myValue; }
        set { myValue = value; RefreshData (); }
    }

    public DaysOfWeekPicker ()
    {
        InitializeComponent ();
    }

    private void DayOfWeekClick (object sender, EventArgs e)
    {
        if (Object.ReferenceEquals (sender, g_l_Sunday))
        {
            this.Value = this.Value ^ DaysOfWeek.Sunday;
        }
        else if (Object.ReferenceEquals (sender, g_l_Monday))
        {
            this.Value = this.Value ^ DaysOfWeek.Monday;
        }
        else if (Object.ReferenceEquals (sender, g_l_Tuesday))
        {
            this.Value = this.Value ^ DaysOfWeek.Tuesday;
        }
        else if (Object.ReferenceEquals (sender, g_l_Wednesday))
        {
            this.Value = this.Value ^ DaysOfWeek.Wednesday;
        }
        else if (Object.ReferenceEquals (sender, g_l_Thursday))
        {
            this.Value = this.Value ^ DaysOfWeek.Thursday;
        }
        else if (Object.ReferenceEquals (sender, g_l_Friday))
        {
            this.Value = this.Value ^ DaysOfWeek.Friday;
        }
        else if (Object.ReferenceEquals (sender, g_l_Saturday))
        {
            this.Value = this.Value ^ DaysOfWeek.Saturday;
        }
    }

    private void RefreshData ()
    {
        SetLabelDisplay (g_l_Sunday, (this.Value & DaysOfWeek.Sunday) == DaysOfWeek.Sunday);
        SetLabelDisplay (g_l_Monday, (this.Value & DaysOfWeek.Monday) == DaysOfWeek.Monday);
        SetLabelDisplay (g_l_Tuesday, (this.Value & DaysOfWeek.Tuesday) == DaysOfWeek.Tuesday);
        SetLabelDisplay (g_l_Wednesday, (this.Value & DaysOfWeek.Wednesday) == DaysOfWeek.Wednesday);
        SetLabelDisplay (g_l_Thursday, (this.Value & DaysOfWeek.Thursday) == DaysOfWeek.Thursday);
        SetLabelDisplay (g_l_Friday, (this.Value & DaysOfWeek.Friday) == DaysOfWeek.Friday);
        SetLabelDisplay (g_l_Saturday, (this.Value & DaysOfWeek.Saturday) == DaysOfWeek.Saturday);

        if (this.ValueChanged != null) this.ValueChanged (this, EventArgs.Empty);
    }

    private void SetLabelDisplay (LinkLabel label, bool enabled)
    {
        if (enabled)
        {
            label.BackColor = Color.Black;
            label.ForeColor = Color.White;
        }
        else
        {
            label.BackColor = Color.White;
            label.ForeColor = Color.Black;
        }
    }
}

      



There may be a better way to perform value comparisons, but this is exactly what I came up with very quickly.

As for the design part of this, I won't get it here because of its verbosity, but it's pretty simple. Every day a LinkLabel is presented with a click event set to DayOfWeekClick. Each LinkLabel is (1,1) and two pixels less in both dimensions from the parent panel. Each parent panel has a black ForeColor, creating a border effect. Each panel is set to DockStyle.Left, and the overall size of the control is equivalent to the panel. Width * 7, panel.Height.

+1


source


These are only checkbox controls.



+1


source







All Articles