public void AddLabel(Image image, string text, Action action, bool flowBreak) { var label = new ItemLabel() { Margin = Padding.Empty, Image = image, Size = _labelSize, }; label.Click += (sender, e) => action(); ++_currentCol; if (_currentCol > _maxCols) { _currentCol = 0; ++_rowCount; } _panel.Controls.Add(label); if (flowBreak && _currentCol != 0) { _panel.SetFlowBreak(label, true); _currentCol = 0; ++_rowCount; } _labels.Add(label); _toolTip.SetToolTip(label, text); }
public VwXls() { InitializeComponent(); { FlowLayoutPanel flp = flperr = new FlowLayoutPanel(); flp.Hide(); flp.Dock = DockStyle.Fill; { PictureBox pb = new PictureBox(); pb.Image = Resources.eventlogError.ToBitmap(); pb.SizeMode = PictureBoxSizeMode.AutoSize; flp.Controls.Add(pb); } { Label la = laerr1 = new Label(); la.AutoSize = true; flp.Controls.Add(la); flp.SetFlowBreak(la, true); } { Label la = laerr2 = new Label(); la.AutoSize = true; flp.Controls.Add(la); } flp.Parent = this; } { TableLayoutPanel p = flpwip = new TableLayoutPanel(); p.Hide(); p.Dock = DockStyle.Fill; p.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); p.RowStyles.Add(new RowStyle(SizeType.AutoSize)); { FlowLayoutPanel flp = new FlowLayoutPanel(); flp.Anchor = AnchorStyles.None; flp.AutoSize = true; flp.AutoSizeMode = AutoSizeMode.GrowAndShrink; flp.BackColor = Color.WhiteSmoke; flp.ForeColor = Color.Black; { Label la = lawip = new Label(); la.AutoSize = true; flp.Controls.Add(la); flp.SetFlowBreak(la, true); } { ProgressBar pb = new ProgressBar(); pb.Style = ProgressBarStyle.Marquee; flp.Controls.Add(pb); } p.Controls.Add(flp); flp.Show(); } p.Parent = this; } Sync = SynchronizationContext.Current; }
public void TestExtenderProvider() { FlowLayoutPanel p = new FlowLayoutPanel (); Button b = new Button(); Assert.AreEqual(false, p.GetFlowBreak(b), "B1"); p.SetFlowBreak(b, true); Assert.AreEqual (true, p.GetFlowBreak (b), "B2"); }
private void AddPrinters() { SuspendLayout(); int prevTop = 0; Height = 0; foreach (Printer printer in printers ) { FlowLayoutPanel printerPanel = new FlowLayoutPanel(); printerPanel.FlowDirection = FlowDirection.LeftToRight; printerPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; Label lblPrinterName = new Label(); lblPrinterName.Text = printer.Name; lblPrinterName.AutoSize = true; printerPanel.SetFlowBreak( lblPrinterName, true ); printerPanel.Controls.Add(lblPrinterName); int rows = 1; try { InkTank[] tanks = printer.GetTanks(printer.Server, printer.Port, printer.Device); foreach (InkTank tank in tanks) { addTank(printerPanel, tank); } rows += tanks.Count(); } catch (Exception e) { Label error = new Label(); error.AutoSize = true; error.Text = e.Message; printerPanel.Controls.Add(error); rows += 2 ; } printerPanel.Top = prevTop; printerPanel.Width = this.Width; printerPanel.Height = 20 * rows; Height = rows * 20; Controls.Add(printerPanel); prevTop = printerPanel.Bottom + 1; } ResumeLayout(); }
public void TopDownLayoutTest18 () { // SetFlowBreak has no effect when WrapContents = false FlowLayoutPanel p = new FlowLayoutPanel (); p.Size = new Size (100, 200); p.WrapContents = false; p.FlowDirection = FlowDirection.TopDown; p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.SetFlowBreak (p.Controls[0], true); Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "BT1"); Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[1].Bounds, "BT2"); }
public void TopDownLayoutTest17 () { // Random Complex Layout 2 FlowLayoutPanel p = new FlowLayoutPanel (); p.Size = new Size (100, 200); p.FlowDirection = FlowDirection.TopDown; p.Controls.Add (CreateButton (12, 345, false, DockStyle.Right, new Padding (1, 2, 3, 4), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (9, 44, false, DockStyle.Left, new Padding (6, 3, 2, 7), AnchorStyles.Right | AnchorStyles.Top)); p.Controls.Add (CreateButton (78, 14, false, DockStyle.None, new Padding (5, 1, 2, 4), AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right)); p.Controls.Add (CreateButton (21, 64, false, DockStyle.Left, new Padding (3, 3, 3, 1), AnchorStyles.None)); p.Controls.Add (CreateButton (14, 14, false, DockStyle.Fill, new Padding (11, 4, 6, 3), AnchorStyles.Left | AnchorStyles.Right)); p.Controls.Add (CreateButton (132, 6, false, DockStyle.Fill, new Padding (5, 5, 4, 5), AnchorStyles.Left | AnchorStyles.Right)); p.SetFlowBreak (p.Controls[0], true); p.SetFlowBreak (p.Controls[2], true); Assert.AreEqual (new Rectangle (1, 2, 12, 345), p.Controls[0].Bounds, "BS1"); Assert.AreEqual (new Rectangle (22, 3, 9, 44), p.Controls[1].Bounds, "BS2"); Assert.AreEqual (new Rectangle (21, 55, 10, 14), p.Controls[2].Bounds, "BS3"); Assert.AreEqual (new Rectangle (36, 3, 21, 64), p.Controls[3].Bounds, "BS4"); Assert.AreEqual (new Rectangle (44, 72, 10, 14), p.Controls[4].Bounds, "BS5"); Assert.AreEqual (new Rectangle (38, 94, 18, 6), p.Controls[5].Bounds, "BS6"); }
public void TopDownLayoutTest13 () { // SetFlowBreak 1, 3 FlowLayoutPanel p = new FlowLayoutPanel (); p.Size = new Size (100, 200); p.FlowDirection = FlowDirection.TopDown; p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.SetFlowBreak (p.Controls[0], true); p.SetFlowBreak (p.Controls[2], true); Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "BO1"); Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "BO2"); Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[2].Bounds, "BO3"); Assert.AreEqual (new Rectangle (200, 0, 100, 100), p.Controls[3].Bounds, "BO4"); }
public void RightToLeftLayoutTest17 () { // Random Complex Layout 2 FlowLayoutPanel p = new FlowLayoutPanel (); p.FlowDirection = FlowDirection.RightToLeft; p.Controls.Add (CreateButton (12, 345, false, DockStyle.Bottom, new Padding (1, 2, 3, 4), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (9, 44, false, DockStyle.Top, new Padding (6, 3, 2, 7), AnchorStyles.Right | AnchorStyles.Top)); p.Controls.Add (CreateButton (78, 14, false, DockStyle.None, new Padding (5, 1, 2, 4), AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right)); p.Controls.Add (CreateButton (21, 64, false, DockStyle.Top, new Padding (3, 3, 3, 1), AnchorStyles.None)); p.Controls.Add (CreateButton (14, 14, false, DockStyle.Fill, new Padding (11, 4, 6, 3), AnchorStyles.Top | AnchorStyles.Bottom)); p.Controls.Add (CreateButton (132, 6, false, DockStyle.Fill, new Padding (5, 5, 4, 5), AnchorStyles.Top | AnchorStyles.Bottom)); p.SetFlowBreak (p.Controls[0], true); p.SetFlowBreak (p.Controls[2], true); Assert.AreEqual (new Rectangle (185, 2, 12, 345), p.Controls[0].Bounds, "AS1"); Assert.AreEqual (new Rectangle (189, 354, 9, 44), p.Controls[1].Bounds, "AS2"); Assert.AreEqual (new Rectangle (103, 352, 78, 49), p.Controls[2].Bounds, "AS3"); Assert.AreEqual (new Rectangle (176, 408, 21, 64), p.Controls[3].Bounds, "AS4"); Assert.AreEqual (new Rectangle (153, 409, 14, 61), p.Controls[4].Bounds, "AS5"); Assert.AreEqual (new Rectangle (6, 410, 132, 58), p.Controls[5].Bounds, "AS6"); }
public void LeftToRightLayoutTest13 () { // SetFlowBreak 1, 3 FlowLayoutPanel p = new FlowLayoutPanel (); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top)); p.SetFlowBreak (p.Controls[0], true); p.SetFlowBreak (p.Controls[2], true); Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "O1"); Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[1].Bounds, "O2"); Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[2].Bounds, "O3"); Assert.AreEqual (new Rectangle (0, 200, 100, 100), p.Controls[3].Bounds, "O4"); }
private void getExtensions(string path) { allExtensions = new List<string>(); included = new List<string>(); parseFromDirectory(path, true); Form prompt = new Form(); prompt.AutoSize = true; prompt.Text = "Choose Extensions"; FlowLayoutPanel panel = new FlowLayoutPanel(); panel.AutoSize = true; List<CheckBox> lc = new List<CheckBox>(); for (int i = 0; i < allExtensions.Count; i++) { lc.Add(new CheckBox()); lc[i].Text = allExtensions[i]; panel.Controls.Add(lc[i]); panel.SetFlowBreak(lc[i], true); } Button ok = new Button() { Text = "Confirm" }; ok.Click += (sender, e) => { for (int i = 0; i < lc.Count; i++) { if (lc[i].Checked) included.Add(lc[i].Text); } prompt.Close(); }; Button no = new Button() { Text = "Cancel" }; no.Click += (sender, e) => { prompt.Close(); }; panel.Controls.Add(ok); panel.Controls.Add(no); prompt.Controls.Add(panel); prompt.ShowDialog(); }
private static void addTank(FlowLayoutPanel printerPanel, InkTank tank) { // add label string tankName = tank.Color.Name; if (tank.IsPhoto) tankName = "Photo " + tankName; // add progress bar ColorBar barTank = new ColorBar(); if (tank.IsPhoto) { //Color.FromArgb(0, tank.Color); const int upVal = 100; barTank.ForeColor = Color.FromArgb( Math.Min(255, tank.Color.R + upVal), Math.Min(255, tank.Color.G + upVal), Math.Min(255, tank.Color.B + upVal)); } else { barTank.ForeColor = tank.Color; } barTank.TextColor = Color.FromArgb(255 - barTank.ForeColor.R, 255 - barTank.ForeColor.G, 255 - barTank.ForeColor.B); barTank.Height = 15; barTank.Width = printerPanel.Width - barTank.Left * 2; barTank.Value = (int)tank.Pct; barTank.Text = tankName + " (" + tank.Pct + "%)"; printerPanel.SetFlowBreak(barTank, true); printerPanel.Controls.Add(barTank); }
/// <summary> /// ��������� ������ �������� /// </summary> void UpdateNews() { current.UpdateConnection(); QueryResult news = Query.Execute(current.Connection, @"select datemess, title, message, newsid from news n where newsid not in (select newsid from usernews) or newsid in (select newsid from usernews un where un.userid = :1) or newsid in (select newsid from usernews un where un.userid = :2) order by datemess desc", new string[] { "1", "2" }, new object[] { current.User.id, current.User.groupid }); current.CloseConnection(); int NewsRow = NewsLayoutPanel.RowCount-1; NewsLayoutPanel.RowCount += news.Rows.Count; foreach (DataRow item in news.Rows) { FlowLayoutPanel flowpanel = new FlowLayoutPanel(); flowpanel.Dock = DockStyle.Top; flowpanel.AutoSize = true; Label Title = new Label(); Title.AutoSize = true; Title.Text = ((DateTime)item["datemess"]).ToString("dd.MM.yyyy HH:mm") + " " + item["title"].ToString(); Title.ForeColor = Color.Blue; //Title.Font = new Font("Times New Roman", 12, FontStyle.Bold); Title.Font = new Font("Tahoma", 9, FontStyle.Bold); flowpanel.Controls.Add(Title); flowpanel.SetFlowBreak(Title, true); Label Message = new Label(); Message.AutoSize = true; Message.Text = item["message"].ToString(); //Message.Font = new Font("Times New Roman", 12); Message.Font = new Font("Tahoma", 9); flowpanel.Controls.Add(Message); NewsLayoutPanel.Controls.Add(flowpanel, 0, NewsRow); NewsRow++; } }
private Dialog() { Name = Properties.Resources.ResourceManager.GetString("Message"); Icon = Icon = Properties.Resources.GClientGTLogo; FormBorderStyle = FormBorderStyle.FixedSingle; MaximizeBox = false; MinimizeBox = false; pl = new Panel(); pl.Dock = DockStyle.Fill; panel2 = new Panel(); label1 = new Label(); label1.AutoSize = true; label1.Font = new Font("Century Gothic", 11.75F); label1.ForeColor = Color.FromArgb(224, 224, 224); label1.Location = new Point(4, 6); label1.Name = "label1"; label1.Size = new Size(96, 21); label1.TabIndex = 1; label1.Text = "GClient GT"; panel2.BackColor = Color.FromArgb(45, 45, 45); panel2.Controls.Add(label1); panel2.Location = new Point(1, 1); panel2.Name = "panel2"; panel2.Size = new Size(498, 33); panel2.TabIndex = 3; Controls.Add(panel2); flp = new FlowLayoutPanel(); flp.Dock = DockStyle.Fill; lblMessage = new Label(); lblMessage.Font = new Font("Segoe UI", 10); lblMessage.ForeColor = Color.White; lblMessage.AutoSize = true; txtPl = new Panel(); txtPl.BorderStyle = BorderStyle.None; txtPl.Width = 460; txtPl.Height = 28; txtPl.Padding = new Padding(5); txtPl.BackColor = Color.White; txtPl.Margin = new Padding(0, 15, 0, 0); txtPl.Paint += txtPl_Paint; txtInput = new TextBox(); txtInput.Dock = DockStyle.Fill; txtInput.BorderStyle = BorderStyle.None; txtInput.Font = new Font("Segoe UI", 9); txtInput.KeyDown += txtInput_KeyDown; txtInput.BackColor = Color.FromArgb(240, 240, 240); txtInput.Multiline = true; txtPl.Controls.Add(txtInput); flpButtons = new FlowLayoutPanel(); flpButtons.Dock = DockStyle.Bottom; flpButtons.FlowDirection = FlowDirection.RightToLeft; flpButtons.Height = 35; btnCancel = new Button(); btnCancel.Text = Properties.Resources.ResourceManager.GetString("Cancel"); btnCancel.ForeColor = Color.FromArgb(170, 170, 170); btnCancel.Font = new Font("Segoe UI", 8); btnCancel.Padding = new Padding(3); btnCancel.FlatStyle = FlatStyle.Flat; btnCancel.Height = 30; btnCancel.Click += btnCancel_Click; btnOK = new Button(); btnOK.Text = Properties.Resources.ResourceManager.GetString("OK"); btnOK.ForeColor = Color.FromArgb(170, 170, 170); btnOK.Font = new Font("Segoe UI", 8); btnOK.Padding = new Padding(3); btnOK.FlatStyle = FlatStyle.Flat; btnOK.Height = 30; btnOK.Click += btnOK_Click; flpButtons.Controls.Add(btnCancel); flpButtons.Controls.Add(btnOK); flp.Controls.Add(lblMessage); flp.SetFlowBreak(lblMessage, true); flp.Controls.Add(txtPl); flp.SetFlowBreak(txtPl, true); flp.Controls.Add(flpButtons); pl.Controls.Add(flp); Text = Properties.Resources.ResourceManager.GetString("Message"); Controls.Add(pl); Controls.Add(flpButtons); FormBorderStyle = FormBorderStyle.None; BackColor = Color.FromArgb(35, 35, 35); StartPosition = FormStartPosition.CenterScreen; Padding = new Padding(20, 55, 20, 20); Width = 500; Height = 200; }
private DialogNoBoxYesNo() { Name = Properties.Resources.ResourceManager.GetString("Message"); Icon = Icon = Properties.Resources.GClientGTLogo; FormBorderStyle = FormBorderStyle.FixedSingle; MaximizeBox = false; MinimizeBox = false; pl = new Panel(); pl.Dock = DockStyle.Fill; panel2 = new Panel(); label1 = new Label(); label1.AutoSize = true; label1.Font = new Font("Century Gothic", 11.75F); label1.ForeColor = Color.FromArgb(224, 224, 224); label1.Location = new Point(4, 6); label1.Name = "label1"; label1.Size = new Size(96, 21); label1.TabIndex = 1; label1.Text = "GClient GT"; panel2.BackColor = Color.FromArgb(45, 45, 45); panel2.Controls.Add(label1); panel2.Location = new Point(1, 1); panel2.Name = "panel2"; panel2.Size = new Size(498, 33); panel2.TabIndex = 3; Controls.Add(panel2); flp = new FlowLayoutPanel(); flp.Dock = DockStyle.Fill; lblMessage = new Label(); lblMessage.Font = new Font("Segoe UI", 10); lblMessage.ForeColor = Color.White; lblMessage.AutoSize = true; flpButtons = new FlowLayoutPanel(); flpButtons.Dock = DockStyle.Bottom; flpButtons.FlowDirection = FlowDirection.RightToLeft; flpButtons.Height = 35; btnNO = new Button(); btnNO.Text = Properties.Resources.ResourceManager.GetString("NO"); btnNO.ForeColor = Color.FromArgb(170, 170, 170); btnNO.Font = new Font("Segoe UI", 8); btnNO.Padding = new Padding(3); btnNO.FlatStyle = FlatStyle.Flat; btnNO.Height = 30; btnNO.Click += btnNO_Click; btnYES = new Button(); btnYES.Text = Properties.Resources.ResourceManager.GetString("YES"); ; btnYES.ForeColor = Color.FromArgb(170, 170, 170); btnYES.Font = new Font("Segoe UI", 8); btnYES.Padding = new Padding(3); btnYES.FlatStyle = FlatStyle.Flat; btnYES.Height = 30; btnYES.Click += btnYES_Click; flpButtons.Controls.Add(btnYES); flpButtons.Controls.Add(btnNO); flp.Controls.Add(lblMessage); flp.SetFlowBreak(lblMessage, true); flp.Controls.Add(flpButtons); pl.Controls.Add(flp); Text = Properties.Resources.ResourceManager.GetString("Message"); Controls.Add(pl); Controls.Add(flpButtons); FormBorderStyle = FormBorderStyle.None; BackColor = Color.FromArgb(35, 35, 35); StartPosition = FormStartPosition.CenterScreen; Padding = new Padding(20, 55, 20, 20); Width = 500; Height = 155; }
private void worldMapRegionsToolStripMenuItem_Click(object sender, EventArgs e) { string test = Path.GetFileNameWithoutExtension(_lastKnownPath); if (test.Substring(0, 5) != "wmset") { Console.WriteLine("WMSET: Please open your lingual wmset file again"); return; } string lingual = Wmset.ReturnLingual(_lastKnownPath); string dir = Path.GetDirectoryName(_lastKnownPath); string path = $"{dir}\\wmset{lingual}.Section2"; wm2 = new WM_Section2(path); Form wm2Editor = new Form { Size = new Size(1250, 800), Text = "World Map regions editor", MaximizeBox = false, MinimizeBox = false }; dynamicForm = wm2Editor; wm2Editor.Closing += (o, args) => wm2.EndJob(); SplitContainer wm2SplitContainer = new SplitContainer(); wm2SplitContainer.Dock = DockStyle.Fill; wm2SplitContainer.SplitterDistance = 0; wm2SplitContainer.IsSplitterFixed = true; pbBox = new PictureBox { Size = new Size(800,768), SizeMode = PictureBoxSizeMode.AutoSize, Image = Properties.Resources.map2, Dock = DockStyle.Fill }; wm2SplitContainer.Panel2.Controls.Add(pbBox); wm2.ReceiveBitmap(new Bitmap(pbBox.Image)); for (int i = 0; i < 768; i++) wm2.ColorizeBlock(i,wm2.ReadNextRegion()); pbBox.Image = wm2.GetColored; pbBox.MouseClick += WM2UpdateBlockID; FlowLayoutPanel flow = new FlowLayoutPanel {Dock = DockStyle.Fill}; wm2SelectedChunk = new Label {Text = $"Selected chunk: {wm2.selectedRegion}", AutoSize = true}; wm2numeric = new NumericUpDown {Minimum = 0, Maximum = 0xFF, Value = wm2.regions[wm2.selectedRegion]}; wm2numeric.ValueChanged += WM2UpdateRegion; flow.Controls.Add(wm2SelectedChunk); flow.Controls.Add(wm2numeric); flow.SetFlowBreak(wm2SelectedChunk, true); flow.SetFlowBreak(wm2numeric,true); wm2Editor.Controls.Add(wm2SplitContainer); wm2SplitContainer.Panel1.Controls.Add(flow); Button compileButton = new Button {Text= "Compile & save"}; compileButton.Click += CompileButton_Click; flow.Controls.Add(compileButton); wm2Editor.FormBorderStyle = FormBorderStyle.Fixed3D; wm2Editor.Show(); }
private void AddUIElements() { _panel = new FlowLayoutPanel { Dock = DockStyle.Top, AutoSize = true, FlowDirection = FlowDirection.LeftToRight }; _generateButton = new Button { Text = "Generate Terrain", AutoSize = true }; _generateButton.Click += (sender, args) => { Window.Cursor = Cursors.WaitCursor; Util.ReleaseCom(ref _terrain); _terrain = new Terrain(); var tii = new InitInfo { HeightMapFilename = null, LayerMapFilename0 = "textures/grass.dds", LayerMapFilename1 = "textures/darkdirt.dds", LayerMapFilename2 = "textures/stone.dds", LayerMapFilename3 = "Textures/lightdirt.dds", LayerMapFilename4 = "textures/snow.dds", BlendMapFilename = null, HeightScale = 50.0f, HeightMapWidth = 2049, HeightMapHeight = 2049, CellSpacing = 0.5f, Seed = (int)_txtSeed.Value, NoiseSize1 = (float) _txtNoise1.Value, Persistence1 =(float) _txtPersistence1.Value, Octaves1 = (int) _txtOctaves1.Value, NoiseSize2 = (float) _txtNoise2.Value, Persistence2 = (float) _txtPersistence2.Value, Octaves2 = (int) _txtOctaves2.Value }; _terrain.Init(Device, ImmediateContext, tii); _camera.Height = _terrain.Height; _hmImg.Image = _terrain.HeightMapImg; Window.Cursor = Cursors.Default; }; var labelPadding = new Padding(0, 6, 0, 0); _lblSeed = new Label { Text = "Seed:", AutoSize = true, Padding = labelPadding }; _txtSeed = new NumericUpDown() { Value = 0, AutoSize = true }; _lblNoise1 = new Label { Text = "Noise:", AutoSize = true, Padding = labelPadding }; _txtNoise1 = new NumericUpDown { Value = 1.0m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblPersistence1 = new Label { Text = "Persistence:", AutoSize = true, Padding = labelPadding }; _txtPersistence1 = new NumericUpDown { Value = 0.7m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblOctaves1 = new Label { Text = "Octaves:", AutoSize = true, Padding = labelPadding }; _txtOctaves1 = new NumericUpDown() { Value =7, AutoSize = true, Minimum = 1, Maximum = 20, }; _lblNoise2 = new Label { Text = "Noise:", AutoSize = true, Padding = labelPadding }; _txtNoise2 = new NumericUpDown { Value = 2.5m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblPersistence2 = new Label { Text = "Persistence:", AutoSize = true, Padding = labelPadding }; _txtPersistence2 = new NumericUpDown { Value = 0.8m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblOctaves2 = new Label { Text = "Octaves:", AutoSize = true, Padding = labelPadding }; _txtOctaves2 = new NumericUpDown() { Value = 3, AutoSize = true, Minimum = 1, Maximum = 20 }; _hmImg = new PictureBox() { Image = _terrain.HeightMapImg, MaximumSize = new Size(64,64), MinimumSize = new Size(64,64), SizeMode = PictureBoxSizeMode.StretchImage, BackColor = Color.White }; _panel.Controls.Add(_lblNoise1); _panel.Controls.Add(_txtNoise1); _panel.Controls.Add(_lblPersistence1); _panel.Controls.Add(_txtPersistence1); _panel.Controls.Add(_lblOctaves1); _panel.Controls.Add(_txtOctaves1); _panel.Controls.Add(_lblNoise2); _panel.Controls.Add(_txtNoise2); _panel.Controls.Add(_lblPersistence2); _panel.Controls.Add(_txtPersistence2); _panel.Controls.Add(_lblOctaves2); _panel.Controls.Add(_txtOctaves2); _panel.SetFlowBreak(_txtOctaves2, true); _panel.Controls.Add(_lblSeed); _panel.Controls.Add(_txtSeed); _panel.Controls.Add(_generateButton); _tblLayout = new TableLayoutPanel { Dock = DockStyle.Top, AutoSize = true }; _tblLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); _tblLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); _tblLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); _tblLayout.Controls.Add(_panel, 0,0); _tblLayout.Controls.Add(_hmImg, 1, 0); Window.Controls.Add(_tblLayout); }
private void editGroundIDToolStripMenuItem_Click(object sender, EventArgs e) { int entryID = WhichEntry(this.dataGridView1); Form dialoger = new Form { Text = "Ground ID Editor", MinimizeBox = false, MaximizeBox = false, Size = new Size(200, 200) }; Label lbltext = new Label {Text = "Please input ground ID:"}; TextBox tbtBox = new TextBox {Text="0"}; FlowLayoutPanel flp = new FlowLayoutPanel(); flp.Controls.Add(lbltext); flp.SetFlowBreak(lbltext, true); flp.Controls.Add(tbtBox); //dialoger.Controls.Add(new FlowLayoutPanel()); dialoger.Controls.Add(flp); dialoger.Closing += (o, args) => dialogerDelegateClose(o); dialoger.ShowDialog(); dialoger.Dispose(); entries[entryID].GroundID = (byte) ____a; int getRealOffset = entryID>0 ? entryID-(entryID%8) : 0; //int moduloFromEight = entryID%8; for (int i = getRealOffset; i < getRealOffset+8; i++) dataGridView1.Rows[i].Cells[2].Value = returnGroundType(entries[entryID].GroundID); dataGridView1.Rows[entryID].Cells[2].Value = returnGroundType(entries[entryID].GroundID); int realWMSET1index = (int)____a/8; //redundant int cast on purpouse realWMSET1index *= 4; using (FileStream fs = new FileStream(WM_Section1.ppath, FileMode.Open, FileAccess.ReadWrite)) using (BinaryWriter bw = new BinaryWriter(fs)) { fs.Seek(realWMSET1index, SeekOrigin.Begin); fs.Seek(2, SeekOrigin.Current); //jump to ground id bw.Write(entries[entryID].GroundID); } }
private void AddSummoner(Summoner s, FlowLayoutPanel flow, bool leftSide, bool isPlayer) { var label = new Label() { Text = leftSide ? s.Name + " (" + s.Champion + ")" : "(" + s.Champion + ") " + s.Name, Margin = new Padding(0, 2, 0, 3), Font = new Font(headerLabel.Font.FontFamily, 9.5f, isPlayer ? FontStyle.Bold : FontStyle.Regular), AutoSize = true, Cursor = Cursors.Hand, }; label.Click += (sender, e) => mainForm.OpenSummonerDetails(s.Name); var bitmap = Resources.ResourceManager.GetObject(Util.Sanitize(s.Champion)) as Bitmap; if (bitmap == null) { bitmap = Resources.unknown; } var icon = new PictureBox() { Width = 16, Height = 16, BackColor = Color.Silver, BackgroundImage = bitmap, }; flow.Controls.Add(icon); flow.Controls.Add(label); flow.SetFlowBreak(label, true); }