Пример #1
0
        /// <summary>
        /// レイヤーウィンドウの更新
        /// </summary>
        private void IconUpdate()
        {
            Bitmap bmp;

            if (!Properties.Settings.Default.iconViewFlag)
            {
                bmp = new Bitmap(1, 1);
                goto gotoLabelDraw;
            }
            var bmpList = new List <Bitmap>();

            foreach (var da in this._mass.Value)
            {
                if (da.Enable && this._barrageEnable)
                {
                    bmpList.Add(da.SkillIcon);
                }
                else
                {
                    bmpList.Add(da.DisableSkillIcon);
                }
            }
            if (bmpList.Count != 0)
            {
                var iconList = bmpList.ToArray();
                if (!Client.IsAlive || !ActiveWindow)
                {
                    bmp = new Bitmap(1, 1);
                    goto gotoLabelDraw;
                }
                Client.Get();
                bmp = new Bitmap(Math.Min(iconList.Length, Properties.Settings.Default.oneRowIcons) * ICON_SIZE, (int)Math.Ceiling((double)iconList.Length / Properties.Settings.Default.oneRowIcons) * ICON_SIZE);
                var g = Graphics.FromImage(bmp);
                for (var i = 0; i < iconList.Length; i++)
                {
                    if (iconList[i] == null)
                    {
                        continue;
                    }
                    g.DrawImage(iconList[i], (i % Properties.Settings.Default.oneRowIcons) * ICON_SIZE, (int)(Math.Floor((double)i / Properties.Settings.Default.oneRowIcons)) * ICON_SIZE);
                }
            }
            else
            {
                bmp = new Bitmap(1, 1);
            }
            _skillLayer.Visible = true;
            _skillLayer.Size    = new Size(bmp.Width, bmp.Height);
            switch ((Options.IconDisplayPosition)Properties.Settings.Default.iconDisplayPosition)
            {
            case Options.IconDisplayPosition.TOP_LEFT:
                _skillLayer.Top  = Client.y - bmp.Height;
                _skillLayer.Left = Client.x;
                break;

            case Options.IconDisplayPosition.TOP_RIGHT:
                _skillLayer.Top  = Client.y - bmp.Height;
                _skillLayer.Left = Client.x + Client.w - bmp.Width;
                break;

            case Options.IconDisplayPosition.BOTTOM_LEFT:
                _skillLayer.Top  = Client.y + Client.h;
                _skillLayer.Left = Client.x;
                break;

            case Options.IconDisplayPosition.BOTTOM_RIGHT:
                _skillLayer.Top  = Client.y + Client.h;
                _skillLayer.Left = Client.x + Client.w - bmp.Width;
                break;

            default:
                _skillLayer.Top  = Client.y - bmp.Height;
                _skillLayer.Left = Client.x;
                break;
            }
gotoLabelDraw:
            _skillLayer.DrawImage(bmp);
            _skillLayer.UpdateLayeredWindow();
            _skillLayer.ToTop();
        }