using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace qxdHotels.Rooms.WinUI.Room.Status { public partial class RoomStatus :Xw.WinUI.BaseForm { qxdHotels.Rooms.BLL.Room.RoomInfo _RoomInfoBLL = new qxdHotels.Rooms.BLL.Room.RoomInfo(); public RoomStatus() { InitializeComponent(); loadRoomStatus();
} #region loadRoomStatus
void loadRoomStatus() { DataTable myDt = _RoomInfoBLL.GetRoomInfo("a09b5c17fe724761a3ffc6827509b508"); //Xw.DAL.DataAccessLib.DataAccess.ExecuteDataTable("SELECT * FROM [ROOM_INFOMATION]"); if (myDt.Rows.Count > 0) { int row = 10;//每行控件数量 int column = 7;//每列控件数量 int count = 0;//设置控件数量基数
for (int i = 1; i <= row; i++) { for (int j = 1; j <= column; j++) { int k = myDt.Rows.Count; Panel roomStatePanel = new Panel(); roomStatePanel.Width = 100; roomStatePanel.Height = 100; //启用双缓冲绘制控件 DoubleBuffered = true; // roomStatePanel.Text = "aaaaa2343434343";//设置控件显示文本 roomStatePanel.Name = Convert.ToString(count);//设置控件name属性
PictureBox pic = new PictureBox(); pic.BackgroundImageLayout = ImageLayout.Stretch; pic.Name = "pic" + i.ToString(); pic.Height = 50; pic.Width = 53; pic.Location = new Point(10, 10); pic.BackgroundImage = Image.FromFile(@"F:\空房.jpg"); pic.Tag = "aaaa"; pic.Click += new EventHandler(pic_Click); pic.MouseEnter += new EventHandler(pic_MouseEnter); pic.MouseLeave += new EventHandler(pic_MouseLeave); roomStatePanel.Controls.Add(pic);
Label pc = new Label();
pc.Name = "pc" + i.ToString(); pc.Height = 50; pc.Width = 53; pc.Text = i.ToString ()+"*"+j.ToString (); pc.Location = new Point(20, 60); roomStatePanel.Controls.Add(pc); count++;
//判断控件数量是否大于数据表中数据总记录数 if (k < count) { roomStatePanel.Visible = false; } flPanel.Controls.Add(roomStatePanel); } } } } #endregion #region pic_Click void pic_Click(object sender, EventArgs e) { try { PictureBox aa = sender as PictureBox; MessageBox.Show(aa.Tag.ToString ());
// Label lbl = sender as Label; // DataRow row = lbl.Tag as DataRow; // LoadRoomByTypeID(row, 0); } catch (Exception ex) {
}
} #endregion #region pic_MouseLeave void pic_MouseLeave(object sender, EventArgs e) { PictureBox aa = sender as PictureBox; aa.BackgroundImage = Image.FromFile(@"F:\11.jpg"); //Label lbl = sender as Label; //lbl.Font = new Font(lbl.Font, FontStyle.Regular); //lbl.Cursor = Cursors.Default; //lbl.ForeColor = btnRoomType.ForeColor; } #endregion #region pic_MouseEnter void pic_MouseEnter(object sender, EventArgs e) {
PictureBox aa = sender as PictureBox;
aa.BackgroundImage = Image.FromFile(@"F:\11.jpg"); //Label lbl = sender as Label; //lbl.Font = new Font(lbl.Font, FontStyle.Bold); //lbl.Cursor = Cursors.IBeam; } #endregion } }
Google了一下,才知道啥叫”房态盘“,学习了。
我也有个问题,Winform 酒店管理系统怎么实现,Google了一下,知道了,给钱,买一套。
image控件 预定,入住换个图片 感觉是这样的
感觉只能是自己动态的更换背景图片了!更换状态!目前正在做B/S会所房间管理系统。思路是这样的。