コード例 #1
0
            ////////////////////////////////////////////////////////////////////////
            //--------------------------------- REVISIONS --------------------------
            // Date       Name                 Tracking #         Description
            // ---------  -------------------  -------------      ------------------
            // 18JUN2009  James Shen                              Initial Creation
            ////////////////////////////////////////////////////////////////////////

            /**
             * draw route icon in given rectangle.
             * @param mapDirection
             * @param X
             * @param Y
             * @param Width
             * @param Height
             */
            private void DrawRouteIcons(MapDirection mapDirection, int x, int y,
                                        int width, int height)
            {
                GeoPoint  newPt;
                GeoLatLng pt;

                _routeGraphics.SetClip(0, 0, width, height);
                for (int i = 0; i < mapDirection.Routes[0].Steps.Length - 1; i++)
                {
                    MapStep mapStep = mapDirection.Routes[0].Steps[i];
                    pt = mapStep.LastLatLng;
                    if (_screenBounds.ContainsLatLng(pt))
                    {
                        newPt    = FromLatLngToMapPixel(pt);
                        newPt.X -= x;
                        newPt.Y -= y;
                        _routeGraphics.DrawImage(MiddleIcon,
                                                 (int)newPt.X - MiddleIcon.GetWidth() / 2, (int)newPt.Y - MiddleIcon.GetHeight() / 2);
                    }
                }
                pt       = mapDirection.Polyline.GetVertex(0);
                newPt    = FromLatLngToMapPixel(pt);
                newPt.X -= x;
                newPt.Y -= y;
                _routeGraphics.DrawImage(StartIcon,
                                         (int)newPt.X - StartIcon.GetWidth() / 2, (int)newPt.Y - StartIcon.GetHeight() / 2);
                pt       = mapDirection.Polyline.GetVertex(mapDirection.Polyline.GetVertexCount() - 1);
                newPt    = FromLatLngToMapPixel(pt);
                newPt.X -= x;
                newPt.Y -= y;
                _routeGraphics.DrawImage(EndIcon,
                                         (int)newPt.X - EndIcon.GetWidth() / 2, (int)newPt.Y - EndIcon.GetHeight() / 2);
            }
コード例 #2
0
ファイル: ImageName.cs プロジェクト: qttq23/BatchRename
        public void LoadImageName()
        {
            // open folder, get all filenames
            //AppDomain.CurrentDomain.BaseDirectory

            string path = AppDomain.CurrentDomain.BaseDirectory + foldername;

            string[] filenames = Directory.GetFiles(path);


            // check filename to assign to variables
            foreach (var fullname in filenames)
            {
                string filename = Path.GetFileName(fullname);

                string[] tokens = StringProcess.SplitString(filename, new string[] { "_" });

                if (tokens[0].ToLower() == "Application".ToLower())
                {
                    ApplicationIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Option".ToLower())
                {
                    OptionIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Remove".ToLower())
                {
                    RemoveIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "RemoveAll".ToLower())
                {
                    RemoveAllIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Add".ToLower())
                {
                    AddIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Preview".ToLower())
                {
                    PreviewIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Start".ToLower())
                {
                    StartIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Refresh".ToLower())
                {
                    RefreshIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Help".ToLower())
                {
                    HelpIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Open".ToLower())
                {
                    OpenIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Save".ToLower())
                {
                    SaveIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Information".ToLower())
                {
                    InformationIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "File".ToLower())
                {
                    FileIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Folder".ToLower())
                {
                    FolderIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Action".ToLower())
                {
                    ActionIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "List".ToLower())
                {
                    ListIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
            }
        }
コード例 #3
0
ファイル: ImageName.cs プロジェクト: qttq23/8PuzzelGame
        public void LoadImageName()
        {
            // open folder, get all filenames
            string path = AppDomain.CurrentDomain.BaseDirectory + foldername;

            string[] filenames = Directory.GetFiles(path);


            // check filename to assign to variables
            foreach (var fullname in filenames)
            {
                string filename = Path.GetFileName(fullname);

                string[] tokens = filename.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);

                if (tokens[0].ToLower() == "Application".ToLower())
                {
                    ApplicationIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Option".ToLower())
                {
                    OptionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Remove".ToLower())
                {
                    RemoveIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "RemoveAll".ToLower())
                {
                    RemoveAllIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Add".ToLower())
                {
                    AddIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Preview".ToLower())
                {
                    PreviewIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Start".ToLower())
                {
                    StartIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Refresh".ToLower())
                {
                    RefreshIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Help".ToLower())
                {
                    HelpIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Open".ToLower())
                {
                    OpenIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Save".ToLower())
                {
                    SaveIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Information".ToLower())
                {
                    InformationIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "File".ToLower())
                {
                    FileIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Folder".ToLower())
                {
                    FolderIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Action".ToLower())
                {
                    ActionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "List".ToLower())
                {
                    ListIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "UpDirection".ToLower())
                {
                    UpDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "RightDirection".ToLower())
                {
                    RightDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "DownDirection".ToLower())
                {
                    DownDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "LeftDirection".ToLower())
                {
                    LeftDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else
                {
                    Images.Add
                    (
                        path + filename
                    );
                }
            }
        }