public Form1() { InitializeComponent(); TreeList treeList = new TreeList(); treeList.OptionsBehavior.Editable = false; treeList.Dock = DockStyle.Fill; treeList.Parent = this; treeList.DataSource = Test.LoadData(); SimpleButton button = new SimpleButton(); button.Dock = DockStyle.Top; button.Parent = this; button.Height = button.CalcBestSize().Height; treeList.Load += (s, e) => { treeList.ExpandAll(); treeList.Columns["Name"].BestFit(); }; //IPAddress ip = new IPAddress(new byte[] { 127, 0, 0, 1 }); //IPEndPoint iPEnd = new IPEndPoint(ip, 8000); TcpClient client = new TcpClient(); try { var ar = client.BeginConnect("127.0.0.1", 8000, null, null); ar.AsyncWaitHandle.WaitOne(5); var aa = client.Connected; var result = IsSocketConnected(client.Client); } catch { } button.Text = "Append node"; // UI Binding button.Click += (sender, e) => { // Appending a new Node Test spaceObject = new Test(); spaceObject.ID = treeList.AllNodesCount; spaceObject.ParentID = 1; spaceObject.Name = "李四"; TreeListNode newNode = treeList.AppendNode( nodeData: new object[] { spaceObject.ID, spaceObject.ParentID, spaceObject.Name }, parentNodeId: 0 ); // Using the newly added node treeList.FocusedNode = newNode; }; }
private Control createThisMetaDataValueApplyToAllButton(BaseEdit editor) { var button = new SimpleButton { Image = ApplicationIcons.ApplyAll }; button.MaximumSize = button.CalcBestSize(); button.MinimumSize = button.MaximumSize; button.ToolTip = Captions.Importer.ApplyToAll; button.Click += (sender, args) => updateAllOtherDataTables(editor.Name, editor.EditValue); return(button); }
private void method_5(SimpleButton simpleButton_2, SimpleButton simpleButton_3, PanelControl panelControl_2, int int_0) { Size size = simpleButton_2.CalcBestSize(); Size size2 = simpleButton_3.CalcBestSize(); size.Height = Math.Max(size.Height, size2.Height); size.Width = Math.Max(size.Width, size2.Width) + (int_0 * 4); panelControl_2.Height = size.Height + (int_0 * 2); simpleButton_2.Size = size; simpleButton_3.Size = size; }
void CreateButtons() { if (Message.Buttons == null || Message.Buttons.Length <= 0) { throw new ArgumentException("At least one button must be specified", "buttons"); } buttons = new SimpleButton[Message.Buttons.Length]; int maxButtonHeight = 0; for (int i = 0; i < buttons.Length; ++i) { int currentButtonIndex = (Message.DefaultButtonIndex + i) % buttons.Length; SimpleButton currentButton = new SimpleButton(); currentButton.LookAndFeel.Assign(LookAndFeel); buttons[currentButtonIndex] = currentButton; currentButton.DialogResult = Message.Buttons[currentButtonIndex]; if (currentButton.DialogResult == DialogResult.None) { throw new ArgumentException("The 'DialogResult.None' button cannot be specified", "buttons"); } if (currentButton.DialogResult == DialogResult.Cancel) { this.CancelButton = currentButton; } currentButton.Text = GetButtonText(currentButton.DialogResult); Size best = currentButton.CalcBestSize(); if (best.Width > currentButton.Width) { currentButton.Width = best.Width; } if (best.Height > maxButtonHeight && best.Height > currentButton.Height) { maxButtonHeight = best.Height; } this.Controls.Add(currentButton); } if (maxButtonHeight > 0) { foreach (SimpleButton currentButton in buttons) { currentButton.Height = maxButtonHeight; } } if (buttons.Length == 1) { this.CancelButton = buttons[0]; } //if (this.CancelButton == null) // this.ControlBox = false; }
//protected override AccessibleObject CreateAccessibilityInstance() //{ // if (this.DXAccessible == null) // { // return base.CreateAccessibilityInstance(); // } // return this.DXAccessible.Accessible; //} private void CreateButtons() { if ((this.Message.Buttons == null) || (this.Message.Buttons.Length <= 0)) { throw new ArgumentException("At least one button must be specified", "buttons"); } this.buttons = new SimpleButton[this.Message.Buttons.Length]; for (int i = 0; i < this.Message.Buttons.Length; i++) { SimpleButton button = new SimpleButton(); button.LookAndFeel.Assign(base.LookAndFeel); this.buttons[i] = button; button.DialogResult = this.Message.Buttons[i]; if (button.DialogResult == DialogResult.None) { throw new ArgumentException("The 'DialogResult.None' button cannot be specified", "buttons"); } if (button.DialogResult == DialogResult.Cancel) { base.CancelButton = button; } button.Text = this.GetButtonText(button.DialogResult); int width = button.CalcBestSize().Width; if (width > button.Width) { button.Width = width; } base.Controls.Add(button); } if (this.buttons.Length == 1) { base.CancelButton = this.buttons[0]; } if (this.Message.DefaultButtonIndex >= this.buttons.Length) { this.Message.DefaultButtonIndex = 0; } this.buttons[this.Message.DefaultButtonIndex].Select(); }
private void QuickCommandsInitialize() { foreach (string command in _quickCommands) { var b = new SimpleButton(); b.Text = command; b.Font = _buttonFont; //b.Size = new Size(0, 33); Size size = b.CalcBestSize(); size.Width = Math.Max(size.Width, b.Width); // size.Height = Math.Max(size.Height, 33); size.Height = 43; b.Size = size; b.Click += (s, ea) => { if (s is SimpleButton) { var button = s as SimpleButton; writeRichEditControl.Document.AppendText(button.Text + "."); writeRichEditControl.Focus(); } }; flowLayoutPanel1.Controls.Add(b); } }
private static void ChangeButtonSize(SimpleButton btn) { btn.CalcBestSize(); }