private void AddDragControl() { Control.DragItem d = new Control.DragItem(new Point(0, 0)); d.ControlCommand.ControlState = ObjectState.Add; d.ControlCommand.control_type = ControlType.Button; d.CustomProperties.Top = 0; d.CustomProperties.Left = 0; d.Width = 60; d.Height = 60; dragContainer2.AddDragControl(d); }
public void DuplicateDragItem() { DragItem dragItem = this.DragItem.Find(a => a.IsSelect == true && a.ControlCommand.ControlState != ObjectState.Delete); if (dragItem != null) { DragItem duplicate = new Control.DragItem(new Point(0, 0)); duplicate = dragItem.CloneTo(duplicate); duplicate.ControlCommand.ControlState = ObjectState.Add; this.AddDragControl(duplicate); } }
protected void dragContainer2_SelectDragEvent(object sender) { Control.DragItem d = sender as Control.DragItem; spComtrolCommand.Panel2.Enabled = false; ddlControlType.SelectedIndex = -1; ddlControlType.Enabled = false; ddlScreen.SelectedIndex = -1; ddlScreen.Enabled = false; txtTableName.Text = string.Empty; txtTableName.Enabled = false; if (d != null) { ddlControlType.Enabled = true; spComtrolCommand.Panel2.Enabled = true; propertyGrid1.SelectedObject = d.CustomProperties; ddlControlType.SelectedIndex = ddlControlType.FindString(d.ControlCommand.control_type); if (d.ControlCommand.control_type == ControlType.Table) { txtTableName.Text = d.ControlCommand.TableName; txtTableName.Enabled = true; } else { } ddlScreen.SelectedIndex = ddlScreen.FindString(d.ControlCommand.NextScreen); } else { dragContainer2.HideBoxResize(); propertyGrid1.SelectedObject = sender; } }
private void LoadScreenConfig() { ScreenConfig mainScreen = new ScreenConfig(); if (cmdForm.SelectedValue == null) { return; } spComtrolCommand.Panel2.Enabled = false; mainScreen.control_id = Converts.ParseLongNullable(cmdForm.SelectedValue.ToString()); mainScreen = ServiceProvider.ScreenConfigService.FindByKeys(mainScreen, false); if (mainScreen != null) { if (mainScreen.sc_screen_image_id != null) { mainScreen.image = ServiceProvider.ScreenImageService.FindByKeys(new ScreenImage() { sc_screen_image_id = mainScreen.sc_screen_image_id }, false).image; dragContainer2.BackgroundImage = Converts.ParseImage(mainScreen.image); } else { dragContainer2.BackgroundImage = null; } dragContainer2.BackColor = Color.FromArgb(mainScreen.background_color); dragContainer2.HideBoxResize(); dragContainer2.ControlCommand.control_id = mainScreen.control_id; dragContainer2.ClearDragItem(); dragContainer2.Width = mainScreen.control_width; dragContainer2.Height = mainScreen.control_height; txtWidth.Text = dragContainer2.Width.ToString(); txtHeight.Text = dragContainer2.Height.ToString(); List <ScreenConfig> dragItem = new List <ScreenConfig>(); dragItem = ServiceProvider.ScreenConfigService.getChildScreenByParent(mainScreen.control_id); foreach (ScreenConfig item in dragItem) { Control.DragItem d = new Control.DragItem(new Point(0, 0)); d.CustomProperties.Text = item.display_text; d.CustomProperties.BorderStyle = (BorderStyle)item.border_style; d.ControlCommand.ControlState = ObjectState.Add; d.ControlCommand.control_type = string.IsNullOrEmpty(item.control_type) ? ControlType.Button : item.control_type; if (d.ControlCommand.control_type == ControlType.Table) { d.ControlCommand.TableName = item.control_command; } else if (d.ControlCommand.control_type == ControlType.Button && item.control_command_group == CommandGroup.OpenNextScreen) { d.ControlCommand.NextScreen = item.control_command; } d.Width = item.control_width; d.Height = item.control_height; d.FontStr = item.font; d.CustomProperties.BackGroundImage = Converts.ParseImage(item.image); d.BackColor = Color.FromArgb(item.background_color); d.ForeColor = Color.FromArgb(item.fore_color); d.Top = item.position_top; d.Left = item.position_left; dragContainer2.AddDragControl(d); } } }
private void LoadScreenConfig() { ScreenConfig mainScreen = new ScreenConfig(); if (cmdForm.SelectedValue == null) return; spComtrolCommand.Panel2.Enabled = false; mainScreen.control_id = Converts.ParseLongNullable(cmdForm.SelectedValue.ToString()); mainScreen = ServiceProvider.ScreenConfigService.FindByKeys(mainScreen, false); if (mainScreen != null) { if (mainScreen.sc_screen_image_id != null) { mainScreen.image = ServiceProvider.ScreenImageService.FindByKeys(new ScreenImage() { sc_screen_image_id = mainScreen.sc_screen_image_id }, false).image; dragContainer2.BackgroundImage = Converts.ParseImage(mainScreen.image); } else { dragContainer2.BackgroundImage = null; } dragContainer2.BackColor = Color.FromArgb(mainScreen.background_color); dragContainer2.HideBoxResize(); dragContainer2.ControlCommand.control_id = mainScreen.control_id; dragContainer2.ClearDragItem(); dragContainer2.Width = mainScreen.control_width; dragContainer2.Height = mainScreen.control_height; txtWidth.Text = dragContainer2.Width.ToString(); txtHeight.Text = dragContainer2.Height.ToString(); List<ScreenConfig> dragItem = new List<ScreenConfig>(); dragItem = ServiceProvider.ScreenConfigService.getChildScreenByParent(mainScreen.control_id); foreach (ScreenConfig item in dragItem) { Control.DragItem d = new Control.DragItem(new Point(0, 0)); d.CustomProperties.Text = item.display_text; d.CustomProperties.BorderStyle = (BorderStyle)item.border_style; d.ControlCommand.ControlState = ObjectState.Add; d.ControlCommand.control_type = string.IsNullOrEmpty(item.control_type) ? ControlType.Button : item.control_type; if (d.ControlCommand.control_type == ControlType.Table) { d.ControlCommand.TableName = item.control_command; } else if (d.ControlCommand.control_type == ControlType.Button && item.control_command_group == CommandGroup.OpenNextScreen) { d.ControlCommand.NextScreen = item.control_command; } d.Width = item.control_width; d.Height = item.control_height; d.FontStr = item.font; d.CustomProperties.BackGroundImage =Converts.ParseImage(item.image); d.BackColor = Color.FromArgb(item.background_color); d.ForeColor = Color.FromArgb(item.fore_color); d.Top = item.position_top; d.Left = item.position_left; dragContainer2.AddDragControl(d); } } }