// --------------------------------------------------------------------- // Adds the custom order item to the cart and order. // --------------------------------------------------------------------- private void CustomAddToOrder_Click(object sender, EventArgs e) { List <string> optionsToRemove = new List <string>(); Button temp = new Button(); temp = (Button)sender; GroupBox parentBox = (GroupBox)temp.Parent; foreach (Control item in parentBox.Controls) { List <string> words = item.Text.Split(' ').ToList(); if (words.First().Equals("No")) { words.RemoveAt(0); string optionFormat = ""; foreach (string word in words) { optionFormat += word + " "; } optionFormat = optionFormat.Trim(); optionsToRemove.Add(optionFormat); } } txtbox_description.Text = ""; enableBack(parentBox); temp.Text = "Add to Order"; categoryBtnBox.Visible = true; orderController.updateOrder(getName(parentBox.Name), optionsToRemove); refreshCartSummary(); updateSubTotal(orderController.getSubTotal()); parentBox.SendToBack(); }
/* * Adds the custom order item to the cart and order. */ private void CustomAddToOrder_Click(object sender, EventArgs e) { List <string> optionsToRemove = new List <string>(); Button temp = new Button(); temp = (Button)sender; GroupBox parentBox = (GroupBox)temp.Parent; foreach (Control item in parentBox.Controls) { if (item.BackColor.Equals(Color.Red)) { optionsToRemove.Add(item.Text); } } txtbox_description.Text = ""; txtbox_Item.Text = ""; enableBack(parentBox); temp.Text = "Add to Order"; categoryBtnBox.Visible = true; orderController.updateOrder(getName(parentBox.Name), optionsToRemove); refreshCartSummary(); updateSubTotal(orderController.getSubTotal()); parentBox.SendToBack(); }
public void GBMessage() { GroupBox GBMsg = new GroupBox(); GBMsg.AutoSize = true; GBMsg.BackColor = System.Drawing.Color.Transparent; GBMsg.Location = new System.Drawing.Point(56, 256); GBMsg.Size = new System.Drawing.Size(510, 165); GBMsg.Name = "GBMsg"; GBMsg.Text = ""; GBMsg.TabIndex = 0; GBMsg.SendToBack(); panel2.Controls.Add(GBMsg); }
private void positionApps(GroupBox g, StreamReader sr, int n) { for (int i = 0; i < n; i++) { string icon = sr.ReadLine().Split(' ')[0].ToString(); PictureBox p = new PictureBox(); p.Size = new Size(30, 30); p.Left = g.Left + 20; p.Top = g.Top + 20 + i * (p.Height + 10); p.Visible = true; Controls.Add(p); p.BringToFront(); g.SendToBack(); p.Load(icon); p.SizeMode = PictureBoxSizeMode.StretchImage; } }
private void createServiceButton(int x, int y, String btnText, String btnName) { Button btn = new Button(); serviceButtonGroup.Controls.Add(btn); btn.Location = new Point(x, y); btn.Text = btnText; btn.Width = 150; btn.Height = 50; btn.Name = btnName; btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); btn.UseVisualStyleBackColor = true; btn.Padding = new System.Windows.Forms.Padding(12); btn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.Controls.Add(btn); serviceButtonGroup.SendToBack(); btn.Click += new EventHandler(btnGenrateTicket_Click); }
private void AddNode() { bt_addNode.Enabled = true; /* Create Node Framework */ nextNode_Loc = myNode_Loc; GroupBox node_frame = new GroupBox(); /* initialize node properties */ node_frame.Size = myNode_Size; node_frame.Location = nextNode_Loc; //default location node_frame.Name = "node_frame_" + (numTool + 1).ToString(); node_frame.Text = "Node : " + (numTool + 1).ToString(); node_frame.Tag = (numTool + 1).ToString(); node_frame.SendToBack(); /* add node frame to my form */ this.Controls.Add(node_frame); Nodes.Add(node_frame); /* increase index and update location for next node */ numTool++; myNode_Loc.X = DEF_NodeLoc.X + numTool * (myNode_Size.Width + myNode_Size.Width / 10); //update location for next node /* Create my avaiable Node */ availableNodes.Add(false); //default modLocations.Add(0); // default }
/* Initiliase my form here */ private void Form1_Load(object sender, EventArgs e) { //List<Tool> items; //* extra Json file */ string json = String.Empty; string python_path = myPath + @"\PyLTSpice"; // current directory + sub folder try { using (StreamReader json_reader = new StreamReader(python_path + @"\" + "database.json")) json = json_reader.ReadToEnd(); } catch (Exception a) { MessageBox.Show(a.Message); } database = JToken.Parse(json); /* iterate from all the json file */ foreach (JProperty x in database) { /* iterate through all the tool and get name of the tool */ string t_name = x.Name; JToken ts_attr = x.Value; nameOf_Tool.Add(x.Name); foreach (JProperty y in ts_attr) { /* iterate through all attribute of each tool */ string attr_name = y.Name; JToken value = y.Value; // MessageBox.Show(value.ToString()); } } foreach (var name in nameOf_Tool) { // MessageBox.Show(name); int tool_id = Convert.ToInt32(database[name]["id"]); string tool_name = Convert.ToString(name); double pwr = 1.0; string pwr_option = "average"; //default = "average" bool enable = true; //default = true JObject obj = (JObject)database[name]; bool sink; string source; if (obj.ContainsKey("Load")) { //MessageBox.Show(name + " is load"); sink = true; } else { //MessageBox.Show(name + " is not load"); sink = false; } if (obj.ContainsKey("Source")) { //MessageBox.Show(name + " is source"); if (database[name]["Source"]["Type"].ToString() == "Generator") { source = "Gen"; } else if (database[name]["Source"]["Type"].ToString() == "Battery") { source = "Batt"; } else { source = "FALSE"; } } else { //MessageBox.Show(name + " is not source"); source = "FALSE"; } string health = "Vcharged"; Tool_Properties tool = new Tool_Properties(tool_id, tool_name, pwr, pwr_option, enable, sink, source, health); toolConfigs.Add(tool); } //StreamReader datafile = new StreamReader(myPath + @"\Tool_Available.txt"); //should use relative path here //string line = String.Empty; //while ((line = datafile.ReadLine()) != null) //{ // tool_data.Add(line); // numofTool++; //} /* * parsing properties of the tools */ //for (int index = 1; index < numofTool; index++) //ignore the first line //{ // string[] words = tool_data[index].Split(delimiter_for_dataStructure); // /* // * Assign my shitty list here // */ // int tool_id = Convert.ToInt32(words[0]); // string tool_name = Convert.ToString(words[1]); // double pwr = Convert.ToDouble(words[2]); // string pwr_option = "average"; //default = "average" // bool enable = Convert.ToBoolean(words[4]); // bool sink = Convert.ToBoolean(words[5]); // string source = Convert.ToString(words[6]); // Tool_Properties tool = new Tool_Properties(tool_id, tool_name, pwr, pwr_option, enable, sink, source); // toolConfigs.Add(tool); //} // MessageBox.Show(toolConfigs.Count().ToString()); // MessageBox.Show(numOf_tool.ToString()); /* Create the list of available tool module */ for (int numModule = 0; numModule < toolConfigs.Count(); numModule++) { string tool_name = String.Empty; /* update location for next node */ myModule_Loc.X = DEF_ModuleLoc.X + numModule * (myModule_Size.Width + myModule_Size.Width / 10); Point nextModule_Loc = myModule_Loc; GroupBox module_drag = new GroupBox(); /* add properties */ module_drag.Size = myModule_Size; module_drag.Location = nextModule_Loc; //default location module_drag.Name = "module_" + toolConfigs[numModule].Name; // replace with json name list module_drag.BackColor = Color.LightGray; tool_name = toolConfigs[numModule].Name; //module_drag.Text = toolConfigs[numModule].Name; // replace with json name list module_drag.Text = toolConfigs[numModule].Name; module_drag.Tag = (numModule + 1).ToString(); /* add drag-drop event */ module_drag.MouseDown += new System.Windows.Forms.MouseEventHandler(this.module_drag_MouseDown); module_drag.MouseMove += new System.Windows.Forms.MouseEventHandler(this.module_drag_MouseMove); module_drag.MouseUp += new System.Windows.Forms.MouseEventHandler(this.module_drag_MouseUp); module_drag.SendToBack(); /* add new module to my form */ if (toolConfigs[numModule].Source == "Batt") { /* this is for enable / disable */ CheckBox chb_enable = new CheckBox(); chb_enable.Text = "Enable"; chb_enable.Name = "src_enable_" + toolConfigs[numModule].Name; chb_enable.Location = new Point(5, 20); chb_enable.Size = new Size(75, 21); chb_enable.Tag = module_drag.Tag; chb_enable.Checked = true; chb_enable.CheckedChanged += new System.EventHandler(this.enable_option_change); module_drag.Controls.Add(chb_enable); /* this is for enable / disable */ Label lb_type = new Label(); lb_type.Text = "Battery"; lb_type.Name = "battery_" + toolConfigs[numModule].Name; lb_type.Location = new Point(5, 50); lb_type.Size = new Size(130, 20); module_drag.Controls.Add(lb_type); /* this is for voltage delepted/ vcharged */ ComboBox cmb = new ComboBox(); cmb.Name = "src_voltage_" + toolConfigs[numModule].Name; cmb.Items.Add("Vcharged"); cmb.Items.Add("Vdepleted"); cmb.Text = "Vcharged"; cmb.Location = new Point(5, 80); cmb.Size = new Size(100, 24); cmb.Tag = module_drag.Tag; module_drag.Controls.Add(cmb); cmb.SelectedIndexChanged += new System.EventHandler(this.battery_health_change); } /* add new module to my form */ if (toolConfigs[numModule].Source == "Gen") { /* this is for enable / disable */ CheckBox chb_enable = new CheckBox(); chb_enable.Text = "Enable"; chb_enable.Name = "src_enable_" + toolConfigs[numModule].Name; chb_enable.Location = new Point(5, 20); chb_enable.Size = new Size(75, 21); chb_enable.Tag = module_drag.Tag; chb_enable.Checked = true; chb_enable.CheckedChanged += new System.EventHandler(this.enable_option_change); module_drag.Controls.Add(chb_enable); /* this is for enable / disable */ Label lb_type = new Label(); lb_type.Text = "Generator"; lb_type.Name = "generator_" + toolConfigs[numModule].Name; lb_type.Location = new Point(5, 50); lb_type.Size = new Size(130, 20); module_drag.Controls.Add(lb_type); } if (toolConfigs[numModule].Sink == true) { /* this is for enable / disable */ CheckBox chb_enable = new CheckBox(); chb_enable.Text = "Enable"; chb_enable.Name = "sink_enable_" + toolConfigs[numModule].Name; chb_enable.Location = new Point(5, 20); chb_enable.Size = new Size(75, 21); chb_enable.Tag = module_drag.Tag; chb_enable.Checked = true; chb_enable.CheckedChanged += new System.EventHandler(this.enable_option_change); module_drag.Controls.Add(chb_enable); /* this is sink average/peak power calculation option */ ComboBox cmb = new ComboBox(); cmb.Name = "sink_" + toolConfigs[numModule].Name; cmb.Items.Add("average"); cmb.Items.Add("peak"); cmb.Text = "average"; //this is the default option cmb.Location = new Point(5, 59); cmb.Size = new Size(100, 24); cmb.Tag = module_drag.Tag; module_drag.Controls.Add(cmb); cmb.SelectedIndexChanged += new System.EventHandler(this.calc_option_change); // MessageBox.Show(toolConfigs[numModule].Name); } this.Controls.Add(module_drag); Modules.Add(module_drag); } /* * Adding picture for my remove and add button */ try { bt_removeNode.Text = String.Empty; bt_removeNode.BackgroundImage = Image.FromFile(myPath + @"\Tool Icon\button_remove.png"); bt_removeNode.BackgroundImageLayout = ImageLayout.Stretch; } catch { /* in case the icon is not found, put name for my button*/ bt_removeNode.Text = "Remove Node"; } try { bt_addNode.Text = String.Empty; bt_addNode.BackgroundImage = Image.FromFile(myPath + @"\Tool Icon\button_add.png"); bt_addNode.BackgroundImageLayout = ImageLayout.Stretch; } catch { /* in case the icon is not found, put name for my button*/ bt_addNode.Text = "Add Node"; } // datafile.Close(); //close file after read, don't ask why (-_-) /* * Re-size my form here */ this.Size = new Size(Modules.Count() * (myModule_Size.Width + 2 * myModule_Size.Width / 10), this.Height); #if DISPLAY //this.Size = new Size(this.Width, this.Height + groupBox_Debug.Height + 50); #endif }
public void AddNewElemAfter(UserControl pl, UserControl after, string name) { if (showed_modal) { CloseModalElem(); } int k = list_of_controls.IndexOf(after) + 1; list_of_controls.Insert(k, pl);//помещаем контрол в конец GroupBox gr = new GroupBox(); list_of_grbox.Insert(k, gr); gr.Size = new Size(pl.Width + 6, pl.Height + 10); int prev_max_height_control = this.Height - 45; if (pl.Height > max_height_control) { max_height_control = pl.Height; foreach (GroupBox ggr in list_of_grbox) { ggr.Height = pl.Height + 10; } } else { gr.Height = max_height_control + 19; } gr.Text = name; gr.Left = width_controls + panel1.Width; //gr.BackColor = Color.Aquamarine; pl.Top = 15; pl.Left = 0; CloseButton but = new CloseButton(pl, this); but.Location = new Point(gr.Width - 20, 2); but.Name = "CloseButton"; gr.Controls.Add(but); gr.Controls.Add(pl); for (int i = list_of_grbox.IndexOf(gr) + 1; i < list_of_grbox.Count; i++) { mainPanel.Controls.Remove(list_of_grbox[i]); } mainPanel.Controls.Add(gr); gr.Dock = DockStyle.Right; gr.SendToBack(); list_of_grbox_dock.Add(gr); foreach (GroupBox uc in list_of_grbox_d) { uc.SendToBack(); } pl.Dock = DockStyle.Fill; for (int i = list_of_grbox.IndexOf(gr) + 1; i < list_of_grbox.Count; i++) { mainPanel.Controls.Add(list_of_grbox[i]); } width_controls += gr.Width; change_width = panel1.Width + width_controls + 6 - this.Width; change_height = max_height_control - prev_max_height_control; speed = (Math.Abs(change_height) > Math.Abs(change_width)) ? Math.Abs(change_height) / delta_speed : Math.Abs(change_width) / delta_speed; if (speed < 3) { speed = 3; } timerr.Enabled = true; //this.Size = new Size(panel1.Width + width_controls, max_height_control + 45); }
public void AddNewElem(UserControl pl, string name) { if (showed_modal) { CloseModalElem(); } list_of_controls.Insert(list_of_controls.Count, pl);//помещаем контрол в конец GroupBox gr = new GroupBox(); list_of_grbox.Insert(list_of_grbox.Count, gr); gr.Size = new Size(pl.Width + 2, pl.Height); int prev_max_height_control = this.Height - 45; if (pl.Height > max_height_control) { //max_height_control = pl.Height; foreach (GroupBox ggr in list_of_grbox) { //ggr.Height = pl.Height+10; } } else { gr.Height = max_height_control + 20; } gr.Text = name; gr.Left = width_controls + panel1.Width; //gr.BackColor = Color.Aquamarine; pl.Top = 15; pl.Left = 0; if (!(pl is PanelGroup) && !(pl is TableEdit)) { CloseButton but = new CloseButton(pl, this); but.Location = new Point(gr.Width - 20, 2); gr.Controls.Add(but); } mainPanel.Controls.Add(gr); gr.Dock = DockStyle.Right; gr.SendToBack(); foreach (GroupBox uc in list_of_grbox_d) { uc.SendToBack(); } list_of_grbox_dock.Add(gr); pl.Dock = DockStyle.Fill; gr.Controls.Add(pl); width_controls += gr.Width; change_width = panel1.Width + width_controls + 6 - this.Width; change_height = max_height_control - prev_max_height_control; speed = (Math.Abs(change_height) > Math.Abs(change_width)) ? Math.Abs(change_height) / delta_speed : Math.Abs(change_width) / delta_speed; if (speed < 3) { speed = 3; } timerr.Enabled = true; //this.Size = new Size(panel1.Width + width_controls ,max_height_control+45); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent(GroupCalculatorResultDTO data) { var resources = new SingleAssemblyResourceManager(typeof(Language)); const int boxTableSeparator = 50; string textHeader, textIndividualProfit, textTotalValueObtained, textTotalWaste; switch (data.TotalBalance) { case Domain.Enums.TotalBalance.Profit: textHeader = String.Format(resources.GetString("TotalProfit"), data.TotalBalanceValue.ToString()); textIndividualProfit = String.Format(resources.GetString("IndividualProfit"), data.MemberBalanceValue.ToString()); break; case Domain.Enums.TotalBalance.Waste: textHeader = String.Format(resources.GetString("TotalWaste"), data.TotalBalanceValue.ToString()); textIndividualProfit = String.Format(resources.GetString("IndividualWaste"), data.MemberBalanceValue.ToString()); break; default: textHeader = resources.GetString("HuntPaid"); textIndividualProfit = string.Empty; break; } textTotalValueObtained = String.Format(resources.GetString("TotalValueObtained"), data.TotalValue); textTotalWaste = String.Format(resources.GetString("TotalValueSpent"), data.TotalWaste); var labelItem = new Label(); this.SuspendLayout(); labelItem.AutoSize = true; labelItem.Location = new Point(9, position + 14); position += 60; labelItem.Name = "Status"; labelItem.Size = new Size(30, 13); labelItem.TabIndex = 1; labelItem.Text = textHeader + "\r\n" + textIndividualProfit + "\r\n" + textTotalValueObtained + "\r\n" + textTotalWaste; this.Controls.Add(labelItem); foreach (var member in data.Members) { var groupBoxPlayer = new GroupBox(); groupBoxPlayer.SuspendLayout(); var tableWidth = 0; var table = new DataListView(); ((System.ComponentModel.ISupportInitialize)(table)).BeginInit(); var colImage = new OLVColumn(); var colName = new OLVColumn(); var colQuantity = new OLVColumn(); var colValue = new OLVColumn(); var imgRender = new ImageRenderer(); // // groupBoxPlayer // groupBoxPlayer.Anchor = ((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right); groupBoxPlayer.Location = new Point(9, position + 20); groupBoxPlayer.Name = "groupBoxPlayer"; groupBoxPlayer.TabIndex = 20; groupBoxPlayer.TabStop = false; groupBoxPlayer.Text = String.Format(resources.GetString("ItensToPlayerWasted"), member.Waste.ToString()); groupBoxPlayer.Controls.Add(table); // // Table // table.AllColumns.Add(colImage); table.AllColumns.Add(colName); table.AllColumns.Add(colQuantity); table.AllColumns.Add(colValue); table.AllowColumnReorder = true; table.AllowDrop = true; table.Anchor = ((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right); table.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick; table.CellEditUseWholeCell = false; table.Columns.AddRange(new ColumnHeader[] { colImage, colName, colQuantity, colValue }); table.Cursor = Cursors.Default; table.DataSource = null; table.EmptyListMsg = resources.GetString("EmptyPlayerItemList"); // todo: search for a better font lol table.EmptyListMsgFont = new Font("Comic Sans MS", 14.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); table.FullRowSelect = true; table.GridLines = true; table.GroupWithItemCountFormat = resources.GetString("XItems"); table.GroupWithItemCountSingularFormat = resources.GetString("OneItem"); table.HideSelection = false; table.SelectedBackColor = Color.CornflowerBlue; table.SelectedForeColor = Color.MidnightBlue; table.Location = new Point(24, position + boxTableSeparator); table.Name = "olvData" + position; table.RowHeight = 32; table.SelectColumnsOnRightClickBehaviour = ObjectListView.ColumnSelectBehaviour.Submenu; table.ShowCommandMenuOnRightClick = true; table.ShowGroups = false; table.ShowImagesOnSubItems = true; table.ShowItemToolTips = true; table.TabIndex = 0; table.UseCellFormatEvents = true; table.UseCompatibleStateImageBehavior = false; table.UseFilterIndicator = true; table.UseFiltering = true; table.UseHotItem = true; table.UseTranslucentHotItem = true; table.View = View.Details; // // colImage // colImage.AspectName = "colImage"; colImage.ButtonPadding = new Size(10, 10); colImage.IsTileViewColumn = true; colImage.Text = String.Empty; colImage.UseInitialLetterForGroup = true; colImage.Width = 32; colImage.WordWrap = false; colImage.IsEditable = false; colImage.Searchable = false; colImage.Sortable = false; colImage.UseFiltering = false; colImage.Groupable = false; colImage.Renderer = imgRender; tableWidth += 32; // // colName // colName.AspectName = "colName"; colName.ButtonPadding = new Size(10, 10); colName.IsTileViewColumn = true; colName.Text = resources.GetString("Name"); colName.Width = 230; colName.IsEditable = false; tableWidth += 230; // // colQuantity // colQuantity.AspectName = "colQuantity"; colQuantity.ButtonPadding = new Size(10, 10); colQuantity.IsTileViewColumn = true; colQuantity.Text = resources.GetString("Quantity"); colQuantity.Width = 70; colQuantity.IsEditable = false; tableWidth += 70; // // colValue // colValue.AspectName = "colValue"; colValue.ButtonPadding = new Size(10, 10); colValue.IsTileViewColumn = true; colValue.Text = resources.GetString("Value"); colValue.Width = 80; colValue.IsEditable = false; tableWidth += 80; // // Fill member table // var memberDataTable = DataTableByMember(member); // unsplitted items if (data.ItemsUnsplited != null && data.ItemsUnsplited.Any() && member.MoneyRecived - member.Items.Select(y => y.Value * y.Quantity).Sum() > 0) { var value = member.MoneyRecived - member.Items.Select(y => y.Value * y.Quantity).Sum(); memberDataTable.Rows.Add( _pathHelper.DefaultImgPath, resources.GetString("AditionalValueByUnsplitedItems"), 1, value); } // if the waste is so large that a member needs to pay to another else if (data.Members.Any(x => x.MoneyRecived < 0)) { if (member.MoneyRecived < 0) { memberDataTable.Rows.Add( _pathHelper.DefaultImgPath, resources.GetString("ValueMemberNeedToPayToAnother"), 1, member.MoneyRecived); } else if (member.MoneyRecived - member.Items.Select(y => y.Value * y.Quantity).Sum() > 0) { var value = member.MoneyRecived - member.Items.Select(y => y.Value * y.Quantity).Sum(); memberDataTable.Rows.Add( _pathHelper.DefaultImgPath, resources.GetString("ValueMemberNeedToReciveAnother"), 1, value); } } table.DataSource = memberDataTable; // // Finally // var tableHeight = memberDataTable.Rows.Count > 0 ? ((memberDataTable.Rows.Count + 1) * 32) + 10 : 64 + 10; var groupBoxheight = tableHeight + 50; position += groupBoxheight + 10; groupBoxPlayer.Size = new Size(400 + boxTableSeparator, groupBoxheight); table.Size = new Size(tableWidth + 10, tableHeight); this.Controls.Add(groupBoxPlayer); this.Controls.Add(table); groupBoxPlayer.ResumeLayout(false); groupBoxPlayer.PerformLayout(); groupBoxPlayer.SendToBack(); ((System.ComponentModel.ISupportInitialize)(table)).EndInit(); } // // Unsplited Items // if (data.ItemsUnsplited != null && data.ItemsUnsplited.Any()) { var groupBoxPlayer = new GroupBox(); groupBoxPlayer.SuspendLayout(); var tableWidth = 0; var table = new DataListView(); ((System.ComponentModel.ISupportInitialize)(table)).BeginInit(); var colImage = new OLVColumn(); var colName = new OLVColumn(); var colQuantity = new OLVColumn(); var colValue = new OLVColumn(); var imgRender = new ImageRenderer(); // // groupBoxPlayer // groupBoxPlayer.Anchor = ((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right); groupBoxPlayer.Location = new Point(9, position + 20); groupBoxPlayer.Name = "groupBoxPlayer"; groupBoxPlayer.TabIndex = 20; groupBoxPlayer.TabStop = false; groupBoxPlayer.Text = resources.GetString("ItemsUnsplited"); groupBoxPlayer.Controls.Add(table); // // Table // table.AllColumns.Add(colImage); table.AllColumns.Add(colName); table.AllColumns.Add(colQuantity); table.AllColumns.Add(colValue); table.AllowColumnReorder = true; table.AllowDrop = true; table.Anchor = ((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right); table.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick; table.CellEditUseWholeCell = false; table.Columns.AddRange(new ColumnHeader[] { colImage, colName, colQuantity, colValue }); table.Cursor = Cursors.Default; table.DataSource = null; table.EmptyListMsg = resources.GetString("EmptyPlayerItemList"); // todo: search for a better font lol table.EmptyListMsgFont = new Font("Comic Sans MS", 14.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); table.FullRowSelect = true; table.GridLines = true; table.GroupWithItemCountFormat = resources.GetString("XItems"); table.GroupWithItemCountSingularFormat = resources.GetString("OneItem"); table.HideSelection = false; table.SelectedBackColor = Color.CornflowerBlue; table.SelectedForeColor = Color.MidnightBlue; table.Location = new Point(24, position + boxTableSeparator); table.Name = "olvData" + position; table.RowHeight = 32; table.SelectColumnsOnRightClickBehaviour = ObjectListView.ColumnSelectBehaviour.Submenu; table.ShowCommandMenuOnRightClick = true; table.ShowGroups = false; table.ShowImagesOnSubItems = true; table.ShowItemToolTips = true; table.TabIndex = 0; table.UseCellFormatEvents = true; table.UseCompatibleStateImageBehavior = false; table.UseFilterIndicator = true; table.UseFiltering = true; table.UseHotItem = true; table.UseTranslucentHotItem = true; table.View = View.Details; // // colImage // colImage.AspectName = "colImage"; colImage.ButtonPadding = new Size(10, 10); colImage.IsTileViewColumn = true; colImage.Text = String.Empty; colImage.UseInitialLetterForGroup = true; colImage.Width = 32; colImage.WordWrap = false; colImage.IsEditable = false; colImage.Searchable = false; colImage.Sortable = false; colImage.UseFiltering = false; colImage.Groupable = false; colImage.Renderer = imgRender; tableWidth += 32; // // colName // colName.AspectName = "colName"; colName.ButtonPadding = new Size(10, 10); colName.IsTileViewColumn = true; colName.Text = resources.GetString("Name"); colName.Width = 230; colName.IsEditable = false; tableWidth += 230; // // colQuantity // colQuantity.AspectName = "colQuantity"; colQuantity.ButtonPadding = new Size(10, 10); colQuantity.IsTileViewColumn = true; colQuantity.Text = resources.GetString("Quantity"); colQuantity.Width = 70; colQuantity.IsEditable = false; tableWidth += 70; // // colValue // colValue.AspectName = "colValue"; colValue.ButtonPadding = new Size(10, 10); colValue.IsTileViewColumn = true; colValue.Text = resources.GetString("Value"); colValue.Width = 80; colValue.IsEditable = false; tableWidth += 80; // // Fill member table // var memberDataTable = DataTableByUnsplitted(data.ItemsUnsplited); table.DataSource = memberDataTable; // // Finally // var tableHeight = memberDataTable.Rows.Count > 0 ? ((memberDataTable.Rows.Count + 1) * 32) + 10 : 64 + 10; var groupBoxheight = tableHeight + 50; position += groupBoxheight + 10; groupBoxPlayer.Size = new Size(400 + boxTableSeparator, groupBoxheight); table.Size = new Size(tableWidth + 10, tableHeight); this.Controls.Add(groupBoxPlayer); this.Controls.Add(table); groupBoxPlayer.ResumeLayout(false); groupBoxPlayer.PerformLayout(); groupBoxPlayer.SendToBack(); ((System.ComponentModel.ISupportInitialize)(table)).EndInit(); } // // Close Btn // this.closeBtn = new Button(); this.closeBtn.Anchor = (AnchorStyles.Top | AnchorStyles.Right); this.closeBtn.Location = new Point(385, 30); this.closeBtn.Name = "closeBtn"; this.closeBtn.Size = new Size(75, 23); this.closeBtn.TabIndex = 1; this.closeBtn.Text = "Close"; this.closeBtn.UseVisualStyleBackColor = true; this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); // // Window // var YScreenSize = Math.Min(position + 10, 600); this.components = new System.ComponentModel.Container(); this.AutoScaleMode = AutoScaleMode.Font; this.Text = resources.GetString("LootSplitterResult"); this.Controls.Add(closeBtn); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScroll = true; this.ClientSize = new System.Drawing.Size(470, YScreenSize); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Name = "LootSplitterResult"; this.ResumeLayout(false); this.PerformLayout(); }
public void ShowHideMD(Form frm, string GrpName) { // Complication Control grp = SubRoutine.FindControl(frm, "GrpComp"); GroupBox ctlGrp = grp as GroupBox; if (GrpName == "GrpComp") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // CPT grp = SubRoutine.FindControl(frm, "GrpCpt"); ctlGrp = grp as GroupBox; if (GrpName == "GrpCpt") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Image Descriptors grp = SubRoutine.FindControl(frm, "GrpImageDesc"); ctlGrp = grp as GroupBox; if (GrpName == "GrpImageDesc") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // DX grp = SubRoutine.FindControl(frm, "GrpDx"); ctlGrp = grp as GroupBox; if (GrpName == "GrpDx") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Dr grp = SubRoutine.FindControl(frm, "GrpDr"); ctlGrp = grp as GroupBox; if (GrpName == "GrpDr") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Fiscal Year grp = SubRoutine.FindControl(frm, "GrpFiscalYr"); ctlGrp = grp as GroupBox; if (GrpName == "GrpFiscalYr") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Hospital grp = SubRoutine.FindControl(frm, "GrpHospital"); ctlGrp = grp as GroupBox; if (GrpName == "GrpHospital") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Instrumentation grp = SubRoutine.FindControl(frm, "GrpInst"); ctlGrp = grp as GroupBox; if (GrpName == "GrpInst") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Level grp = SubRoutine.FindControl(frm, "GrpLevel"); ctlGrp = grp as GroupBox; if (GrpName == "GrpLevel") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Location grp = SubRoutine.FindControl(frm, "GrpLocation"); ctlGrp = grp as GroupBox; if (GrpName == "GrpLocation") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Surgery grp = SubRoutine.FindControl(frm, "GrpSurgery"); ctlGrp = grp as GroupBox; if (GrpName == "GrpSurgery") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } }