示例#1
0
 ///<summary>It is planned to move some of this logic to OnPaint and use a true double buffer.</summary>
 public void CreateShadow()
 {
     if (this.Parent is ContrApptSheet)
     {
         bool isVisible = ApptDrawing.GetIndexOp(OpNum) >= 0;
         if (!isVisible)
         {
             return;
         }
     }
     DisposeShadow();
     if (Width < 4)
     {
         return;
     }
     if (Height < 4)
     {
         return;
     }
     Shadow = new Bitmap(Width, Height);
     using (Graphics g = Graphics.FromImage(Shadow)) {
         ApptSingleDrawing.DrawEntireAppt(g, DataRoww, PatternShowing, Width, Height, IsSelected, ThisIsPinBoard, SelectedAptNum,
                                          ApptViewItemL.ApptRows, ApptViewItemL.ApptViewCur, TableApptFields, TablePatFields, 8, false);
         //In most cases, drawing will be taken care of by ContrApptSheet.DoubleBufferDraw().
         //However, BackgroundImage must be set here to draw the bitmap when when dragging.
         this.BackgroundImage = Shadow;
     }
 }
示例#2
0
        ///<summary>It is planned to move some of this logic to OnPaint and use a true double buffer.</summary>
        public void CreateShadow()
        {
            if (this.Parent is ContrApptSheet)
            {
                bool isVisible = ApptDrawing.GetIndexOp(OpNum) >= 0;
                if (!isVisible)
                {
                    return;
                }
            }
            DisposeShadow();
            if (Width < 4)
            {
                return;
            }
            if (Height < 4)
            {
                return;
            }
            Bitmap shadowNew = new Bitmap(Width, Height);

            using (Graphics g = Graphics.FromImage(shadowNew)) {
                ApptSingleDrawing.DrawEntireAppt(g, DataRoww, PatternShowing, Width, Height, IsSelected, ThisIsPinBoard, SelectedAptNum,
                                                 ApptViewItemL.ApptRows, ApptViewItemL.ApptViewCur, TableApptFields, TablePatFields, 8, false);
            }
            //In most cases, drawing will be taken care of by ContrApptSheet.DoubleBufferDraw().
            //However, BackgroundImage must be set here to draw the bitmap when when dragging.
            //If this was inside the using block, a GDI+ exception would sometimes be thrown because the graphics object would still be accessing the
            //image data when the image reference was changed.
            Shadow          = shadowNew;
            BackgroundImage = shadowNew;
        }