예제 #1
0
        private bool GetColor(MouseEventArgs e, out Color c)
        {
            int   bw       = bitmap.Width * pictureBox_WorkPlace.Height / bitmap.Height;
            int   pw       = pictureBox_WorkPlace.Width;
            int   offset_x = (pw - bw) / 2;
            Point clickp   = new Point(e.Location.X - offset_x, e.Location.Y);

            if (clickp.X < 0 || clickp.X > bw)
            {
                c = Color.White;
                return(false);
            }
            //e.Location.X -= offset_x;
            Console.WriteLine(bw);
            Console.WriteLine(pw);
            c = ProcessFunctions.GetColor(MousePosition);
            return(true);
        }
예제 #2
0
        private void PictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            // w1/h1=w/h  h1=H w1=H*w/h

            int   bw       = bitmap.Width * pictureBox1.Height / bitmap.Height;
            int   pw       = pictureBox1.Width;
            int   offset_x = (pw - bw) / 2;
            Point clickp   = new Point(e.Location.X - offset_x, e.Location.Y);

            if (clickp.X < 0 || clickp.X > bw)
            {
                return;
            }
            //e.Location.X -= offset_x;
            Console.WriteLine(bw);
            Console.WriteLine(pw);
            Color c = ProcessFunctions.GetColor(MousePosition);

            this.pictureBox3.BackColor = c;
        }