コード例 #1
0
        protected virtual void OnSpringTableLayoutCore()
        {
            this.SuspendLayout();

            TableLayoutSettings layoutSettings = (TableLayoutSettings)LayoutSettings;

            layoutSettings.RowCount    = 0;
            layoutSettings.ColumnCount = 0;
            layoutSettings.ColumnStyles.Clear();
            layoutSettings.RowStyles.Clear();

            if (Orientation == Orientation.Horizontal)
            {
                foreach (ToolStripItem tsi in this.Items)
                {
                    ColumnStyle style = new ColumnStyle();
                    if (tsi is ToolStripStatusLabel status_label && status_label.Spring)
                    {
                        style.SizeType = SizeType.Percent;
                        style.Width    = 100;
                        tsi.Anchor     = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
                    }
                    else
                    {
                        tsi.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
                    }
                    layoutSettings.ColumnStyles.Add(style);
                }
コード例 #2
0
ファイル: ColumnStyleTest.cs プロジェクト: Profit0004/mono
		public void CtorTest3 ()
		{
			ColumnStyle cs = new ColumnStyle (SizeType.Absolute, 5.0f);
			
			Assert.AreEqual (5.0, cs.Width, "1");
			Assert.AreEqual (SizeType.Absolute, cs.SizeType, "2");
		}
コード例 #3
0
		private void tableMain_SizeChanged(object sender, EventArgs e)
		{
			ColumnStyle columnLeft = new ColumnStyle(SizeType.Absolute, 200);
			ColumnStyle columnRight = new ColumnStyle(SizeType.Absolute, 220);
			ColumnStyle columnFill = new ColumnStyle(SizeType.Percent, 100);
			RowStyle rowTop = new RowStyle(SizeType.Absolute, 145);
			RowStyle rowBottom = new RowStyle(SizeType.Absolute, 256);
			RowStyle rowFill = new RowStyle(SizeType.Percent, 100);

			tableMain.SuspendLayout();

			if (tableMain.Width > columnLeft.Width + columnRight.Width)
			{
				tableMain.ColumnStyles[0] = columnFill;
				tableMain.ColumnStyles[1] = columnRight;
			}
			else
			{
				tableMain.ColumnStyles[0] = columnLeft;
				tableMain.ColumnStyles[1] = columnFill;
			}

			if (tableMain.Height > rowTop.Height + rowBottom.Height)
			{
				tableMain.RowStyles[0] = rowFill;
				tableMain.RowStyles[1] = rowBottom;
			}
			else
			{
				tableMain.RowStyles[0] = rowTop;
				tableMain.RowStyles[1] = rowFill;
			}

			tableMain.ResumeLayout();
		}
コード例 #4
0
        public FormCompass( FormMain parent )
        {
            InitializeComponent();

            MainFontColor = Color.FromArgb( 0x00, 0x00, 0x00 );
            SubFontColor = Color.FromArgb( 0x88, 0x88, 0x88 );

            ControlHelper.SetDoubleBuffered( BasePanel );
            ControlHelper.SetDoubleBuffered( TableEnemyFleet );
            ControlHelper.SetDoubleBuffered( TableEnemyMember );

            TableEnemyMember.SuspendLayout();
            ControlMembers = new TableEnemyMemberControl[6];
            for ( int i = 0; i < ControlMembers.Length; i++ ) {
                ControlMembers[i] = new TableEnemyMemberControl( this, TableEnemyMember, i );
            }
            TableEnemyMember.ResumeLayout();

            TableEnemyCandidate.SuspendLayout();
            ControlCandidates = new TableEnemyCandidateControl[6];
            for ( int i  = 0; i < ControlCandidates.Length; i++ ) {
                ControlCandidates[i] = new TableEnemyCandidateControl( this, TableEnemyCandidate, i );
            }
            //row/column style init
            for ( int y = 0; y < TableEnemyCandidate.RowCount; y++ ) {
                var rs = new RowStyle( SizeType.AutoSize );
                if ( TableEnemyCandidate.RowStyles.Count <= y )
                    TableEnemyCandidate.RowStyles.Add( rs );
                else
                    TableEnemyCandidate.RowStyles[y] = rs;
            }
            for ( int x = 0; x < TableEnemyCandidate.ColumnCount; x++ ) {
                var cs = new ColumnStyle( SizeType.AutoSize );
                if ( TableEnemyCandidate.ColumnStyles.Count <= x )
                    TableEnemyCandidate.ColumnStyles.Add( cs );
                else
                    TableEnemyCandidate.ColumnStyles[x] = cs;
            }
            TableEnemyCandidate.ResumeLayout();

            //BasePanel.SetFlowBreak( TextMapArea, true );
            BasePanel.SetFlowBreak( TextDestination, true );
            //BasePanel.SetFlowBreak( TextEventKind, true );
            BasePanel.SetFlowBreak( TextEventDetail, true );

            TextDestination.ImageList = ResourceManager.Instance.Equipments;
            TextEventKind.ImageList = ResourceManager.Instance.Equipments;
            TextEventDetail.ImageList = ResourceManager.Instance.Equipments;
            TextFormation.ImageList = ResourceManager.Instance.Icons;
            TextAirSuperiority.ImageList = ResourceManager.Instance.Equipments;
            TextAirSuperiority.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedFighter;

            ConfigurationChanged();

            Icon = ResourceManager.ImageToIcon( ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormCompass] );
        }
コード例 #5
0
ファイル: testcmd.cs プロジェクト: lexzh/Myproject
 public override void Init(CarFormEx carform)
 {
     base.Init(carform);
     GroupBox box = new GroupBox {
         Text = "参数设置",
         Dock = DockStyle.Fill
     };
     carform.pnlContainer.Controls.Add(box);
     TableLayoutPanel tb = new TableLayoutPanel {
         Dock = DockStyle.Fill,
         RowCount = 1,
         ColumnCount = 2
     };
     tb.RowStyles.Clear();
     tb.ColumnStyles.Clear();
     tb.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
     for (int i = 0; i < 1; i++)
     {
         RowStyle rowStyle = new RowStyle {
             Height = 25f,
             SizeType = SizeType.Absolute
         };
         ColumnStyle columnStyle = new ColumnStyle {
             Width = 113f,
             SizeType = SizeType.Absolute
         };
         tb.RowStyles.Add(rowStyle);
         tb.ColumnStyles.Add(columnStyle);
     }
     Label con = new Label {
         Text = "通道类型:",
         TextAlign = ContentAlignment.MiddleRight,
         Dock = DockStyle.Fill
     };
     this.SetControl(tb, con, 0, 0);
     StarNetTextBox box2 = new StarNetTextBox {
         Name = "txtip",
         MaxLength = 100,
         Width = 160,
         Dock = DockStyle.Left,
         DestinationMarshalByRefObject = this.cmd,
         PropertyName = "RepeatTimes",
         PropertyType = System.Type.GetType("System.Int32")
     };
     this.SetControl(tb, box2, 0, 1);
     box.Controls.Add(tb);
 }
コード例 #6
0
ファイル: UI.cs プロジェクト: bramboomen/mso3
 private void initializeControls()
 {
     // Set label
     this.Text = "MSO Lab Exercise III";
     // this.FormBorderStyle = FormBorderStyle.FixedSingle;
     this.Width = 500;
     this.Height = 210;
     // Set layout
     var grid = new TableLayoutPanel ();
     grid.Dock = DockStyle.Fill;
     grid.Padding = new Padding (5);
     this.Controls.Add (grid);
     grid.RowCount = 4;
     grid.RowStyles.Add (new RowStyle (SizeType.Absolute, 20));
     grid.RowStyles.Add (new RowStyle (SizeType.Percent, 100));
     grid.RowStyles.Add (new RowStyle (SizeType.Absolute, 20));
     grid.RowStyles.Add (new RowStyle (SizeType.Absolute, 40));
     grid.ColumnCount = 6;
     for (int i = 0; i < 6; i++)
     {
         ColumnStyle c = new ColumnStyle (SizeType.Percent, 16.66666f);
         grid.ColumnStyles.Add (c);
     }
     // Create From and To
     var fromLabel = new Label ();
     fromLabel.Text = "From:";
     fromLabel.TextAlign = ContentAlignment.MiddleRight;
     grid.Controls.Add (fromLabel, 0, 0);
     fromLabel.Dock = DockStyle.Fill;
     fromBox = new ComboBox ();
     fromBox.DropDownStyle = ComboBoxStyle.DropDownList;
     fromBox.Items.AddRange (Tariefeenheden.getStations ());
     fromBox.SelectedIndex = 0;
     grid.Controls.Add (fromBox, 1, 0);
     grid.SetColumnSpan (fromBox, 2);
     fromBox.Dock = DockStyle.Fill;
     var toLabel = new Label ();
     toLabel.Text = "To:";
     toLabel.TextAlign = ContentAlignment.MiddleRight;
     grid.Controls.Add (toLabel, 3, 0);
     toLabel.Dock = DockStyle.Fill;
     toBox = new ComboBox ();
     toBox.DropDownStyle = ComboBoxStyle.DropDownList;
     toBox.Items.AddRange (Tariefeenheden.getStations ());
     toBox.SelectedIndex = 0;
     grid.Controls.Add (toBox, 4, 0);
     grid.SetColumnSpan (toBox, 2);
     toBox.Dock = DockStyle.Fill;
     // Create groups
     GroupBox classGroup = new GroupBox ();
     classGroup.Text = "Class";
     classGroup.Dock = DockStyle.Fill;
     grid.Controls.Add (classGroup, 0, 1);
     grid.SetColumnSpan (classGroup, 2);
     var classGrid = new TableLayoutPanel ();
     classGrid.RowStyles.Add (new RowStyle (SizeType.Percent, 50));
     classGrid.RowStyles.Add (new RowStyle (SizeType.Percent, 50));
     classGrid.Dock = DockStyle.Fill;
     classGroup.Controls.Add (classGrid);
     GroupBox wayGroup = new GroupBox ();
     wayGroup.Text = "Amount";
     wayGroup.Dock = DockStyle.Fill;
     grid.Controls.Add (wayGroup, 2, 1);
     grid.SetColumnSpan (wayGroup, 2);
     var wayGrid = new TableLayoutPanel ();
     wayGrid.RowStyles.Add (new RowStyle (SizeType.Percent, 50));
     wayGrid.RowStyles.Add (new RowStyle (SizeType.Percent, 50));
     wayGrid.Dock = DockStyle.Fill;
     wayGroup.Controls.Add (wayGrid);
     GroupBox discountGroup = new GroupBox ();
     discountGroup.Text = "Discount";
     discountGroup.Dock = DockStyle.Fill;
     grid.Controls.Add (discountGroup, 4, 1);
     grid.SetColumnSpan (discountGroup, 2);
     var discountGrid = new TableLayoutPanel ();
     discountGrid.RowStyles.Add (new RowStyle (SizeType.Percent, 33.33333f));
     discountGrid.RowStyles.Add (new RowStyle (SizeType.Percent, 33.33333f));
     discountGrid.RowStyles.Add (new RowStyle (SizeType.Percent, 33.33333f));
     discountGrid.Dock = DockStyle.Fill;
     discountGroup.Controls.Add (discountGrid);
     // Create radio buttons
     firstClass = new RadioButton ();
     firstClass.Text = "1st class";
     firstClass.Checked = true;
     classGrid.Controls.Add (firstClass);
     secondClass = new RadioButton ();
     secondClass.Text = "2nd class";
     classGrid.Controls.Add (secondClass);
     oneWay = new RadioButton ();
     oneWay.Text = "One-way";
     oneWay.Checked = true;
     wayGrid.Controls.Add (oneWay);
     returnWay = new RadioButton ();
     returnWay.Text = "Return";
     wayGrid.Controls.Add (returnWay);
     noDiscount = new RadioButton ();
     noDiscount.Text = "No discount";
     noDiscount.Checked = true;
     discountGrid.Controls.Add (noDiscount);
     twentyDiscount = new RadioButton ();
     twentyDiscount.Text = "20% discount";
     discountGrid.Controls.Add (twentyDiscount);
     fortyDiscount = new RadioButton ();
     fortyDiscount.Text = "40% discount";
     discountGrid.Controls.Add (fortyDiscount);
     // Payment option
     Label paymentLabel = new Label ();
     paymentLabel.Text = "Payment by:";
     paymentLabel.Dock = DockStyle.Fill;
     paymentLabel.TextAlign = ContentAlignment.MiddleRight;
     grid.Controls.Add (paymentLabel, 0, 2);
     payment = new ComboBox ();
     payment.DropDownStyle = ComboBoxStyle.DropDownList;
     payment.Items.AddRange (new String[] { "Credit card", "Debit card", "Cash" });
     payment.SelectedIndex = 0;
     payment.Dock = DockStyle.Fill;
     grid.Controls.Add (payment, 1, 2);
     grid.SetColumnSpan (payment, 5);
     // Pay button
     pay = new Button ();
     pay.Text = "Pay";
     pay.Dock = DockStyle.Fill;
     grid.Controls.Add (pay, 0, 3);
     grid.SetColumnSpan (pay, 6);
     // Set up event
     pay.Click += (object sender, EventArgs e) => Sale(getUIInfo());
 }
コード例 #7
0
 /// <include file='doc\TableLayoutSettings.uex' path='docs/doc[@for="ColumnStyleCollection.Remove"]/*' />
 public void Remove(ColumnStyle columnStyle)
 {
     ((IList)this).Remove(columnStyle);
 }
コード例 #8
0
 /// <include file='doc\TableLayoutSettings.uex' path='docs/doc[@for="ColumnStyleCollection.IndexOf"]/*' />
 public int IndexOf(ColumnStyle columnStyle)
 {
     return(((IList)this).IndexOf(columnStyle));
 }
コード例 #9
0
ファイル: ColumnStyleTest.cs プロジェクト: Profit0004/mono
		public void WidthTest1 ()
		{
			ColumnStyle cs = new ColumnStyle ();
			cs.Width = 1.0f;
			Assert.AreEqual (1.0f, cs.Width, "1");
		}
コード例 #10
0
 /// <include file='doc\TableLayoutSettings.uex' path='docs/doc[@for="ColumnStyleCollection.Add"]/*' />
 public int Add(ColumnStyle columnStyle)
 {
     return(((IList)this).Add(columnStyle));
 }
コード例 #11
0
ファイル: StatusStrip.cs プロジェクト: tangfengray/winforms
        /// <devdoc>
        /// Override this function if you want to do custom table layouts for the
        /// StatusStrip.  The default layoutstyle is tablelayout, and we need to play
        /// with the row/column styles
        /// </devdoc>
        protected virtual void OnSpringTableLayoutCore()
        {
            if (this.LayoutStyle == ToolStripLayoutStyle.Table)
            {
                state[stateCalledSpringTableLayout] = true;

                this.SuspendLayout();

                if (lastOrientation != Orientation)
                {
                    TableLayoutSettings settings = this.TableLayoutSettings;
                    settings.RowCount    = 0;
                    settings.ColumnCount = 0;
                    settings.ColumnStyles.Clear();
                    settings.RowStyles.Clear();
                }
                lastOrientation = Orientation;

                if (Orientation == Orientation.Horizontal)
                {
                    //
                    // Horizontal layout
                    //
                    TableLayoutSettings.GrowStyle = TableLayoutPanelGrowStyle.AddColumns;

                    int originalColumnCount = this.TableLayoutSettings.ColumnStyles.Count;

                    // iterate through the elements which are going to be displayed.
                    for (int i = 0; i < this.DisplayedItems.Count; i++)
                    {
                        if (i >= originalColumnCount)
                        {
                            // add if it's necessary.
                            this.TableLayoutSettings.ColumnStyles.Add(new ColumnStyle());
                        }

                        // determine if we "spring" or "autosize" the column
                        ToolStripStatusLabel panel = DisplayedItems[i] as ToolStripStatusLabel;
                        bool spring = (panel != null && panel.Spring);
                        DisplayedItems[i].Anchor = (spring) ? AllAnchor : VerticalAnchor;

                        // spring is achieved by using 100% as the column style
                        ColumnStyle colStyle = this.TableLayoutSettings.ColumnStyles[i];
                        colStyle.Width    = 100; // this width is ignored in AutoSize.
                        colStyle.SizeType = (spring) ? SizeType.Percent : SizeType.AutoSize;
                    }

                    if (TableLayoutSettings.RowStyles.Count > 1 || TableLayoutSettings.RowStyles.Count == 0)
                    {
                        TableLayoutSettings.RowStyles.Clear();
                        TableLayoutSettings.RowStyles.Add(new RowStyle());
                    }
                    TableLayoutSettings.RowCount = 1;

                    TableLayoutSettings.RowStyles[0].SizeType = SizeType.Absolute;
                    TableLayoutSettings.RowStyles[0].Height   = Math.Max(0, this.DisplayRectangle.Height);
                    TableLayoutSettings.ColumnCount           = DisplayedItems.Count + 1; // add an extra cell so it fills the remaining space

                    // dont remove the extra column styles, just set them back to autosize.
                    for (int i = DisplayedItems.Count; i < TableLayoutSettings.ColumnStyles.Count; i++)
                    {
                        this.TableLayoutSettings.ColumnStyles[i].SizeType = SizeType.AutoSize;
                    }
                }
                else
                {
                    //
                    // Vertical layout
                    //

                    TableLayoutSettings.GrowStyle = TableLayoutPanelGrowStyle.AddRows;

                    int originalRowCount = this.TableLayoutSettings.RowStyles.Count;

                    // iterate through the elements which are going to be displayed.
                    for (int i = 0; i < this.DisplayedItems.Count; i++)
                    {
                        if (i >= originalRowCount)
                        {
                            // add if it's necessary.
                            this.TableLayoutSettings.RowStyles.Add(new RowStyle());
                        }

                        // determine if we "spring" or "autosize" the row
                        ToolStripStatusLabel panel = DisplayedItems[i] as ToolStripStatusLabel;
                        bool spring = (panel != null && panel.Spring);
                        DisplayedItems[i].Anchor = (spring) ? AllAnchor : HorizontalAnchor;

                        // spring is achieved by using 100% as the row style
                        RowStyle rowStyle = this.TableLayoutSettings.RowStyles[i];
                        rowStyle.Height   = 100; // this width is ignored in AutoSize.
                        rowStyle.SizeType = (spring) ? SizeType.Percent : SizeType.AutoSize;
                    }
                    TableLayoutSettings.ColumnCount = 1;

                    if (TableLayoutSettings.ColumnStyles.Count > 1 || TableLayoutSettings.ColumnStyles.Count == 0)
                    {
                        TableLayoutSettings.ColumnStyles.Clear();
                        TableLayoutSettings.ColumnStyles.Add(new ColumnStyle());
                    }

                    TableLayoutSettings.ColumnCount = 1;
                    TableLayoutSettings.ColumnStyles[0].SizeType = SizeType.Absolute;
                    TableLayoutSettings.ColumnStyles[0].Width    = Math.Max(0, this.DisplayRectangle.Width);

                    TableLayoutSettings.RowCount = DisplayedItems.Count + 1; // add an extra cell so it fills the remaining space

                    // dont remove the extra column styles, just set them back to autosize.
                    for (int i = DisplayedItems.Count; i < TableLayoutSettings.RowStyles.Count; i++)
                    {
                        this.TableLayoutSettings.RowStyles[i].SizeType = SizeType.AutoSize;
                    }
                }

                this.ResumeLayout(false);
            }
        }
コード例 #12
0
        void SetColumnStyle(int nColumn, ColumnStyle style)
        {
            // 确保足够
            while (this.tableLayoutPanel1.ColumnStyles.Count <= nColumn)
            {
                this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            }

            Debug.Assert(nColumn < this.tableLayoutPanel1.ColumnStyles.Count, "");
            this.tableLayoutPanel1.ColumnStyles[nColumn] = style;
        }
 public int Add(ColumnStyle columnStyle)
 {
     return ((IList) this).Add(columnStyle);
 }
コード例 #14
0
		public int Add (ColumnStyle columnStyle)
		{
			return base.Add (columnStyle);
		}
コード例 #15
0
		static void Assert_AreEqual(ColumnStyle expected, ColumnStyle actual, String message)
		{
			Assert.AreEqual(expected.SizeType, actual.SizeType, "ColumnStyle.SizeType -- " + message);
			Assert.AreEqual(expected.Width, actual.Width, "ColumnStyle.Width -- " + message);
		}
コード例 #16
0
ファイル: SettingsTab.cs プロジェクト: islander98/WinRVClient
        /// <summary>
        /// Returns table layout with pairs TextBox and Labels
        /// </summary>
        /// <param name="labels">Labels describing text boxes</param>
        /// <param name="keys">Keys to store the created text boxes in this.controls</param>
        /// <param name="height">Height of the whole table layout</param>
        /// <param name="location">Location of the whole table layout</param>
        /// <returns>Initialized table layout</returns>
        private TableLayoutPanel GetTextBoxesWithLabelsLayout(string[] labels, ControlKeys[] keys, int height, Point location)
        {
            TableLayoutPanel layout = new TableLayoutPanel();
            layout.ColumnCount = labels.Length;
            layout.RowCount = 2;

            layout.Location = location;
            layout.Height = height;
            layout.Padding = new Padding(5);

            layout.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;

            TableLayoutColumnStyleCollection styles = layout.ColumnStyles;
            for (int i = 0; i < layout.ColumnCount; i++)
            {
                // Make all columns equal size
                ColumnStyle columnStyle = new ColumnStyle(SizeType.Percent, 100 / layout.ColumnCount);
                styles.Add(columnStyle);

                Label label = new Label();
                label.Text = labels[i];
                label.AutoSize = true;
                label.Dock = DockStyle.Fill;
                label.TextAlign = ContentAlignment.MiddleCenter;
                layout.Controls.Add(label, i, 0);

                TextBox textBox = new TextBox();
                textBox.AutoSize = true;
                textBox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
                layout.Controls.Add(textBox, i, 1);
                this.controls[(int)keys[i]] = textBox;
            }

            return layout;
        }
コード例 #17
0
 protected virtual void OnSpringTableLayoutCore()
 {
     if (this.LayoutStyle == ToolStripLayoutStyle.Table)
     {
         this.state[stateCalledSpringTableLayout] = true;
         base.SuspendLayout();
         if (this.lastOrientation != base.Orientation)
         {
             System.Windows.Forms.TableLayoutSettings tableLayoutSettings = this.TableLayoutSettings;
             tableLayoutSettings.RowCount    = 0;
             tableLayoutSettings.ColumnCount = 0;
             tableLayoutSettings.ColumnStyles.Clear();
             tableLayoutSettings.RowStyles.Clear();
         }
         this.lastOrientation = base.Orientation;
         if (base.Orientation == Orientation.Horizontal)
         {
             this.TableLayoutSettings.GrowStyle = TableLayoutPanelGrowStyle.AddColumns;
             int count = this.TableLayoutSettings.ColumnStyles.Count;
             for (int i = 0; i < this.DisplayedItems.Count; i++)
             {
                 if (i >= count)
                 {
                     this.TableLayoutSettings.ColumnStyles.Add(new ColumnStyle());
                 }
                 ToolStripStatusLabel label = this.DisplayedItems[i] as ToolStripStatusLabel;
                 bool flag = (label != null) && label.Spring;
                 this.DisplayedItems[i].Anchor = flag ? (AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top) : (AnchorStyles.Bottom | AnchorStyles.Top);
                 ColumnStyle style = this.TableLayoutSettings.ColumnStyles[i];
                 style.Width    = 100f;
                 style.SizeType = flag ? SizeType.Percent : SizeType.AutoSize;
             }
             if ((this.TableLayoutSettings.RowStyles.Count > 1) || (this.TableLayoutSettings.RowStyles.Count == 0))
             {
                 this.TableLayoutSettings.RowStyles.Clear();
                 this.TableLayoutSettings.RowStyles.Add(new RowStyle());
             }
             this.TableLayoutSettings.RowCount = 1;
             this.TableLayoutSettings.RowStyles[0].SizeType = SizeType.Absolute;
             this.TableLayoutSettings.RowStyles[0].Height   = Math.Max(0, this.DisplayRectangle.Height);
             this.TableLayoutSettings.ColumnCount           = this.DisplayedItems.Count + 1;
             for (int j = this.DisplayedItems.Count; j < this.TableLayoutSettings.ColumnStyles.Count; j++)
             {
                 this.TableLayoutSettings.ColumnStyles[j].SizeType = SizeType.AutoSize;
             }
         }
         else
         {
             this.TableLayoutSettings.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
             int num4 = this.TableLayoutSettings.RowStyles.Count;
             for (int k = 0; k < this.DisplayedItems.Count; k++)
             {
                 if (k >= num4)
                 {
                     this.TableLayoutSettings.RowStyles.Add(new RowStyle());
                 }
                 ToolStripStatusLabel label2 = this.DisplayedItems[k] as ToolStripStatusLabel;
                 bool flag2 = (label2 != null) && label2.Spring;
                 this.DisplayedItems[k].Anchor = flag2 ? (AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top) : (AnchorStyles.Right | AnchorStyles.Left);
                 RowStyle style2 = this.TableLayoutSettings.RowStyles[k];
                 style2.Height   = 100f;
                 style2.SizeType = flag2 ? SizeType.Percent : SizeType.AutoSize;
             }
             this.TableLayoutSettings.ColumnCount = 1;
             if ((this.TableLayoutSettings.ColumnStyles.Count > 1) || (this.TableLayoutSettings.ColumnStyles.Count == 0))
             {
                 this.TableLayoutSettings.ColumnStyles.Clear();
                 this.TableLayoutSettings.ColumnStyles.Add(new ColumnStyle());
             }
             this.TableLayoutSettings.ColumnCount = 1;
             this.TableLayoutSettings.ColumnStyles[0].SizeType = SizeType.Absolute;
             this.TableLayoutSettings.ColumnStyles[0].Width    = Math.Max(0, this.DisplayRectangle.Width);
             this.TableLayoutSettings.RowCount = this.DisplayedItems.Count + 1;
             for (int m = this.DisplayedItems.Count; m < this.TableLayoutSettings.RowStyles.Count; m++)
             {
                 this.TableLayoutSettings.RowStyles[m].SizeType = SizeType.AutoSize;
             }
         }
         base.ResumeLayout(false);
     }
 }
コード例 #18
0
ファイル: EditorViewImpl.cs プロジェクト: SuperJugy/lolbuilds
 public void configureMasteryTrees(List<Branch> branches) {
   MasteriesTable.ColumnStyles.Clear();
   MasteriesTable.RowStyles.Clear();
   MasteriesTable.ColumnCount = branches.Count;
   MasteriesTable.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
   int j = 0;
   foreach (Branch branch in branches) {
     int i = 1;
     MasteriesTable.RowCount = branch.Tiers.Count + 1;
     MasteriesTable.Controls.Add(new Label {
       Text = branch.Name,
       AutoSize = true,
       Anchor = AnchorStyles.None
     },
       j,
       0);
     foreach (Tier tier in branch.Tiers) {
       var tierTable = new TableLayoutPanel {
         RowCount = 1,
         ColumnCount = tier.Masteries.Count
       };
       MasteriesTable.Controls.Add(tierTable, j, i);
       int k = 0;
       foreach (Mastery mastery in tier.Masteries) {
         var but = new Button();
         if (tier.Limit == 1) {
           but.Click += Mastery1Button_Click;
         } else {
           but.Click += Mastery5Button_Click;
         }
         but.MouseUp += MasteryButton_MouseUp;
         ToolTip.SetToolTip(but, mastery.Name + "\r\n" + mastery.Description);
         but.AutoSize = true;
         but.AutoSizeMode = AutoSizeMode.GrowAndShrink;
         but.Anchor = AnchorStyles.None;
         but.Tag = new MasteryPageBind(mastery);
         but.TextChanged += MasteryPageChanged;
         mMasteryButtons.Add(mastery.ID, but);
         var r = new ColumnStyle {
           SizeType = SizeType.Percent,
           Width = 100F / tierTable.ColumnCount
         };
         tierTable.ColumnStyles.Add(r);
         tierTable.Controls.Add(but, k, 0);
         ++k;
       }
       ++i;
     }
     ++j;
   }
   for (int i = 0; i < MasteriesTable.RowCount; ++i) {
     var r = new RowStyle {
       SizeType = SizeType.Percent,
       Height = 100F / MasteriesTable.RowCount
     };
     MasteriesTable.RowStyles.Add(r);
   }
   for (int i = 0; i < MasteriesTable.ColumnCount; ++i) {
     var r = new ColumnStyle {
       SizeType = SizeType.Percent,
       Width = 100F / MasteriesTable.ColumnCount
     };
     MasteriesTable.ColumnStyles.Add(r);
   }
 }
コード例 #19
0
ファイル: formMain.cs プロジェクト: Honsal/PhotoMeterServer
        public void ResetLayoutPanel(int CamNum)
        {
            tpnlCamArray.ColumnStyles.Clear();
            tpnlCamArray.RowStyles.Clear();
            tpnlCamArray.Controls.Clear();

            if (CamNum <= 8)
            {
                tpnlCamArray.ColumnCount = 2;

                if (CamNum == 1)
                {
                    tpnlCamArray.RowCount = 1;
                }
                else
                {
                    tpnlCamArray.RowCount = (int)(CamNum / 2);
                }
            }
            else
            {
                tpnlCamArray.ColumnCount = 3;
                tpnlCamArray.RowCount = (int)(CamNum / 3);
            }

            float cpercent = 100 / tpnlCamArray.ColumnCount;
            float rpercent = 100 / tpnlCamArray.RowCount;

            for (int i = 0; i < tpnlCamArray.ColumnCount; i++)
            {
                ColumnStyle style = new ColumnStyle(SizeType.Percent, cpercent);
                tpnlCamArray.ColumnStyles.Add(style);
            }

            for (int i = 0; i < tpnlCamArray.RowCount; i++)
            {
                RowStyle style = new RowStyle(SizeType.Percent, rpercent);
                tpnlCamArray.RowStyles.Add(style);
            }

            for (int i = 0; i < tpnlCamArray.RowCount; i++)
            {
                for (int j = 0; j < tpnlCamArray.ColumnCount; j++)
                {

                    if ((j) * tpnlCamArray.RowCount + i + 1 <= CamNum)
                    {
                        MonGraph pGraph = new MonGraph();
                        pGraph.MouseClick += new MouseEventHandler(MonGraph_Click);
                        pGraph.SetInitialValue((i) * tpnlCamArray.ColumnCount + j + 1, m_TargetLimit, 0, false);
                        pGraph.SetBasicValue();

                        tpnlCamArray.Controls.Add(pGraph, j, i);
                    }
                }
            }

            m_SelCamNum = 0;
            MonGraph gbox = (MonGraph)tpnlCamArray.Controls[m_SelCamNum];
            gbox.SetLblColor(Color.Blue);

            if (m_Images != null)
                if (m_Images[0] != null)
                    if (m_Images[0].m_Targets != null)
                        ResetTargets(false, m_Images[0].m_Targets.Length);
                    else
                        ResetTargets(true, 4);
                else
                    ResetTargets(true, 4);
            else
                ResetTargets(true, 4);

        }
コード例 #20
0
ファイル: formMain.cs プロジェクト: Honsal/PhotoMeterServer
        public void ResetTargets(bool isFirst, int tNum)
        {
            //int basewidth = tpnlTargetArray.Width;
            //int baseheight = tpnlTargetArray.Height;

            int basewidth = 794;
            int baseheight = 470;

            tpnlTargetArray.ColumnStyles.Clear();
            tpnlTargetArray.RowStyles.Clear();
            tpnlTargetArray.Controls.Clear();

            tpnlTargetArray.ColumnCount = 1;
            tpnlTargetArray.Width = basewidth - 5;

            ColumnStyle style = new ColumnStyle(SizeType.Absolute, (float)basewidth);
            tpnlTargetArray.ColumnStyles.Add(style);

            int CtrlHt = 0;

            if (isFirst)
            {
                tpnlTargetArray.RowCount = tNum;
                for (int i = 0; i < tNum; i++)
                {

                    TargetGraph tGraph = new TargetGraph();
                    tGraph.SetBasicValue(i + 1, m_TargetLimit, m_ScaleLimit, m_ScaleLimit);
                    tGraph.DrawControl();
                    RowStyle nstyle = new RowStyle(SizeType.Absolute, (float)tGraph.Height + 10);
                    CtrlHt = tGraph.Height + 10;
                    tpnlTargetArray.RowStyles.Add(nstyle);
                    tpnlTargetArray.Controls.Add(tGraph, 0, i);
                }
            }
            else
            {
                if (m_Images == null)
                    return;
                if (m_Images[m_SelCamNum] == null)
                    return;
                if (m_Images[m_SelCamNum].m_Targets == null)
                    return;

                tNum = m_Images[m_SelCamNum].m_Targets.Length;

                tpnlTargetArray.RowCount = tNum;

                for (int i = 0; i < tNum; i++)
                {
                    TargetGraph tGraph = new TargetGraph();
                    tGraph.SetBasicValue(int.Parse(m_Images[m_SelCamNum].m_Targets[i].m_ID), m_TargetLimit, m_ScaleLimit, m_ScaleLimit);

                    tGraph.DrawControl();
                    RowStyle nstyle = new RowStyle(SizeType.Absolute, (float)tGraph.Height + 10);
                    CtrlHt = tGraph.Height + 10;
                    tpnlTargetArray.RowStyles.Add(nstyle);
                    tpnlTargetArray.Controls.Add(tGraph, 0, i);

                }
            }

            tpnlTargetArray.Height = tNum * (CtrlHt + 4);

            tpnlTargetArray.ResumeLayout();
            tpnlTargetArray.ResumeLayout();
        }
コード例 #21
0
		public bool Contains (ColumnStyle columnStyle)
		{
			return ((IList)this).Contains (columnStyle);
		}
コード例 #22
0
ファイル: RadioGroup3.cs プロジェクト: manbou404/CSharpLab
        private void SetTableStyle()
        {
            // 行スタイル
            for (; table.RowCount != table.RowStyles.Count;)
            {
                if (table.RowCount < table.RowStyles.Count)
                {
                    this.table.RowStyles.RemoveAt(this.table.RowStyles.Count - 1);
                }
                else
                {
                    var rowStyle = new RowStyle(SizeType.Percent, (float)100.0 / table.RowCount);
                    this.table.RowStyles.Add(rowStyle);
                }
            }

            // 列スタイル
            for (; table.ColumnCount != table.ColumnStyles.Count;)
            {
                if (table.ColumnCount < table.ColumnStyles.Count)
                {
                    this.table.ColumnStyles.RemoveAt(this.table.ColumnStyles.Count - 1);
                }
                else
                {
                    var colStyle = new ColumnStyle(SizeType.Percent, (float)100.0 / table.ColumnCount);
                    this.table.ColumnStyles.Add(colStyle);
                }
            }
        }
コード例 #23
0
		public int IndexOf (ColumnStyle columnStyle)
		{
			return ((IList)this).IndexOf (columnStyle);
		}
コード例 #24
0
ファイル: ColumnStyleTest.cs プロジェクト: Profit0004/mono
		public void CtorTest1 ()
		{
			ColumnStyle cs = new ColumnStyle ();
			Assert.AreEqual (0.0f, cs.Width, "1");
			Assert.AreEqual (SizeType.AutoSize, cs.SizeType, "2");
		}
コード例 #25
0
		public void Insert (int index, ColumnStyle columnStyle)
		{
			((IList)this).Insert (index, columnStyle);
		}
コード例 #26
0
ファイル: ColumnStyleTest.cs プロジェクト: Profit0004/mono
		public void CtorTest4 ()
		{
			ColumnStyle cs = new ColumnStyle (SizeType.Absolute, -1.0f);

			TestHelper.RemoveWarning (cs);
		}
コード例 #27
0
		public void Remove (ColumnStyle columnStyle)
		{
			((IList)this).Remove (columnStyle);
		}
コード例 #28
0
ファイル: ColumnStyleTest.cs プロジェクト: Profit0004/mono
		public void WidthTest2 ()
		{
			ColumnStyle cs = new ColumnStyle ();
			cs.Width = -1.0f;
		}
コード例 #29
0
ファイル: Table.cs プロジェクト: ChrisMoreton/Test3
			public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
			{
				ctx.loadReference(this);
				width = (float)reader.ReadDouble();
				columnStyle = (ColumnStyle)reader.ReadInt32();
			}
コード例 #30
0
 /// <include file='doc\TableLayoutSettings.uex' path='docs/doc[@for="ColumnStyleCollection.Insert"]/*' />
 public void Insert(int index, ColumnStyle columnStyle)
 {
     ((IList)this).Insert(index, columnStyle);
 }
コード例 #31
0
 public void configureMasteryTrees(List<Branch> branches) {
   MasteriesTable.ColumnStyles.Clear();
   MasteriesTable.RowStyles.Clear();
   MasteriesTable.ColumnCount = branches.Count;
   MasteriesTable.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
   int j = 0;
   foreach (Branch branch in branches) {
     int i = 1;
     MasteriesTable.RowCount = branch.Tiers.Count + 1;
     MasteriesTable.Controls.Add(new Label {
       Text = branch.Name,
       AutoSize = true,
       Anchor = AnchorStyles.None
     },
       j,
       0);
     foreach (Tier tier in branch.Tiers) {
       var tierTable = new TableLayoutPanel {
         RowCount = 1,
         ColumnCount = tier.Masteries.Count
       };
       MasteriesTable.Controls.Add(tierTable, j, i);
       int k = 0;
       foreach (Mastery mastery in tier.Masteries) {
         var img = new PictureBox {
           Tag = mastery
         };
         ToolTip.SetToolTip(img, mastery.Name + "\r\n" + mastery.Description);
         img.Anchor = AnchorStyles.None;
         img.SizeMode = PictureBoxSizeMode.AutoSize;
         img.Image = mastery.Image;
         var lab = new Label();
         lab.DataBindings.Add("Text", MasteryPageBindingSource, mastery.ID, false, DataSourceUpdateMode.OnPropertyChanged);
         lab.Anchor = AnchorStyles.Left | AnchorStyles.Top;
         lab.AutoSize = true;
         lab.BackColor = Color.Black;
         lab.ForeColor = Color.White;
         lab.Font = new Font(lab.Font.FontFamily, 12, FontStyle.Bold);
         img.Controls.Add(lab);
         var r = new ColumnStyle {
           SizeType = SizeType.Percent,
           Width = 100F / tierTable.ColumnCount
         };
         tierTable.ColumnStyles.Add(r);
         tierTable.Controls.Add(img, k, 0);
         ++k;
       }
       ++i;
     }
     ++j;
   }
   for (int i = 0; i < MasteriesTable.RowCount; ++i) {
     var r = new RowStyle {
       SizeType = SizeType.Percent,
       Height = 100F / MasteriesTable.RowCount
     };
     MasteriesTable.RowStyles.Add(r);
   }
   for (int i = 0; i < MasteriesTable.ColumnCount; ++i) {
     var r = new ColumnStyle {
       SizeType = SizeType.Percent,
       Width = 100F / MasteriesTable.ColumnCount
     };
     MasteriesTable.ColumnStyles.Add(r);
   }
 }
コード例 #32
0
 /// <include file='doc\TableLayoutSettings.uex' path='docs/doc[@for="ColumnStyleCollection.Contains"]/*' />
 public bool Contains(ColumnStyle columnStyle)
 {
     return(((IList)this).Contains(columnStyle));
 }
コード例 #33
0
ファイル: frmMain.cs プロジェクト: pengkunn/gameDataEditor
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
                return;
            if (e.Node.Level != 2 && e.Node.Level != 3)
                return;

            if (e.Node.SelectedImageKey != "data")
                return;

            ConfigData configData = (ConfigData)e.Node.Tag;

            //已存在同名的数据时,不加载新的tab页
            var query = from tab in tabControl1.Tabs.Cast<DevComponents.DotNetBar.TabItem>()
                      where tab.Name==configData.Name
                      select tab;

            if (query.Count()>0)
                return;

            Template template=(Template) e.Node.Parent.Tag;

            //设置表格布局容器
            TableLayoutPanel panelData = new TableLayoutPanel();
            panelData.AutoSize = true;
            panelData.Dock = DockStyle.Fill;
            panelData.AutoScroll = true;
            panelData.BackColor = Color.Transparent;
            panelData.RowCount = template.ItemList.Count();
            panelData.ColumnCount = 2;
            panelData.RowStyles.Clear();
            for (int i = 0; i < panelData.RowCount; i++)
            {
                panelData.RowStyles.Add(new RowStyle() { SizeType = SizeType.AutoSize });
            }

            panelData.ColumnStyles.Clear();
            ColumnStyle cs1 = new ColumnStyle() { Width = 100, SizeType = SizeType.Absolute };
            panelData.ColumnStyles.Add(cs1);
            ColumnStyle cs2 = new ColumnStyle() { Width = 100, SizeType = SizeType.Percent };
            panelData.ColumnStyles.Add(cs2);

            for (int i=0;i<template.ItemList.Count();i++)
            {

                Label lab=new Label ();
                lab.Text = template.ItemList[i].Name;
                lab.AutoSize = true;
                lab.Anchor = (AnchorStyles)(AnchorStyles.Right | AnchorStyles.Top);
                lab.Margin = new Padding(7);

                // Set up the delays for the ToolTip.
                toolTip1.AutoPopDelay = 5000;
                toolTip1.InitialDelay = 1000;
                toolTip1.ReshowDelay = 500;
                // Force the ToolTip text to be displayed whether or not the form is active.
                toolTip1.ShowAlways = true;
                toolTip1.SetToolTip(lab, template.ItemList[i].Memo);

                panelData.Controls.Add(lab);

                Control form = this.LoadFormControl(template.ItemList[i], configData);

                panelData.Controls.Add(form);

            }

            //添加新tab页
            DevComponents.DotNetBar.TabItem tabItem = tabControl1.CreateTab(configData.Name);
            tabItem.Name = configData.Code;
            tabItem.Tag = configData;
            tabItem.AttachedControl.Controls.Add(panelData);

            tabControl1.SelectedTab = tabItem;
        }
コード例 #34
0
ファイル: TableLayoutTest.cs プロジェクト: Profit0004/mono
		public void TestTableLayoutStyleOwned ()
		{
			try {
				ColumnStyle style = new ColumnStyle ();
				TableLayoutColumnStyleCollection coll = new TableLayoutPanel ().ColumnStyles;
				coll.Add (style);
				TableLayoutColumnStyleCollection coll2 = new TableLayoutPanel ().ColumnStyles;
				coll2.Add (style);
				Assert.Fail ("#1");
			} catch (ArgumentException ex) {
				// PASS
			}

			try {
				RowStyle style = new RowStyle ();
				TableLayoutRowStyleCollection coll = new TableLayoutPanel ().RowStyles;
				coll.Add (style);
				TableLayoutRowStyleCollection coll2 = new TableLayoutPanel ().RowStyles;
				coll2.Add (style);
				Assert.Fail ("#2");
			} catch (ArgumentException ex) {
				// PASS
			}
		}
コード例 #35
0
 private void CreateDynamicControls()
 {
     string xmlControls = ResourceReader.ReadFromResource("Lewis.SST.Forms.Options.optionsControls.xml");
     if (!xmlControls.Equals(string.Empty))
     {
         XmlDocument xControls = new XmlDocument();
         xControls.LoadXml(xmlControls);
         string name = xControls.SelectSingleNode("/options/settings").Attributes["name"].Value;
         topLevel.Text = name;
         treeView1.Nodes.Add(topLevel);
         XmlNodeList xnl = xControls.SelectNodes("/options/settings/panel");
         if (xnl != null)
         {
             foreach (XmlNode node in xnl)
             {
                 // add new panel for each new tree node
                 ColumnStyle cstyle = new ColumnStyle(SizeType.Percent);
                 cstyle.Width = 50;  // 50%
                 TreeNode tn = new TreeNode(node.Attributes["name"].Value);
                 TableLayoutPanel p = new TableLayoutPanel();
                 p.AutoSize = true;
                 p.AutoScroll = true;
                 p.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset;
                 p.Padding = new Padding(1, 1, 4, 5);
                 p.Name = tn.Text;
                 p.Anchor = AnchorStyles.None;
                 p.ColumnStyles.Add(cstyle);
                 p.ColumnCount = 2;
                 p.Visible = false;
                 
                 XmlNodeList xnlControls = node.SelectNodes("./controls/control");
                 for (int ii = 0; ii < xnlControls.Count; ii++)
                 {
                     XmlNode xnCtrl = (XmlNode)xnlControls[ii];
                     string type = xnCtrl.Attributes["type"].Value;
                     string label = xnCtrl.Attributes["label"].Value;
                     string ctrlName = xnCtrl.Attributes["name"].Value;
                     string tooTip = xnCtrl.Attributes["tooltip"].Value;
                     Type t = OptionValues.GetTypeFromAppDomain(type, "System.Windows.Forms");
                     Object obj = Activator.CreateInstance(t);
                     ((Control)obj).Name = ctrlName;
                     if (type.ToLower().Equals("textbox"))
                     {
                         ((TextBox)obj).MaxLength = 255;
                         ((TextBox)obj).ScrollBars = ScrollBars.Horizontal;
                     }
                     toolTip.SetToolTip((Control)obj, tooTip);
                     Label lbl = new Label();
                     lbl.Padding = new Padding(2, 6, 0, 0);
                     lbl.AutoSize = true;
                     lbl.Text = label;
                     p.Controls.Add((Control)lbl, 0, ii);
                     p.Controls.Add((Control)obj, 1, ii);
                 }
                 tn.Tag = p;
                 topLevel.Nodes.Add(tn);
             }
         }
         treeView1.ExpandAll();
     }
 }
コード例 #36
0
ファイル: DataGrid.cs プロジェクト: masalinas/konekti.net
        public void SetColumnVisible(string ColumnName, string DisplayName, int Width, int ColumnPosition, ColumnStyle Style, DataGridViewAutoSizeColumnMode AutoSizeColumnMode)
        {
            DataGridViewColumn _column = new DataGridViewColumn();

            _column.CellTemplate = new DataGridViewTextBoxCell();
            _column.Name = ColumnName;
            _column.HeaderText = DisplayName;
            _column.DataPropertyName = ColumnName;
            _column.Width = Width;
            _column.DisplayIndex = ColumnPosition;
            _column.AutoSizeMode = AutoSizeColumnMode;
            _column.SortMode = DataGridViewColumnSortMode.Automatic;
            
            switch (Style)
            {
                case ColumnStyle.CheckBoxColumn:
                    _column.CellTemplate = new DataGridViewCheckBoxCell(true);
                    break;
                case ColumnStyle.ImageColumn:
                    _column.CellTemplate = new DataGridViewImageCell();
                    break;
                case ColumnStyle.ComboBoxColumn:
                    _column.CellTemplate = new DataGridViewComboBoxCell();
                    break;
                case ColumnStyle.LinkColumn:
                    _column.CellTemplate = new DataGridViewLinkCell();
                    break;
                case ColumnStyle.ButtonColumn:
                    _column.CellTemplate = new DataGridViewButtonCell();
                    break;
            }

            this.Columns.Add(_column);
            this._ColumnsVisible.Add(ColumnName);
        }
コード例 #37
0
 public int Add(ColumnStyle columnStyle)
 {
     return(base.Add(columnStyle));
 }
コード例 #38
0
        private void btnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (barEditItem1.EditValue == null || barEditItem2.EditValue == null)
            {
                XtraMessageBox.Show("请指定明确的楼层与区域.", "错误提示");
                return;
            }

            splashScreenManager1.ShowWaitForm();

            if (tableLayoutPanel1 != null)
            {
                groupControl3.Controls.Remove(tableLayoutPanel1);
                tableLayoutPanel1.Dispose();
            }

            try
            {
                tableLayoutPanel1 = new TableLayoutPanel();
                tableLayoutPanel1.BackColor = Color.White;
                tableLayoutPanel1.Dock = DockStyle.Fill;
                tableLayoutPanel1.AutoScroll = true;
                tableLayoutPanel1.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(tableLayoutPanel1, true, null);
                this.groupControl3.Controls.Add(tableLayoutPanel1);

                dt = monthCalendar1.SelectionStart;
                iPeroid = radioGroup1.SelectedIndex;
                iFloorId = Convert.ToDecimal(barEditItem1.EditValue);
                iAreaId = Convert.ToDecimal(barEditItem2.EditValue);

                List<MACHINE_SCHEDULE> lstMc1 = db.Fetch<MACHINE_SCHEDULE>("where SCHEDULE_TIME = @0 and SCHEEDULE_PERIOD = @1 and FLOOR_ID = @2 and AREA_ID = @3",
                    new object[] { monthCalendar1.SelectionStart, radioGroup1.SelectedIndex, barEditItem1.EditValue, barEditItem2.EditValue });

                List<MACHINE_INFO> lstInfo = db.Fetch<MACHINE_INFO>("where FLOOR_ID = @0 and AREA_ID = @1 order by BED_NO", new object[] { barEditItem1.EditValue, barEditItem2.EditValue });
                MACHINE_LAYOUT mL = db.SingleOrDefault<MACHINE_LAYOUT>("where floorid = @0 and areaid = @1", new object[] { barEditItem1.EditValue, barEditItem2.EditValue });

                int iRow = 0;                                                                                   // 行数
                int iCol = 0;                                                                                   // 列数
                int iCount = 0;                                                                                 // 透析机总数
                if (lstInfo != null && lstInfo.Count > 0 && mL != null)
                {
                    iRow = Convert.ToInt32(mL.ROOMROWS);
                    iCol = Convert.ToInt32(Math.Ceiling((decimal)lstInfo.Count / (decimal)mL.ROOMROWS));        // 向上取整
                    iCount = lstInfo.Count;

                    tableLayoutPanel1.Controls.Clear();
                    tableLayoutPanel1.Size = new System.Drawing.Size(0, 0);
                    tableLayoutPanel1.AutoSize = true;
                    tableLayoutPanel1.RowStyles.Clear();

                    tableLayoutPanel1.Controls.Clear();
                    tableLayoutPanel1.RowCount = iRow;
                    tableLayoutPanel1.ColumnCount = iCol;

                    tableLayoutPanel1.ColumnStyles.Clear();
                    for (int i = 0; i < iRow; i++)
                    {
                        RowStyle rs = new RowStyle();
                        rs.SizeType = SizeType.Percent;
                        tableLayoutPanel1.RowStyles.Add(rs);
                    }

                    for (int i = 0; i < iCol; i++)
                    {
                        ColumnStyle cs = new ColumnStyle();
                        cs.SizeType = SizeType.AutoSize;
                        tableLayoutPanel1.ColumnStyles.Add(cs);
                    }

                    int iCnt = 0;
                    for (int r = 0; r < iRow; r++)
                    {
                        for (int c = 0; c < iCol; c++)
                        {
                            if (iCnt < iCount)
                            {
                                // 生成控件
                                UcDialysis uc = new UcDialysis(lstPatientReg, lstPatientBaseInfo, dt, iFloorId, iAreaId, iPeroid, iFrmType);
                                uc.No = lstInfo[iCnt].BED_NO;
                                uc.Model = lstInfo[iCnt].MODEL;
                                uc.M_Type = lstInfo[iCnt].MACHINETYPE;
                                uc.SN = lstInfo[iCnt].SN;
                                uc.InfoID = lstInfo[iCnt].ID;

                                // 获取该设备的图片
                                MACHINE_TYPE mType = db.SingleOrDefault<MACHINE_TYPE>("where MODEL = @0 AND M_TYPE = @1", new object[] { lstInfo[iCnt].MODEL, lstInfo[iCnt].MACHINETYPE });
                                if (mType != null && mType.M_PICTURE != null && mType.M_PICTURE.Length > 0)
                                    uc.Pict = mType.M_PICTURE;

                                // 根据不同功能,控件按钮全能
                                switch (iFrmType)
                                {
                                    case 0:
                                        {
                                            uc.StatusOP = false;
                                            uc.CheckIn = false;
                                            uc.Maintence = false;
                                            uc.Idel = false;
                                            break;
                                        }
                                    case 1:
                                        {
                                            uc.StatusOP = false;
                                            uc.Maintence = false;
                                            uc.SearchPt = false;
                                            uc.Idel = false;
                                            break;
                                        }
                                    case 2:
                                        {
                                            uc.StatusOP = false;
                                            uc.SearchPt = false;
                                            uc.CheckIn = false;
                                            break;
                                        }
                                }

                                // 加载预约/签到/维护等信息
                                var v = lstMc1.Where(s => s.BED_NO == lstInfo[iCnt].BED_NO).FirstOrDefault<MACHINE_SCHEDULE>();
                                if (v != null)
                                {
                                    if (v.MACHINE_STATUS != null)
                                        uc.Status = (decimal?)v.MACHINE_STATUS;
                                    else
                                        uc.Status = 74;                                     // 空闲
                                    uc.PtNo = Convert.ToInt32(v.PT_ID);
                                    uc.ScheduleID = v.ID;
                                    uc.CheckInTime = v.CHCKINTM;
                                    uc.ReservTm = v.RESERVATION;
                                }
                                else
                                {
                                    uc.Status = 74;
                                    uc.PtNo = null;
                                }
                                try
                                {
                                    tableLayoutPanel1.Controls.Add(uc);
                                }
                                catch (Exception err)
                                {
                                    Console.WriteLine(err.Message);
                                }

                            }
                            iCnt++;
                        }
                    }
                }
                else
                    tableLayoutPanel1.Controls.Clear();
            }
            catch(Exception err)
            {
                splashScreenManager1.CloseWaitForm();
                MessageBox.Show("未知错误. 错误原因: " + err.Message, "错误提示",  MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            splashScreenManager1.CloseWaitForm();
        }
コード例 #39
0
        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));
            }
        }