コード例 #1
0
 ///<summary>Called from SetLocation to establish X position of control.</summary>
 private int ConvertToX()
 {
     if (ContrApptSheet.IsWeeklyView)
     {
         return(ContrApptSheet.TimeWidth
                + ContrApptSheet.ColDayWidth * ((int)PIn.PDateT(DataRoww["AptDateTime"].ToString()).DayOfWeek - 1) + 1
                + (int)(ContrApptSheet.ColAptWidth * (float)ApptViewItems.GetIndexOp(PIn.PInt(DataRoww["Op"].ToString()))));
     }
     else
     {
         return(ContrApptSheet.TimeWidth + ContrApptSheet.ProvWidth * ContrApptSheet.ProvCount
                + ContrApptSheet.ColWidth * (ApptViewItems.GetIndexOp(PIn.PInt(DataRoww["Op"].ToString()))) + 1);
         //Info.MyApt.Op))+1;
     }
 }
コード例 #2
0
        ///<summary>Draws all the blockouts for the entire period.</summary>
        private void DrawBlockouts(Graphics g)
        {
            Schedule[] schedForType;
            schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Blockout, 0);
            SolidBrush blockBrush;
            Pen        blockOutlinePen = new Pen(Color.Black, 1);
            Pen        penOutline;
            Font       blockFont = new Font("Arial", 8);
            string     blockText;
            RectangleF rect;

            //g.TextRenderingHint=TextRenderingHint.SingleBitPerPixelGridFit;//to make printing clearer
            for (int i = 0; i < schedForType.Length; i++)
            {
                blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType));
                penOutline = new Pen(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType), 2);
                blockText  = DefB.GetName(DefCat.BlockoutTypes, schedForType[i].BlockoutType) + "\r\n" + schedForType[i].Note;
                if (IsWeeklyView)
                {
                    if (schedForType[i].Op == 0)                   //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColDayWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                      //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            + ColAptWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColAptWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                else
                {
                    if (schedForType[i].Op == 0)                  //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColWidth * ColCount - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                     //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount
                            + ColWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                //paint either solid block or outline
                if (PrefB.GetBool("SolidBlockouts"))
                {
                    g.FillRectangle(blockBrush, rect);
                    g.DrawLine(blockOutlinePen, rect.X, rect.Y + 1, rect.Right - 1, rect.Y + 1);
                }
                else
                {
                    g.DrawRectangle(penOutline, rect.X + 1, rect.Y + 2, rect.Width - 2, rect.Height - 3);
                }
                g.DrawString(blockText, blockFont, new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
            }
        }
コード例 #3
0
        ///<summary>Draws all the blockouts for the entire day.</summary>
        private void DrawBlockouts(Graphics g)
        {
            SchedDefault[] schedDefs;            //for one type at a time
            Schedule[]     schedForType;
            schedForType = Schedules.GetForType(SchedListDay, ScheduleType.Blockout, 0);
            SolidBrush blockBrush;
            Pen        blockOutlinePen = new Pen(Color.Black, 1);
            Font       blockFont       = new Font("Arial", 8);
            string     blockText;
            RectangleF rect;

            g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit; //to make printing clearer
            if (schedForType.Length == 0)                                     //use default sched
            {
                schedDefs = SchedDefaults.GetForType(ScheduleType.Blockout, 0);
                for (int i = 0; i < schedDefs.Length; i++)
                {
                    if (schedDefs[i].DayOfWeek == (int)Appointments.DateSelected.DayOfWeek)
                    {
                        blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedDefs[i].BlockoutType));
                        blockText  = DefB.GetName(DefCat.BlockoutTypes, schedDefs[i].BlockoutType);
                        if (schedDefs[i].Op == 0)                      //all ops
                        {
                            rect = new RectangleF(
                                TimeWidth + ProvWidth * ProvCount + 1
                                , schedDefs[i].StartTime.Hour * Lh * RowsPerHr
                                + schedDefs[i].StartTime.Minute * Lh / MinPerRow
                                , ColWidth * ColCount - 1
                                , (schedDefs[i].StopTime - schedDefs[i].StartTime).Hours * Lh * RowsPerHr
                                + (schedDefs[i].StopTime - schedDefs[i].StartTime).Minutes * Lh / MinPerRow);
                        }
                        else                         //just one op
                        {
                            if (ApptViewItems.GetIndexOp(schedDefs[i].Op) == -1)
                            {
                                continue;                                //don't display if op not visible
                            }
                            rect = new RectangleF(
                                TimeWidth + ProvWidth * ProvCount
                                + ColWidth * ApptViewItems.GetIndexOp(schedDefs[i].Op) + 1
                                , schedDefs[i].StartTime.Hour * Lh * RowsPerHr
                                + schedDefs[i].StartTime.Minute * Lh / MinPerRow
                                , ColWidth - 1
                                , (schedDefs[i].StopTime
                                   - schedDefs[i].StartTime).Hours * Lh * RowsPerHr
                                + (schedDefs[i].StopTime
                                   - schedDefs[i].StartTime).Minutes * Lh / MinPerRow);
                        }
                        g.FillRectangle(blockBrush, rect);
                        g.DrawRectangle(blockOutlinePen, rect.X + 1, rect.Y + 2, rect.Width - 2, rect.Height - 4);
                        g.DrawString(blockText, blockFont
                                     , new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
                    }
                }
            }
            else             //use schedForType
            {
                for (int i = 0; i < schedForType.Length; i++)
                {
                    blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType));
                    blockText  = DefB.GetName(DefCat.BlockoutTypes, schedForType[i].BlockoutType) + "\r\n"
                                 + schedForType[i].Note;
                    if (schedForType[i].Op == 0)                  //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColWidth * ColCount - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                     //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount
                            + ColWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    g.FillRectangle(blockBrush, rect);
                    //g.DrawRectangle(blockOutlinePen,rect.X,rect.Y+1,rect.Width-1,rect.Height-3);
                    g.DrawLine(blockOutlinePen, rect.X, rect.Y + 1, rect.Right - 1, rect.Y + 1);
                    g.DrawString(blockText, blockFont
                                 , new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
                }
            }
        }
コード例 #4
0
 ///<summary>Called from SetLocation to establish X position of control.</summary>
 private int ConvertToX()
 {
     return(ContrApptSheet.TimeWidth + ContrApptSheet.ProvWidth * ContrApptSheet.ProvCount
            + ContrApptSheet.ColWidth * (ApptViewItems.GetIndexOp(Info.MyApt.Op)) + 1);
 }