Beispiel #1
0
        public void drawRoundRect(int x, int y, int width, int height, int d1, int d2)
        {
            int r1 = d1 / 2;
            int r2 = d2 / 2;

            System.Drawing.Pen pen = new System.Drawing.Pen(col);
            graph.DrawLine(pen, x + r1, y, x + width - r1, y);
            graph.DrawLine(pen, x + r1, y + height, x + width - r1, y + height);
            graph.DrawLine(pen, x, y + r2, x, y + height - r2);
            graph.DrawLine(pen, x + width, y + r2, x + width, y + height - r2);
            graph.DrawArc(pen, x, y, d1, d2, 180, 90);
            graph.DrawArc(pen, x + width - d1, y, d1, d2, 270, 90);
            graph.DrawArc(pen, x, y + height - d2, d1, d2, 90, 90);
            graph.DrawArc(pen, x + width - d1, y + height - d2, d1, d2, 0, 90);
        }
Beispiel #2
0
 static Rhino.Display.DisplayBitmap GetSprite()
 {
     if (m_sprite == null)
     {
         var bmp = new System.Drawing.Bitmap(64, 64);
         using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
         {
             g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
             g.Clear(System.Drawing.Color.Transparent);
             var pen = new System.Drawing.Pen(System.Drawing.Color.White, 6);
             pen.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
             pen.StartCap = pen.EndCap;
             g.DrawArc(pen, new System.Drawing.Rectangle(16, 16, 32, 32), 0, 360);
             g.DrawLine(pen, new System.Drawing.Point(8, 8), new System.Drawing.Point(56, 56));
             g.DrawLine(pen, new System.Drawing.Point(8, 56), new System.Drawing.Point(56, 8));
             pen.Dispose();
         }
         m_sprite = new Rhino.Display.DisplayBitmap(bmp);
     }
     return(m_sprite);
 }
        private bool CreateDirtImage(string fn, string ImageCirclefile, CIRCLEDATA_t cd, int offsetX, int offsetY)
        {
            //DisplayCleanResults();
            //Bitmap b = new Bitmap(fn);
            //Image b = Image.FromFile(fn);

            //MemoryStream newstr = new MemoryStream(bb);
            //Image imag = Image.FromStream(newstr);
            //Bitmap b = new Bitmap(imag);
            //Graphics g = Graphics.FromImage(b);
            try
            {
                int width;
                int height;
                System.Drawing.Bitmap b1 = new System.Drawing.Bitmap(fn);

                width  = b1.Size.Width;
                height = b1.Size.Height;
                System.Drawing.Bitmap   b2 = new System.Drawing.Bitmap(b1);
                System.Drawing.Graphics g2 = System.Drawing.Graphics.FromImage(b2);
                g2.DrawImage(b1, 0, 0, width, height);

                //int offsetX = 30; //100;
                //int offsetY = 30; //100;

                int i;

                //RLC--
                //for (i = 0; i < cd.cdNmajor; i++)
                //    g2.DrawArc(System.Drawing.Pens.Blue, cd.cdXmajor[i] + offsetX - 10, cd.cdYmajor[i] + offsetY - 10, 20, 20, 0, 360);

                //for (i = 0; i < cd.cdNminor; i++)
                //    g2.DrawArc(System.Drawing.Pens.BlueViolet, cd.cdXminor[i] + offsetX - 10, cd.cdYminor[i] + offsetY - 10, 20, 20, 0, 360);

                //for (i = 0; i < cd.cdNbad; i++)
                //    g2.DrawArc(System.Drawing.Pens.Yellow, cd.cdXbad[i] + offsetX - 10, cd.cdYbad[i] + offsetY - 10, 20, 20, 0, 360);
                //--RLC

                for (i = 0; i < cd.cdNmajor; i++)
                {
                    g2.DrawArc(System.Drawing.Pens.Blue, cd.cdXmajor[i] + offsetX - 10, cd.cdYmajor[i] + offsetY, 20, 20, 0, 360);
                }

                for (i = 0; i < cd.cdNminor; i++)
                {
                    g2.DrawArc(System.Drawing.Pens.BlueViolet, cd.cdXminor[i] + offsetX - 10, cd.cdYminor[i] + offsetY, 20, 20, 0, 360);
                }

                for (i = 0; i < cd.cdNbad; i++)
                {
                    g2.DrawArc(System.Drawing.Pens.Yellow, cd.cdXbad[i] + offsetX - 10, cd.cdYbad[i] + offsetY, 20, 20, 0, 360);
                }

                //this.pctImage.Image = b2;
                b2.Save(ImageCirclefile, System.Drawing.Imaging.ImageFormat.Bmp);
                b1.Dispose();
                b2.Dispose();
                g2.Dispose();
            }
            catch (Exception ex)
            {
                m_status = false;
                m_errmsg = "Error #334: Failed Dirt Image file creation: " + ex.Message;
                return(false);
            }
            return(true);
        }