public bool LoadXML_bgimages(XmlNode xnode) { foreach (XmlNode xn in xnode.ChildNodes) { switch (xn.Name) { case "bgimage_pal8": string strName = XMLUtils.GetXMLAttribute(xn, "name"); int id = XMLUtils.GetXMLIntegerAttribute(xn, "id"); string strDesc = XMLUtils.GetXMLAttribute(xn, "desc"); string strSize = XMLUtils.GetXMLAttribute(xn, "size"); string[] aSize = strSize.Split('x'); int nWidth = XMLUtils.ParseInteger(aSize[0]); int nHeight = XMLUtils.ParseInteger(aSize[1]); if (m_bgimages.ContainsKey(id)) { m_doc.ErrorString("A background image with id={0} already exists.", id); return(false); } BgImage bgi = new BgImage(m_doc, strName, id, strDesc); if (!bgi.LoadXML_bgimage_pal8(xn, nWidth, nHeight)) { return(false); } m_bgimages.Add(id, bgi); CurrentImage = bgi; break; } } return(true); }
public BgImage AddBgImage(string strName, int id, string strDesc, Bitmap bm) { // Auto-generate a new id. if (id == -1) { id = m_nNextId++; while (m_bgimages.ContainsKey(id)) { id = m_nNextId++; } } if (m_bgimages.ContainsKey(id)) { return(null); } BgImage bgi = new BgImage(m_doc, strName, id, strDesc); if (bgi.LoadBitmap(bm)) { m_bgimages.Add(id, bgi); CurrentImage = bgi; if (m_doc.Owner != null) { m_doc.Owner.HandleBackgroundImageListChanged(this); } } else { bgi = null; } return(bgi); }
public BgImageProperties(Document doc, BgImage bgi) { InitializeComponent(); m_doc = doc; m_bgimage = bgi; UpdateSpriteInfo(); }
public BgImages(Document doc) { m_doc = doc; m_bgimages = new Dictionary<int, BgImage>(); m_bgiCurrent = null; if (m_doc.Owner != null) { m_winBgImageList = new BgImageListForm(m_doc.Owner, this); ; m_winBgImage = new BgImageForm(m_doc.Owner, null); } }
public BgImages(Document doc) { m_doc = doc; m_bgimages = new Dictionary <int, BgImage>(); m_bgiCurrent = null; if (m_doc.Owner != null) { m_winBgImageList = new BgImageListForm(m_doc.Owner, this);; m_winBgImage = new BgImageForm(m_doc.Owner, null); } }
public void SelectFirstImage() { if (NumImages >= 1) { foreach (BgImage bgi in m_bgimages.Values) { CurrentImage = bgi; break; } } else { CurrentImage = null; } }
public BgImageForm(ProjectMainForm parent, BgImage bgi) { m_parent = parent; m_bgimage = bgi; InitializeComponent(); m_toolbox = new Toolbox_BgImage(); MdiParent = parent; FormBorderStyle = FormBorderStyle.SizableToolWindow; StartPosition = FormStartPosition.Manual; Visible = false; ControlBox = false; // Set to 16x. cbZoom.SelectedIndex = (int)ZoomLevel.Zoom_16x; cbZoom.Enabled = false; lNoImage.Visible = false; }
public void SetBgImage(BgImage bgi) { m_bgimage = bgi; pbBgImage.Invalidate(); SetTitle(); }
public BgImage AddBgImage(string strName, int id, string strDesc, Bitmap bm) { // Auto-generate a new id. if (id == -1) { id = m_nNextId++; while (m_bgimages.ContainsKey(id)) id = m_nNextId++; } if (m_bgimages.ContainsKey(id)) return null; BgImage bgi = new BgImage(m_doc, strName, id, strDesc); if (bgi.LoadBitmap(bm)) { m_bgimages.Add(id, bgi); CurrentImage = bgi; if (m_doc.Owner != null) m_doc.Owner.HandleBackgroundImageListChanged(this); } else bgi = null; return bgi; }
public bool LoadXML_bgimages(XmlNode xnode) { foreach (XmlNode xn in xnode.ChildNodes) { switch (xn.Name) { case "bgimage_pal8": string strName = XMLUtils.GetXMLAttribute(xn, "name"); int id = XMLUtils.GetXMLIntegerAttribute(xn, "id"); string strDesc = XMLUtils.GetXMLAttribute(xn, "desc"); string strSize = XMLUtils.GetXMLAttribute(xn, "size"); string[] aSize = strSize.Split('x'); int nWidth = XMLUtils.ParseInteger(aSize[0]); int nHeight = XMLUtils.ParseInteger(aSize[1]); if (m_bgimages.ContainsKey(id)) { m_doc.ErrorString("A background image with id={0} already exists.", id); return false; } BgImage bgi = new BgImage(m_doc, strName, id, strDesc); if (!bgi.LoadXML_bgimage_pal8(xn, nWidth, nHeight)) return false; m_bgimages.Add(id, bgi); CurrentImage = bgi; break; } } return true; }
public void Clear() { m_bgimages.Clear(); m_bgiCurrent = null; }