Esempio n. 1
0
        void DrawIcon()
        {
            if (Program.ROM == null)
            {
                return;
            }
            Bitmap b;

            if (IconTypeEnum.Weapon == iconType)
            {
                b = ImageSystemIconForm.WeaponIcon(iconNumber);
            }
            else if (IconTypeEnum.Attribute == iconType)
            {
                b = ImageSystemIconForm.Attribute(iconNumber);
            }
            else if (IconTypeEnum.Cursol == iconType)
            {
                b = ImageSystemIconForm.Cursol();
            }
            else if (IconTypeEnum.Yubi == iconType)
            {
                if (iconNumber == 0)
                {
                    b = ImageSystemIconForm.YubiYoko();
                }
                else
                {
                    b = ImageSystemIconForm.YubiTate();
                }
            }
            else if (IconTypeEnum.Exit == iconType)
            {
                b = ImageSystemIconForm.ExitPoint();
            }
            else if (IconTypeEnum.Allow == iconType)
            {
                b = ImageSystemIconForm.Allows((int)iconNumber);
            }
            else if (IconTypeEnum.Music == iconType)
            {
                b = ImageSystemIconForm.MusicIcon(iconNumber);
            }
            else
            {
                b = ImageSystemIconForm.Blank16();
            }
            U.MakeTransparent(b);
            base.Image = b;
        }
Esempio n. 2
0
        //Attribute + テキストを書く
        public static Size DrawAtributeAndText(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            string text = lb.Items[index].ToString();

            SolidBrush brush      = new SolidBrush(lb.ForeColor);
            Font       normalFont = lb.Font;
            Rectangle  bounds     = listbounds;

            int textmargineY = (OWNER_DRAW_ICON_SIZE - (int)lb.Font.Height) / 2;


            //テキストの先頭にアイコン番号(属性番号が入っている. 無駄だが汎用性を考えるとほかに方法がない)
            uint   icon   = U.atoh(text);
            Bitmap bitmap = ImageSystemIconForm.Attribute(icon);

            U.MakeTransparent(bitmap);

            //アイコンを描く. 処理速度を稼ぐためにマップアイコンの方を描画
            Rectangle b = bounds;

            b.Width   = OWNER_DRAW_ICON_SIZE;
            b.Height  = OWNER_DRAW_ICON_SIZE;
            bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);

            //テキストを描く.
            b         = bounds;
            b.Y      += textmargineY;
            bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, b);


            bitmap.Dispose();
            brush.Dispose();

            bounds.Y += OWNER_DRAW_ICON_SIZE;
            return(new Size(bounds.X, bounds.Y));
        }