示例#1
0
 //-------------------------------------------------
 #region Initialize Region
 private void InitializeComponent()
 {
     //-----------------------------------------
     //News:
     this.MyRes = new WotoRes(typeof(GameIcon));
     //-----------------------------------------
     //Names:
     //TabIndexes:
     //FontAndTextAligns:
     //Sizes:
     //Locations:
     //Colors:
     //ComboBoxes:
     //Enableds:
     //Booleans:
     this.HasClicked = this.MyRes.StringExists(TheIcon.ToString() + UnClicked) &&
                       this.MyRes.StringExists(TheIcon.ToString() + Clicked);
     //Texts:
     //AddRanges:
     //ToolTipSettings:
     //-----------------------------------------
     //Events:
     //-----------------------------------------
     if (this.HasClicked)
     {
         this.SetOriginalImage();
         this.SetClickedImage();
     }
     else
     {
         this.SetOriginalImage(this.HasClicked);
     }
 }
示例#2
0
        private void SetOriginalImage(bool hasClicked = true)
        {
            StrongString myString;

            StrongString[] myStrings;
            this.OriginalImage =
                Image.FromFile(GetRealFilePath());
            if (hasClicked)
            {
                myString = this.MyRes.GetString(TheIcon.ToString() + UnClicked);
            }
            else
            {
                myString = this.MyRes.GetString(TheIcon.ToString());
            }
            myStrings = myString.Split(
                new string[]
            {
                X_End,
                Y_End,
                W_End,
                H_End,
                R_End,
                Separator1,
                Separator2,
            });
            this.OriginalRectangle =
                new RectangleF(
                    myStrings[0].ToInt32(),
                    myStrings[1].ToInt32(),
                    myStrings[2].ToInt32(),
                    myStrings[3].ToInt32());
            var image = this.OriginalImage;

            // check if the length of this array is more than 4 or not
            if (myStrings.Length > 4)
            {
                // it means this icon should rotate.
                this.OriginalImage =
                    ThereIsConstants.Actions.RotateImage(
                        ThereIsConstants.Actions.CropImage(OriginalImage, OriginalRectangle),
                        myStrings[4].ToSingle());
            }
            else
            {
                this.OriginalImage =
                    ThereIsConstants.Actions.CropImage(OriginalImage, OriginalRectangle);
            }
            image.Dispose();
        }