예제 #1
0
        //private IList<IImageResult> Search2(string query, int count, ImageSize imagesize, Colorization coloriztion, ImageType imagetype, FileType filetype)
        //{
        //    IList<IImageResult> Results = Google.API.Search.GimageSearcher.Search(query, count, imagesize, coloriztion, imagetype, filetype);
        //    return Results;
        //}

        //public void LoadImageFromUrl(string url, PictureBox pb)
        //{
        //    HttpWebRequest request = (HttpWebRequest)System.Net.HttpWebRequest.Create(url);
        //    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        //    Image img = Image.FromStream(response.GetResponseStream());
        //    response.Close();
        //    pb.SizeMode = PictureBoxSizeMode.StretchImage;
        //    pb.Image = img;
        //}
        public static Bitmap GetImage(string text)
        {
            GoogleSearch gSearch = new GoogleSearch(text);

            gSearch.GetPictures();
            return(gSearch.bitmap);
        }
예제 #2
0
        public VerbFrameEntity(int x, int y, VerbFrame verbFrame)
            : base(0, 0, 70, 40, verbFrame.VerbName, "")

        {
            _verbFrame = verbFrame;
            if (IsGoogleImage())
            {
                _bitmap    = GoogleSearch.GetImage(verbFrame.VerbName);
                _rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height);
                _position  = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2);
            }
        }
예제 #3
0
        public TMRNounFrameEntity(int x, int y, NounFrame nounFrame)
            : base(0, 0, 70, 40, nounFrame.Text, "")
            //:base(0,0,70,40,nounFrame.Text)
        {
            _nounFrame = nounFrame;

            string Text = "";

            Text += (_nounFrame.Text);
            _nounFrame.SearchText1 = Text;
            Text2 = nounFrame.IS_a;
            if (IsGoogleImage())
            {
                _bitmap    = GoogleSearch.GetImage(_nounFrame.SearchText1);
                _rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height);
                _position  = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2);
            }
        }
예제 #4
0
        public NounFrameEntity(int x, int y, NounFrame nounFrame)
            : base(0, 0, 70, 40, nounFrame.Text, "")
        {
            _nounFrame = nounFrame;
            string Text = "";

            if (_nounFrame.Adjective != null)
            {
                foreach (ParseNode adj in _nounFrame.Adjective)
                {
                    Text += (adj.Text + " ");
                }
            }
            Text += (_nounFrame.Text);
            _nounFrame.SearchText1 = Text;

            string _wordologyDirectoryPath = Application.ExecutablePath;
            int    index = _wordologyDirectoryPath.LastIndexOf("\\");

            _wordologyDirectoryPath = _wordologyDirectoryPath.Substring(0, index);

            if (IsGoogleImage())
            {
                ///////////////// habal
                string strpath = "";
                if (_nounFrame.Text == "agricultural".ToUpper())
                {
                    strpath = _wordologyDirectoryPath + @"\pics\agricultural.jpg";
                }
                else if (_nounFrame.Text == "queen".ToUpper())
                {
                    strpath = _wordologyDirectoryPath + @"\pics\queen.jpg";
                }
                else if (_nounFrame.Text == "shakespeare".ToUpper())
                {
                    strpath = _wordologyDirectoryPath + @"\pics\shakespeare.jpg";
                }
                else if (_nounFrame.Text == "living".ToUpper())
                {
                    strpath = _wordologyDirectoryPath + @"\pics\coins.jpg";
                }
                else if (_nounFrame.Text == "writer".ToUpper())
                {
                    strpath = _wordologyDirectoryPath + @"\pics\writer.jpg";
                }

                ////////////////////////////

                if (strpath != "")
                {
                    _bitmap = new Bitmap(strpath);
                }
                else
                {
                    _bitmap = GoogleSearch.GetImage(_nounFrame.SearchText1);
                }
                /////////////////////////
                _rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height);
                _position  = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2);
            }
        }