Example #1
0
        private void btnEditCity_Click(object sender, EventArgs e)
        {
            if (lstRegion.SelectedItem == null)
            {
                MessageBox.Show("도시 수정할 지역을 선택해주세요.", "RTMapTool", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            frmCity city = new frmCity(_map.Regions.First(x => x.Key.Name == lstRegion.SelectedItem.ToString()).Key, _map);

            city.ShowDialog();
        }
Example #2
0
        public frmCityLocation(Map map, Region reg, List <City> citys, frmCity city)
        {
            InitializeComponent();

            _map   = map;
            _reg   = reg;
            _citys = citys;
            _city  = city;

            BackgroundImage = Image.FromFile(map.BackImage);

            g = CreateGraphics();

            using (BufferedGraphics bG = BufferedGraphicsManager.Current.Allocate(g, ClientRectangle))
            {
                foreach (var r in map.Regions)
                {
                    foreach (var c in r.Key.Citys)
                    {
                        PictureBox pbc = new PictureBox();
                        pbc.Size      = new Size(3, 3);
                        pbc.Location  = new Point(c.Location.X, c.Location.Y);
                        pbc.BackColor = Color.White;
                        if (citys.Contains(c))
                        {
                            pbc.BackColor = Color.FromArgb(212, 67, 46);
                        }
                        pbc.MouseClick += (object sender, MouseEventArgs e) =>
                        {
                            Pb_MouseClick(sender, e, pbc);
                        };
                        tt.SetToolTip(pbc, c.Name);
                        Controls.Add(pbc);
                    }

                    PictureBox pb = new PictureBox();
                    pb.Image       = r.Value.Image;
                    pb.Size        = new Size(30, 30);
                    pb.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pb.BackColor   = Color.Transparent;
                    pb.Location    = r.Value.Location;
                    pb.MouseClick += (object sender, MouseEventArgs e) => {
                        Pb_MouseClick(sender, e, pb);
                    };
                    tt.SetToolTip(pb, r.Key.Name);
                    Controls.Add(pb);
                    pb.BringToFront();
                }
            }
        }