private void CreateEnvironmentPresentation() { int placeSize = Config.environmentPlaceSizeWidth * Config.environmentSize; tableLayoutPanel1 = new TableLayoutPanel(); tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; tableLayoutPanel1.ColumnCount = Config.environmentSize; tableLayoutPanel1.RowCount = 1; tableLayoutPanel1.Size = new System.Drawing.Size(placeSize + Config.environmentSize, Config.environmentPlaceSizeHeight); tableLayoutPanel1.Location = new System.Drawing.Point(71, 512); tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.BackColor = Color.Transparent; tableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.None; tableLayoutPanel1.BringToFront(); tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, Config.environmentPlaceSizeWidth)); for (int e = 0; e < Config.environmentSize; e++) { tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, Config.environmentPlaceSizeWidth)); } pictureBox1.Controls.Add(tableLayoutPanel1); for (int e = 0; e < Config.environmentSize; e++) { PictureBox pictureBoxGeneral = new PictureBox(); ((ISupportInitialize)(pictureBoxGeneral)).BeginInit(); pictureBoxGeneral.InitialImage = null; pictureBoxGeneral.Name = "pictureBoxGeneral" + e.ToString(); pictureBoxGeneral.Size = new System.Drawing.Size(Config.environmentPlaceSizeWidth, 55); pictureBoxGeneral.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; pictureBoxGeneral.Anchor = AnchorStyles.Bottom; pictureBoxGeneral.Visible = true; pictureBoxGeneral.MouseClick += new MouseEventHandler(ClickOnPlace); tableLayoutPanel1.Controls.Add(pictureBoxGeneral, e, 0); ((ISupportInitialize)(pictureBoxGeneral)).EndInit(); } pictureBox2.Visible = false; }
protected override void DoBuildChildren(LayoutPanelBase Layout) { base.DoBuildChildren (Layout); CaptionLabel.Dock = DockStyle.Top; TablePanel = new TableLayoutPanel (); TablePanel.Height = 200; TablePanel.RowCount = 5; TablePanel.ColumnCount = 2; TablePanel.Dock = DockStyle.Top; ParentNotePanel.Controls.Add (TablePanel); TablePanel.BringToFront (); //TablePanel.AutoSize = true; ToolTip Tipster = new ToolTip (); Label TypeOfSend = new Label (); TypeOfSend.Text = Loc.Instance.GetString ("Type"); ComboBox ComboTypeOfSend = new ComboBox (); ComboTypeOfSend.DropDownStyle = ComboBoxStyle.DropDownList; //ComboTypeOfSend.DataSource = Enum.GetValues(typeof(ControlFile.convertertype)); int selected = 0; ControlFile.convertertype[] vals = (ControlFile.convertertype[])Enum.GetValues (typeof(ControlFile.convertertype)); for (int i = 0; i < vals.Length; i++) { ComboTypeOfSend.Items.Add (vals [i]); if (vals [i].ToString () == ConverterType.ToString ()) { selected = i; } } ComboTypeOfSend.SelectedIndex = selected; //NewMessage.Show ("Trying to set " + ConverterType.ToString ()); //ComboTypeOfSend.SelectedText = ConverterType.ToString(); //ComboTypeOfSend.SelectedValue = ConverterType.ToString(); //ComboTypeOfSend.DataBindings(); //ComboTypeOfSend.SelectedIndex = (int)ConverterType; ComboTypeOfSend.SelectedIndexChanged += HandleSelectedConverterTypeIndexChanged; Label Underscores = new Label (); Underscores.Dock = DockStyle.Fill; Underscores.Text = Loc.Instance.GetString ("Underscores..."); CheckBox UnderscoresAsUnderline = new CheckBox (); UnderscoresAsUnderline.Dock = DockStyle.Top; UnderscoresAsUnderline.Width = 300; UnderscoresAsUnderline.Text = "Become Underline"; UnderscoresAsUnderline.Checked = UnderscoresUnderline; Tipster.SetToolTip (UnderscoresAsUnderline, "If true underscore text will be underlined otherwise it will be in italics."); //Underscores.AutoSize = true; CheckBox UnderscoreKeep = new CheckBox (); UnderscoreKeep.Dock = DockStyle.Top; UnderscoreKeep.Text = Loc.Instance.GetString ("Keep Underscores"); UnderscoreKeep.Checked = UnderscoresRule; Tipster.SetToolTip (UnderscoreKeep, Loc.Instance.GetString ("If set to true then underscores will always show up as underscore, no matter the other settings.")); UnderscoreKeep.Click += (object sender, EventArgs e) => UnderscoresRule = (sender as CheckBox).Checked; UnderscoresAsUnderline.Click += (object sender, EventArgs e) => UnderscoresUnderline = (sender as CheckBox).Checked; Label BodyTextLabel = new Label (); BodyTextLabel.Dock = DockStyle.Fill; BodyTextLabel.Text = Loc.Instance.GetString ("Body Text"); TextBox BodyTextText = new TextBox (); BodyTextText.Text = BodyText; BodyTextText.Dock = DockStyle.Fill; BodyTextText.TextChanged += (object sender, EventArgs e) => BodyText = (sender as TextBox).Text; BodyTextText.Width = 200; Label TemplateLabel = new Label (); TemplateLabel.Dock = DockStyle.Fill; TemplateLabel.Text = Loc.Instance.GetString ("Template"); TextBox TemplateTextBox = new TextBox (); TemplateTextBox.Text = TemplateText; TemplateTextBox.Dock = DockStyle.Fill; Tipster.SetToolTip (TemplateTextBox, Loc.Instance.GetString ("This is the Word template file, if generating a word document this will be the template used")); TemplateTextBox.TextChanged += (object sender, EventArgs e) => TemplateText = (sender as TextBox).Text; TemplateTextBox.Width = 200; // invokes a modal PropertyGrid for editing the entire fille Button EditAll = new Button (); EditAll.Text = Loc.Instance.GetString ("Edit All Details"); EditAll.Click += HandleEditAllClick; EditAll.Dock = DockStyle.Fill; TablePanel.Controls.Add (TypeOfSend, 0, 0); TablePanel.Controls.Add (ComboTypeOfSend, 1, 0); TablePanel.Controls.Add (Underscores, 0, 1); TablePanel.Controls.Add (UnderscoresAsUnderline, 1, 1); TablePanel.Controls.Add (UnderscoreKeep, 1, 2); TablePanel.Controls.Add (BodyTextLabel, 0, 3); TablePanel.Controls.Add (BodyTextText, 1, 3); TablePanel.Controls.Add (TemplateLabel, 0, 4); TablePanel.Controls.Add (TemplateTextBox, 1, 4); Button Generate = new Button(); Generate.Dock = DockStyle.Fill; Generate.Click+= HandleGenerateClick; Generate.Text = Loc.Instance.GetString ("Generate"); TablePanel.Controls.Add (Generate, 0, 5); TablePanel.Controls.Add (EditAll, 1, 5); // TablePanel.ColumnStyles[0].SizeType = SizeType.Percent;; // TablePanel.ColumnStyles[0].Width = 25; // // TablePanel.ColumnStyles[1].SizeType = SizeType.Percent;; // TablePanel.ColumnStyles[1].Width = 75; // foreach (ColumnStyle style in TablePanel.ColumnStyles) { // // NewMessage.Show (style.ToString()); // style.SizeType = SizeType.Percent; // style.Width = 50; // } if (richBox.Text == Constants.BLANK) { richBox.Text = Loc.Instance.GetStringFmt("[[index]]{0}Enter Page Name Here Followed By Line Space{0}", Environment.NewLine); } richBox.BringToFront(); TablePanel.ColumnStyles.Clear(); for (int i = 0; i < TablePanel.ColumnCount; i++) { TablePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.0f)); } TablePanel.RowStyles.Clear(); for (int i = 0; i < TablePanel.RowCount; i++) { TablePanel.RowStyles.Add(new RowStyle(SizeType.AutoSize)); } }
private void suggest(List<GurpsProperty> suggestions) { if (suggestions.Count == 0) { clearSearchSuggestions(); return; } if (searchSuggestionBox == null) { searchSuggestionBox = new TableLayoutPanel(); Point location = characterSheet.PointToClient(newItemTextBox.Parent.PointToScreen(newItemTextBox.Location)); location.Offset(0, newItemTextBox.Height); searchSuggestionBox.Location = location; searchSuggestionBox.AutoSizeMode = AutoSizeMode.GrowAndShrink; searchSuggestionBox.AutoSize = true; searchSuggestionBox.BackColor = Color.White; characterSheet.Controls.Add(searchSuggestionBox); searchSuggestionBox.BringToFront(); } using (new LayoutSuspender(searchSuggestionBox)) { searchSuggestionBox.Controls.Clear(); foreach (var suggestion in suggestions) { Label label = new Label(); label.Text = suggestion.DisplayName; label.AutoSize = true; label.Dock = DockStyle.Fill; label.MouseEnter += (EventHandler)((_, __) => { label.BackColor = Color.PaleTurquoise; }); label.MouseLeave += (EventHandler)((_, __) => { label.BackColor = Color.Transparent; }); var localSelection = suggestion; label.MouseDown += (MouseEventHandler)((_, __) => { addNewItem(localSelection); }); searchSuggestionBox.Controls.Add(label); } } }
public dashboardMarketEdit(DataTable _dataSource, Action<string, string> _UpdateSelectedMarket, LayoutPanelBase _CurrentLayout) { CurrentLayout = _CurrentLayout; if (null == _dataSource) throw new Exception ("invalid data source passed in"); UpdateSelectedMarket = _UpdateSelectedMarket; MarketFilters = BuildMarketFilterBox (); // NewMessage.Show ("boo"); ListOfMarkets = new ListBox (); if (_dataSource.PrimaryKey.Length == 0) { _dataSource.PrimaryKey = new DataColumn[] { _dataSource.Columns ["Guid"] }; } ViewOfTheData = new DataView (_dataSource); ViewOfTheData.Sort = "Caption ASC"; ViewOfTheData.ListChanged += new System.ComponentModel.ListChangedEventHandler (OnListChanged); //ViewOfTheData.RowFilter = BuildRowFilter(); ListOfMarkets.DataSource = ViewOfTheData;//_dataSource; ListOfMarkets.SelectedIndexChanged += HandleMarketListSelectedIndexChanged; ListOfMarkets.DisplayMember = "Caption"; //ListOfMarkets.DoubleClick+= HandleListOfDoubleClick; // ListOfMarkets.MouseDown+= HandleListOfMarketsMouseDown; //ListOfMarkets.Sorted = true; //ListOfMarkets.Width = 200; // // TAB CONTROL SIDE // TabControl Tabs = new TabControl (); Tabs.Dock = DockStyle.Fill; TabPage MarketEditing = new TabPage (); MarketEditing.Text = Loc.Instance.GetString ("Market Details"); TabPage MarketSubmissions = new TabPage (); MarketSubmissions.Text = Loc.Instance.GetString ("Market Submissions"); TabPage MarketNotes = new TabPage (); MarketNotes.Text = Loc.Instance.GetString ("Market Notes"); Tabs.TabPages.Add (MarketEditing); Tabs.TabPages.Add (MarketNotes); Tabs.TabPages.Add (MarketSubmissions); Tabs.SelectedIndexChanged += HandleMiniTabSelectedIndexChanged; SubLabel = new Label (); SubLabel.Text = Loc.Instance.GetString ("Submissions"); SubLabel.Dock = DockStyle.Top; DestLabel = new Label (); DestLabel.Dock = DockStyle.Bottom; DestLabel.Text = Loc.Instance.GetString ("Destinations"); PreviousSubmissions = new ListBox (); PreviousSubmissions.DoubleClick += HandlePreviousSubmissionsDoubleClick; PreviousSubmissions.Dock = DockStyle.Fill; //PreviousSubmissions.Height = 100; Destinations = new ListBox (); Destinations.Dock = DockStyle.Bottom; Destinations.Height = 100; tmpEditor = new PropertyGrid (); tmpEditor.Dock = DockStyle.Fill; tmpEditor.PropertyValueChanged += HandlePropertyValueChanged; tmpEditor.Height = 300; MarketEditing.Controls.Add (tmpEditor); MarketSubmissions.Controls.Add (DestLabel); MarketSubmissions.Controls.Add (PreviousSubmissions); PreviousSubmissions.BringToFront (); MarketSubmissions.Controls.Add (SubLabel); MarketSubmissions.Controls.Add (Destinations); // // MAIN TABlE // // Panel EasyMarketEdit = new Panel(); // EasyMarketEdit.BackColor = Color.Green; // EasyMarketEdit.Height = 200; // EasyMarketEdit.Dock = DockStyle.Fill; // EasyMarketEdit.Controls.Add (Tabs); // tmpEditor.Enabled = false; tmpEditor.BringToFront (); AddMarket = new Button (); AddMarket.Dock = DockStyle.Bottom; AddMarket.Text = Loc.Instance.GetString ("Add Market"); AddMarket.Click += HandleAddMarketClick; EditMarket = new Button (); EditMarket.Text = Loc.Instance.GetString ("Save Edits"); EditMarket.Dock = DockStyle.Fill; EditMarket.Enabled = false; EditMarket.Click += HandleEditMarketClick; EditMarketCancel = new Button (); EditMarketCancel.Dock = DockStyle.Fill; EditMarketCancel.Text = Loc.Instance.GetString ("Cancel Edit"); EditMarketCancel.Enabled = false; EditMarketCancel.Click += HandleEditMarketCancelClick; TableLayoutPanel MarketListPanel = new TableLayoutPanel (); MarketListPanel.RowCount = 2; MarketListPanel.ColumnCount = 3; MarketListPanel.Controls.Add (EditMarket, 1, 0); MarketListPanel.Controls.Add (AddMarket, 0, 0); MarketListPanel.Controls.Add (EditMarketCancel, 2, 0); //MarketListPanel.Controls.Add (EditMarketCancel, 1, 0); //MarketListPanel.Controls.Add (ListOfMarkets, 0, 1); MarketListPanel.Controls.Add (Tabs, 1, 1); MarketListPanel.SetColumnSpan (Tabs, 2); // MarketListPanel.Controls.Add (PreviousSubmissions, 1, 2); // MarketListPanel.Controls.Add (AddMarket, 0, 3); Panel RightSide = new Panel(); RightSide.Controls.Add (MarketFilters); RightSide.Controls.Add (ListOfMarkets); ListOfMarkets.Dock = DockStyle.Fill; ListOfMarkets.BringToFront(); RightSide.Dock = DockStyle.Fill; RightSide.BringToFront (); MarketListPanel.Controls.Add (RightSide, 0, 1); MarketListPanel.SetRowSpan(Tabs, 2); MarketListPanel.SetRowSpan(RightSide, 2); MarketListPanel.Dock = DockStyle.Fill; //this.Controls.Add (AddMarket); //NewMessage.Show ("boo2"); this.Controls.Add (MarketListPanel); MarketListPanel.BringToFront(); // AddMarket.SendToBack(); // // Setup Market Notes Pages // richBox = new RichTextBox(); MarketNotes.Controls.Add (richBox); richBox.Dock = DockStyle.Fill; richBox.KeyDown+= HandleNotesKeyDown; MarketListPanel.ColumnStyles.Clear(); for (int i = 0; i < MarketListPanel.ColumnCount; i++) { ColumnStyle style = new ColumnStyle(SizeType.Percent, 33.0f); MarketListPanel.ColumnStyles.Add(style); } MarketListPanel.RowStyles.Clear(); for (int i = 0; i < MarketListPanel.RowCount; i++) { MarketListPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize)); } }
private void InitMenuButtons() { tlpButtons = new TableLayoutPanel(); pnlButtonPlace.Controls.Add(tlpButtons); tlpButtons.BringToFront(); tlpButtons.Dock = DockStyle.Fill; tlpButtons.GrowStyle = TableLayoutPanelGrowStyle.AddRows; tlpButtons.RowCount = cl.lCIKKCSOPORT.Count + 1; int j = 0; for (int i = CikkCsopScrollPos; i < (cl.lCIKKCSOPORT.Count); i++) { if (j < needScroll) { CikkcsopButton bt = new CikkcsopButton(cl.lCIKKCSOPORT[i]); bt.Location = new Point(0, 0); bt.Text = cl.lCIKKCSOPORT[i].NEV; bt.TextAlign = ContentAlignment.BottomLeft; bt.Dock = DockStyle.Fill; bt.BackColor = Color.Transparent; bt.Click += CikkcsopMenuClick; //bt.ImageList = btmImgList; bt.BackgroundImageLayout = ImageLayout.Stretch; //bt.ImageIndex = 0; tlpButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(SizeType.Absolute, CCSOP_BTN_SIZE)); tlpButtons.Controls.Add(bt); //bt.Invalidate(); } j++; } //tlpButtons.AutoScroll = true; tlpButtons.Refresh(); }
private void CikkcsopMenuClick(object sender, EventArgs e) { if (checkBox1.Checked) { if (AktSzerkesztettCikk != null) { checkBox1.Text = ((CikkcsopButton)sender)._Cikkcsoport.NEV; AktSzerkesztettCikk.CIKKCSOPORT_ID = ((CikkcsopButton)sender)._Cikkcsoport.ID; AktSzerkesztettCikk.Save(); } AktSzerkesztettCikk = new Cikk(AktSzerkesztettCikk.CIKK_ID, true); checkBox1.Checked = false; ((CikkcsopButton)sender).Checked = false; lblCikkcsopSelectInfo.Visible = false; } else { if (reset_scrolls) { AlCsopScrollPos = 0; } LastCikkcsopMenu = sender; LastOtherFilterMenu = null; OTF_list otf = new OTF_list(((CikkcsopButton)sender)._Cikkcsoport.ID, new SqlConnection(DEFS.ConSTR)); Alcsop_MaxScroll = otf.lOTF.Count; if (otf.lOTF.Count > 0) { pnlOtherFilter.Visible = true; TableLayoutPanel tlpOTFButtons = new TableLayoutPanel(); pnlOtherFilter.Controls.Add(tlpOTFButtons); tlpOTFButtons.Dock = DockStyle.Fill; tlpOTFButtons.BringToFront(); tlpOTFButtons.GrowStyle = TableLayoutPanelGrowStyle.AddColumns; tlpOTFButtons.ColumnCount = otf.lOTF.Count + 1; tlpOTFButtons.RowCount = 1; for (int i = AlCsopScrollPos; i < (otf.lOTF.Count); i++) { OtherFButton bt = new OtherFButton(otf.lOTF[i]); bt.Location = new Point(0, 0); bt.Text = otf.lOTF[i].ONEV; bt.TextAlign = ContentAlignment.TopCenter; bt.Dock = DockStyle.Fill; bt.Click += AlcsopMenuClick; tlpOTFButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 120)); tlpOTFButtons.Controls.Add(bt); } tlpOTFButtons.Refresh(); } else { pnlOtherFilter.Visible = false;/* pnlOldalsav.Visible = false;*/ } if (pnlOtherFilter.Visible) { //pnlOldalsav.Visible = true; //pnlOldalsav.Height = ((CikkcsopButton)sender).Parent.Parent.Location.Y + ((CikkcsopButton)sender).Location.Y + ((CikkcsopButton)sender).Height - pnlOtherFilter.Height; } ((CikkcsopButton)sender).Refresh(); loadCikkek(((CikkcsopButton)sender)._Cikkcsoport.ID, -1, null); //if (Call) { loadCikkek(((CikkcsopButton)sender)._Cikkcsoport.fCIKKCSOPORT_ID, -1); } Alcsop_needScroll = pnlOtherFilter.Width / 120; } }
protected override void DoBuildChildren(LayoutPanelBase Layout) { base.DoBuildChildren (Layout); CaptionLabel.Dock = DockStyle.Top; TablePanel = new TableLayoutPanel (); TablePanel.RowCount = 4; TablePanel.ColumnCount = 2; TablePanel.Dock = DockStyle.Top; ParentNotePanel.Controls.Add (TablePanel); TablePanel.BringToFront (); TablePanel.AutoSize = true; // // GENDER // Label GenderLabel = new Label (); GenderLabel.Text = Loc.Instance.GetString ("Gender"); GenderLabel.Click += (object sender, EventArgs e) => BringToFrontAndShow (); ComboBox GenderCombo = new ComboBox (); GenderCombo.DropDownStyle = ComboBoxStyle.DropDownList; GenderCombo.Items.Add ("Male"); GenderCombo.Items.Add ("Female"); GenderCombo.Items.Add ("Other"); if (Gender == Constants.BLANK) { GenderCombo.SelectedIndex = 0; } else { for (int i = 0; i < GenderCombo.Items.Count; i++) { //NewMessage.Show (String.Format ("Comparing {0} to {1}", GenderCombo.Items [i].ToString (), Gender)); if (GenderCombo.Items [i].ToString () == Gender) { GenderCombo.SelectedIndex = i; break; } } } GenderCombo.SelectedIndexChanged += HandleGenderSelectedIndexChanged; // // PRIORITY // Label PriorityLabel = new Label (); PriorityLabel.Text = Loc.Instance.GetString ("Priority"); PriorityLabel.Click += (object sender, EventArgs e) => BringToFrontAndShow (); NumericUpDown PriorityPicker = new NumericUpDown (); PriorityPicker.Maximum = 100; PriorityPicker.Minimum = 0; PriorityPicker.Value = Priority; PriorityPicker.ValueChanged += HandleValueChanged; ToolTip tipster = new ToolTip (); tipster.SetToolTip (PriorityPicker, Loc.Instance.GetString ("The higher the more likely Proofreader will select this character as the current speaker.")); // // Alias // Label AliasLabel = new Label (); AliasLabel.Text = Loc.Instance.GetString ("Alias"); AliasLabel.Click += (object sender, EventArgs e) => BringToFrontAndShow (); TextBox AliasEdit = new TextBox (); tipster.SetToolTip (AliasEdit, Loc.Instance.GetString ("Enter a comma separated list of alternate names for this character to assist the Proofreader in determining the current speaker.")); AliasEdit.Text = Alias; AliasEdit.TextChanged += HandleTextChanged; // // COLOR // ColorLabel = new Label (); ColorLabel.Text = Loc.Instance.GetString ("Color"); ColorLabel.Click += (object sender, EventArgs e) => BringToFrontAndShow (); ColorCombo = new ComboBox (); ColorCombo.DropDownStyle = ComboBoxStyle.DropDownList; int count = 0; int matchcount = 0; ColorCombo.DisplayMember = "Name"; // CharacterColor = Color.FromArgb(characterColorInt); // NewMessage.Show("Loading Color " + CharacterColor.Name); foreach (Color c in LayoutDetails.Instance.HighlightColorList) { ColorCombo.Items.Add (c); //NewMessage.Show ("Comparing " + c.Name + " to " + CharacterColor.Name); if (c.Name == ColorName) { //NewMessage.Show ("Match " + c.Name); matchcount = count; } count++; } ColorCombo.SelectedIndex = matchcount; ColorCombo.SelectedIndexChanged+= HandleSelectedColorIndexChanged; ColorLabel.BackColor = (Color)ColorCombo.SelectedItem; ColorLabel.ForeColor = TextUtils.InvertColor(ColorLabel.BackColor); ToolStripButton ToggleView = new ToolStripButton(); ToggleView.Text = Loc.Instance.GetString ("Toggle View"); ToggleView.Click+= HandleToggleViewClick; TablePanel.Controls.Add(GenderLabel,0,0); TablePanel.Controls.Add(GenderCombo,1,0); TablePanel.Controls.Add(PriorityLabel,0,1); TablePanel.Controls.Add(PriorityPicker,1,1); TablePanel.Click+= (object sender, EventArgs e) => BringToFrontAndShow(); TablePanel.Controls.Add(AliasLabel,0,2); TablePanel.Controls.Add(AliasEdit,1,2); TablePanel.Controls.Add (ColorLabel,0, 3); TablePanel.Controls.Add (ColorCombo,1, 3); properties.DropDownItems.Add (ToggleView); SetupForView(); richBox.BringToFront(); }
private void f_CreatePanel() { m_Panel = new TableLayoutPanel(); m_Panel.Width = 276; m_Panel.Height = 76; m_Panel.Left = (Parent.ClientSize.Width / 2) - (m_Panel.Width / 2); m_Panel.Top = (Parent.ClientSize.Height / 2) - (m_Panel.Height / 2); m_Panel.BorderStyle = BorderStyle.FixedSingle; m_Panel.ForeColor = Color.Black; m_Panel.BackColor = Color.White; m_Panel.Visible = true; m_Panel.Padding = new Padding(6); m_Panel.ColumnCount = 3; m_Panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); m_Panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); m_Panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); m_Panel.RowCount = 2; m_Panel.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); m_Panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 40)); Parent.Controls.Add(m_Panel); m_Label = new Label(); m_Label.TextAlign = ContentAlignment.MiddleCenter; m_Label.Dock = DockStyle.Fill; m_Label.Text = m_message ?? "No Message Specified"; m_Label.Visible = true; m_PictureBox = new PictureBox(); m_PictureBox.Width = 32; m_PictureBox.Height = 32; m_PictureBox.Padding = new Padding(0); m_PictureBox.BorderStyle = BorderStyle.None; m_PictureBox.Dock = DockStyle.Fill; m_PictureBox.Image = null; m_Panel.Controls.Add(m_Label, 0, 0); m_Panel.Controls.Add(m_PictureBox, 1, 1); m_Panel.SetColumnSpan(m_Label, 3); m_Panel.BringToFront(); }
public void Show(string DisplayText) { if (m_Parent.InvokeRequired) { try { m_Parent.Invoke(new m_dStrParam(Show), DisplayText); } catch { }; } else { m_Message = DisplayText; m_Panel = new TableLayoutPanel(); m_Panel.Width = 276; m_Panel.Height = 76; m_Panel.Left = (m_Parent.ClientSize.Width / 2) - (m_Panel.Width / 2); m_Panel.Top = (m_Parent.ClientSize.Height / 2) - (m_Panel.Height / 2); m_Panel.BorderStyle = BorderStyle.FixedSingle; m_Panel.ForeColor = Color.Black; m_Panel.BackColor = Color.White; m_Panel.Visible = true; m_Panel.Padding = new Padding(6); m_Panel.ColumnCount = 3; m_Panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); m_Panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); m_Panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); m_Panel.RowCount = 2; m_Panel.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); m_Panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 40)); m_Parent.Controls.Add(m_Panel); m_Panel.BringToFront(); m_Label = new Label(); m_Label.TextAlign = ContentAlignment.MiddleCenter; m_Label.Dock = DockStyle.Fill; m_Label.Text = m_Message; m_Label.Visible = true; m_ProgressControl = new ProgressBarControl(); m_ProgressControl.Width = 260; m_ProgressControl.Height = 28; m_ProgressControl.Dock = DockStyle.Bottom; m_ProgressControl.Properties.Appearance.BorderColor = Color.FromArgb(0,0,0); m_ProgressControl.Properties.Appearance.ForeColor = Color.Black; m_ProgressControl.Properties.Appearance.Options.UseBorderColor = true; m_ProgressControl.Properties.Appearance.Options.UseForeColor = true; m_ProgressControl.Properties.Appearance.Options.UseTextOptions = true; m_ProgressControl.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Near; m_ProgressControl.Properties.BorderStyle = BorderStyles.Simple; m_ProgressControl.Properties.EndColor = Color.FromArgb(64, 64, 64); m_ProgressControl.Properties.LookAndFeel.Style = LookAndFeelStyle.Flat; m_ProgressControl.Properties.LookAndFeel.UseDefaultLookAndFeel = false; m_ProgressControl.Properties.ProgressViewStyle = ProgressViewStyle.Solid; m_ProgressControl.Properties.ShowTitle = true; m_ProgressControl.Properties.StartColor = Color.FromArgb(200, 200, 200); m_ProgressControl.Properties.DisplayFormat.Format = new CustomFormatter(this, FormatString ?? "{0:0}%"); m_ProgressControl.Properties.DisplayFormat.FormatType = FormatType.Custom; m_ProgressControl.Properties.Minimum = m_Min; m_ProgressControl.Properties.Maximum = m_Max; m_ProgressControl.Properties.Step = m_Step; m_ProgressControl.EditValue = m_Value; m_ProgressControl.EditValueChanged += (sender, e) => { m_Value = (int)m_ProgressControl.EditValue; }; m_Panel.Controls.Add(m_Label, 0, 0); m_Panel.Controls.Add(m_ProgressControl, 1, 1); m_Panel.SetColumnSpan(m_Label, 3); } }