Example #1
0
        private void  CopyImageToClipboard(Object sender, EventArgs e)
        {
            String imageFileName = lastSelectedImage;

            PicesDataBaseImage pi = dbConn.ImageLoad(imageFileName);

            if (pi != null)
            {
                PicesRaster pr = dbConn.ImageFullSizeFind(imageFileName);
                Image       i  = pr.BuildBitmap();
                if (i != null)
                {
                    Clipboard.SetImage(i);
                }
            }
        } /* CopyImageToClipboard */
Example #2
0
        private void  LoadPlanktonImage()
        {
            GetZoomFactor();
            Bitmap bm = raster.BuildBitmap();

            if (zoomFactor != 1.0f)
            {
                bm = ReSize(bm, zoomFactor);
            }

            {
                // Lets add hash marks.
                Graphics g = Graphics.FromImage(bm);

                double pixelsPERmmAccrossChamberZoom = zoomFactor * 1.0 / mmPerPixelAccrossChamber;
                double pixelsPERmmWithFlowZoom       = zoomFactor * 1.0 / mmPerPixelWithFlow;

                int   x             = 0;
                Brush hashMarkBrush = Brushes.Red;
                Pen   gridPen       = new Pen(Color.FromArgb(30, 255, 0, 0));

                // Vertical Hash Marks
                while (true)
                {
                    int hashPos = (int)((float)x * pixelsPERmmWithFlowZoom + 0.5f);
                    if (hashPos >= bm.Height - 4)
                    {
                        break;
                    }

                    int hashLen = 4;
                    if ((x % 10) == 0)
                    {
                        hashLen = 8;
                    }

                    g.FillRectangle(hashMarkBrush, 0, hashPos, hashLen, 2);
                    g.FillRectangle(hashMarkBrush, bm.Width - (hashLen + 1), hashPos, hashLen, 2);
                    if (displayGrid)
                    {
                        g.DrawLine(gridPen, 0, hashPos, bm.Width - 1, hashPos);
                    }
                    x++;
                }

                x = 0;

                // Horizontal Hash Marks
                while (true)
                {
                    int hashPos = (int)((float)x * pixelsPERmmAccrossChamberZoom + 0.5f);
                    if (hashPos >= bm.Width)
                    {
                        break;
                    }

                    int hashLen = 4;
                    if ((x % 10) == 0)
                    {
                        hashLen = 8;
                    }

                    g.FillRectangle(hashMarkBrush, hashPos, 0, 2, hashLen);
                    g.FillRectangle(hashMarkBrush, hashPos, bm.Height - (hashLen + 1), 2, hashLen);
                    if (displayGrid)
                    {
                        g.DrawLine(gridPen, hashPos, 0, hashPos, bm.Height - 1);
                    }
                    x++;
                }

                DrawSizeCoordinates(g);
            }

            PlanktonImage.Height = bm.Height;
            PlanktonImage.Width  = bm.Width;

            PlanktonImage.Image = bm;
        } /* LoadPlanktonImage */