Example #1
0
        public CBox(int cx, int cy, BBox bbox)
        {
            RectangleF rc = Fitrect.Fit(new RectangleF(0, 0, cx, cy), new SizeF((float)(bbox.x1 - bbox.x0), (float)(bbox.y1 - bbox.y0)));

            ox = -bbox.x0;
            tx = +rc.Left;
            sx = rc.Width / (bbox.x1 - bbox.x0);

            oy = -bbox.y0;
            ty = +rc.Top;
            sy = rc.Height / (bbox.y1 - bbox.y0);
        }
Example #2
0
            internal static Bitmap Make(Bitmap pic, Size sizeThumb)
            {
                int cx = sizeThumb.Width;
                int cy = sizeThumb.Height;

                Bitmap thumb = new Bitmap(cx, cy);

                using (Graphics cv = Graphics.FromImage(thumb)) {
                    float fx = (pic.HorizontalResolution == 0) ? 1 : pic.VerticalResolution / pic.HorizontalResolution;
                    cv.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                    cv.DrawImage(pic,
                                 Fitrect.Fit(
                                     new Rectangle(Point.Empty, new Size(cx, cy)),
                                     new Size(
                                         (int)(pic.Width * fx),
                                         (int)(pic.Height)
                                         )
                                     )
                                 );
                }

                return(thumb);
            }
Example #3
0
        void p_Paint(object sender, PaintEventArgs e)
        {
            Panel    p        = (Panel)sender;
            PageItem pageItem = (PageItem)p.Tag;

            {
                Graphics  cv    = e.Graphics;
                Rectangle rcPic = new Rectangle(Point.Empty, p.Size);
                rcPic.Inflate(-10, -10);
                Rectangle rcTarget = Fitrect.Fit(rcPic, pageItem.picThumb.Size);
                cv.DrawImage(pageItem.picThumb, rcTarget);
                if (pageItem.isDeleted)
                {
                    //cv.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    cv.DrawLine(redPen, 0, 0, p.Width, p.Height);
                    cv.DrawLine(redPen, 0, p.Height, p.Width, 0);
                }
                if (pageItem.isSep)
                {
                    cv.FillRectangle(Brushes.Blue, Rectangle.FromLTRB(0, 0, 3, p.Height));
                }
                cv.DrawString(String.Format("{0}", pageItem.index + 1), Font, SystemBrushes.WindowText, new Rectangle(Point.Empty, p.Size), sfBC);
            }
        }