Beispiel #1
0
        private void tsmiImportSongisms_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dlgSongisms = new OpenFileDialog())
              {
            dlgSongisms.Filter = "PNG Files|*.png";

            dlgSongisms.Title = "Find Songisms";
            dlgSongisms.Multiselect = true;

            if (dlgSongisms.ShowDialog(this) == DialogResult.OK)
            {
              SongismPictureBox pbSongism;
              System.Drawing.Image imgSongismImage;
              foreach (string sFileName in dlgSongisms.FileNames)
              {
            pbSongism = new SongismPictureBox();
            imgSongismImage = System.Drawing.Image.FromFile(sFileName);

            pbSongism.Size = imgSongismImage.Size;
            pbSongism.SizeMode = PictureBoxSizeMode.StretchImage;
            pbSongism.Image = imgSongismImage;
            pbSongism.BackColor = Color.Transparent;

            pbSongism.MouseDown += pbSongism_MouseDown;

            flpSongisms.Controls.Add(pbSongism);
              }
            }
              }
        }
Beispiel #2
0
        private void PopulateSongismAttributesControls(SongismPictureBox songism)
        {
            foreach (System.Reflection.PropertyInfo oProperty in songism.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public))
              {
            //string sPropertyName = oProperty.Name;
            if (oProperty.GetCustomAttributes(false).Length > 0)
            {

            }
              }

              txtName.Text = songism.Name;
              nudMapPositionX.Value = (int)songism.MapPosition.X;
              nudMapPositionY.Value = (int)songism.MapPosition.Y;

              nudBoundingBoxWidth.Value = (int)songism.BoundingBoxDimenions.X;
              nudBoundingBoxHeight.Value = (int)songism.BoundingBoxDimenions.Y;

              nudBoundingBoxPositionX.Value = (int)songism.BoundingBoxPosition.X;
              nudBoundingBoxPositionY.Value = (int)songism.BoundingBoxPosition.Y;

              cboState.SelectedIndex = cboState.Items.IndexOf(songism.State);

              chkHasPrerequisiteSongism.Checked = songism.HasPrerequisiteSongism;
              txtPrerequisiteSongism.Enabled = songism.HasPrerequisiteSongism;
              txtPrerequisiteSongism.Text = songism.PrerequisiteSongism;

              chkHasPrerequisiteInventoryItem.Checked = songism.HasPrerequisiteInventoryItem;
              txtPrerequisiteInventoryItem.Enabled = songism.HasPrerequisiteInventoryItem;
              txtPrerequisiteInventoryItem.Text = songism.PrerequisiteInventoryItem;
        }
Beispiel #3
0
 void pbSongism_MouseDown(object sender, MouseEventArgs e)
 {
     PopulateSongismAttributesControls((SongismPictureBox)sender);
       _pbDragging = new SongismPictureBox();
       _pbDragging.Size = (sender as SongismPictureBox).Size;
       _pbDragging.SizeMode = PictureBoxSizeMode.StretchImage;
       _pbDragging.Image = (sender as SongismPictureBox).Image;
       _pbDragging.BackColor = Color.Transparent;
       DoDragDrop((sender as SongismPictureBox), DragDropEffects.Move);
 }
Beispiel #4
0
        private void pnlTileMap_DragDrop(object sender, DragEventArgs e)
        {
            SongismPictureBox pbAddedSongism = _pbDragging;
              pnlTileMap.Controls.Remove(_pbDragging);

              pbAddedSongism.MouseDown += pbAddedSongism_MouseDown;

              pnlTileMap.Controls.Add(pbAddedSongism);
              pbAddedSongism.BringToFront();
              _pbDragging = null;
        }
Beispiel #5
0
 void pbAddedSongism_MouseDown(object sender, MouseEventArgs e)
 {
     _pbDragging = (SongismPictureBox)sender;
       _pbDragging.Size = (sender as SongismPictureBox).Size;
       _pbDragging.SizeMode = PictureBoxSizeMode.StretchImage;
       _pbDragging.Image = (sender as SongismPictureBox).Image;
       _pbDragging.BackColor = Color.Transparent;
       DoDragDrop((sender as SongismPictureBox), DragDropEffects.Move);
 }