public static Bitmap getSPTypeIcon(uint b0, uint b1) { Bitmap bitmap; if (b1 == 0) {//アイテム指定 b0はアイテム名 bitmap = ItemForm.DrawIcon(b0); } else if (b1 == 1) {//種類指定 if (b0 >= 8) { bitmap = ImageSystemIconForm.WeaponIcon(8); } else { bitmap = ImageSystemIconForm.WeaponIcon(b0); } } else { bitmap = ImageSystemIconForm.WeaponIcon(8); } return(bitmap); }
public static Bitmap DrawItemIconOnly(uint addr, int itemcount) { uint p = addr + 8 + (uint)itemcount; if (!U.isSafetyZArray(p)) { return(ImageUtil.BlankDummy()); } uint item_id = Program.ROM.u8(p); return(ItemForm.DrawIcon(item_id)); }
//Item + テキストを書く public static Size DrawItemAndText(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 = ItemForm.DrawIcon(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)); }