DevExpress GroupControl面板收缩展开
1 #region GroupControl面板缩进展开绑定 2 private void BindGroupControl(DevExpress.XtraEditors.GroupControl groupControl) 3 { 4 DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions buttonImageOptions1 = new DevExpress.XtraEditors.ButtonsPanelControl.ButtonImageOptions(); 5 groupControl.CustomHeaderButtons.AddRange(new DevExpress.XtraEditors.ButtonPanel.IBaseButton[] { 6 new DevExpress.XtraEditors.ButtonsPanelControl.GroupBoxButton("", true, buttonImageOptions1, DevExpress.XtraBars.Docking2010.ButtonStyle.PushButton, "", -1, true, null, true, false, true, "", -1)}); 7 ((DevExpress.XtraEditors.ButtonPanel.BaseButton)groupControl.CustomHeaderButtons[0]).Image = ImageResourceCache.Default.GetImage("office2013/zoom/zoomout_16x16.png"); 8 groupControl.CustomButtonClick += new DevExpress.XtraBars.Docking2010.BaseButtonEventHandler(groupControl_CustomButtonClick); 9 } 10 private void groupControl_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) 11 { 12 DevExpress.XtraEditors.GroupControl groupControl = sender as DevExpress.XtraEditors.GroupControl; 13 if (groupControl.Size.Height != 23) 14 { 15 groupControl.Tag = groupControl.Size; 16 groupControl.Size = new Size(groupControl.Size.Width, 23); 17 ((DevExpress.XtraEditors.ButtonPanel.BaseButton)groupControl.CustomHeaderButtons[0]).Image = DevExpress.Images.ImageResourceCache.Default.GetImage("office2013/zoom/zoomin_16x16.png"); 18 } 19 else 20 { 21 groupControl.Size = (Size)groupControl.Tag; 22 ((DevExpress.XtraEditors.ButtonPanel.BaseButton)groupControl.CustomHeaderButtons[0]).Image = DevExpress.Images.ImageResourceCache.Default.GetImage("office2013/zoom/zoomout_16x16.png"); 23 } 24 } 25 #endregion