public NewsPanel(List <Links> news) { if (news.Count == 0) { return; } this.RowCount = news.Count + 1; this.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; for (int i = 0; i <= 20; i++) { Single percent = FONT_SIZE + 8; this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, percent)); } //foreach (Links title in news) for (int i = 0; i <= 20; i++) { Links title = news[0]; if (title.Title != null && title.Title.Length > 0) { HyperlinkLabel label = new HyperlinkLabel(title); label.TextAlign = ContentAlignment.BottomLeft; label.Font = new Font("宋体", FONT_SIZE, this.Font.Style); label.Padding = new System.Windows.Forms.Padding(1, 3, 3, 1); label.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom; label.LinkClicked += new LinkLabelLinkClickedEventHandler(this.HyperlinkLabel_LinkClicked); this.Controls.Add(label); } } }
public NewsPanel(List<Links> news) { if (news.Count == 0) return; this.RowCount = news.Count + 1; this.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; for (int i = 0; i <= 20; i++) { Single percent = FONT_SIZE + 8; this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, percent)); } //foreach (Links title in news) for (int i = 0; i <= 20; i++) { Links title = news[0]; if (title.Title != null && title.Title.Length > 0) { HyperlinkLabel label = new HyperlinkLabel(title); label.TextAlign = ContentAlignment.BottomLeft; label.Font = new Font("宋体", FONT_SIZE, this.Font.Style); label.Padding = new System.Windows.Forms.Padding(1, 3, 3, 1); label.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom; label.LinkClicked += new LinkLabelLinkClickedEventHandler(this.HyperlinkLabel_LinkClicked); this.Controls.Add(label); } } }
public DialogLogin() { InitializeComponent(); textBoxAppID.Text = "APPID"; textBoxAppID.Size = new Size(200, 21); textBoxAppID.Anchor = AnchorStyles.Top | AnchorStyles.Bottom; textBoxAppID.Dock = DockStyle.Fill; this.tableLayoutPanel1.Controls.Add(textBoxAppID, 1, 0); textBoxSecret.Text = "SECRET"; textBoxSecret.Size = new Size(200, 21); textBoxSecret.Anchor = AnchorStyles.Top | AnchorStyles.Bottom; textBoxSecret.Dock = DockStyle.Fill; this.tableLayoutPanel1.Controls.Add(textBoxSecret, 1, 1); btnDlgOK.Size = new Size(200, 32); btnDlgOK.FlatStyle = FlatStyle.Flat; btnDlgOK.Anchor = AnchorStyles.Top | AnchorStyles.Bottom; //btnDlgOK.Dock = DockStyle.Fill; btnDlgOK.Text = "Submit"; btnDlgOK.BackColor = clrSubmit; btnDlgOK.Click += new EventHandler(Button_Click); this.tableLayoutPanel1.Controls.Add(btnDlgOK, 1, 2); HyperlinkLabel label = new HyperlinkLabel(register); label.TextAlign = ContentAlignment.MiddleCenter; label.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; label.Dock = DockStyle.Fill; label.LinkClicked += new LinkLabelLinkClickedEventHandler(HyperlinkLabel_LinkClicked); this.tableLayoutPanel1.Controls.Add(label, 2, 0); foreach (Control ctrl in this.tableLayoutPanel1.Controls) { if (debug) { Console.WriteLine(ctrl.Size); } } m_UpdateTimer.Interval = 500; m_UpdateTimer.Enabled = true; m_UpdateTimer.Tick += new EventHandler(UpdateTimer_Tick); m_UpdateTimer.Start(); loginFSMState = LoginFSM.LOGIN_FSM_INIT; }
public DialogLogin() { InitializeComponent(); textBoxAppID.Text = "APPID"; textBoxAppID.Size = new Size(200, 21); textBoxAppID.Anchor = AnchorStyles.Top | AnchorStyles.Bottom; textBoxAppID.Dock = DockStyle.Fill; this.tableLayoutPanel1.Controls.Add(textBoxAppID, 1, 0); textBoxSecret.Text = "SECRET"; textBoxSecret.Size = new Size(200, 21); textBoxSecret.Anchor = AnchorStyles.Top | AnchorStyles.Bottom; textBoxSecret.Dock = DockStyle.Fill; this.tableLayoutPanel1.Controls.Add(textBoxSecret, 1, 1); btnDlgOK.Size = new Size(200, 32); btnDlgOK.FlatStyle = FlatStyle.Flat; btnDlgOK.Anchor = AnchorStyles.Top | AnchorStyles.Bottom; //btnDlgOK.Dock = DockStyle.Fill; btnDlgOK.Text = "Submit"; btnDlgOK.BackColor = clrSubmit; btnDlgOK.Click += new EventHandler(Button_Click); this.tableLayoutPanel1.Controls.Add(btnDlgOK, 1, 2); HyperlinkLabel label = new HyperlinkLabel(register); label.TextAlign = ContentAlignment.MiddleCenter; label.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; label.Dock = DockStyle.Fill; label.LinkClicked += new LinkLabelLinkClickedEventHandler(HyperlinkLabel_LinkClicked); this.tableLayoutPanel1.Controls.Add(label, 2, 0); foreach (Control ctrl in this.tableLayoutPanel1.Controls) { if (debug) Console.WriteLine(ctrl.Size); } m_UpdateTimer.Interval = 500; m_UpdateTimer.Enabled = true; m_UpdateTimer.Tick += new EventHandler(UpdateTimer_Tick); m_UpdateTimer.Start(); loginFSMState = LoginFSM.LOGIN_FSM_INIT; }