I want to generate same number of panels dynamically as number of distinct values are read by the sqlcommand and then display controls dynamically in the panel according to the values read by another sqlcommand, refer to code. But the controls ie buttons are displaying only in one panel instead of all the respective panels. Screenshot of generated result: Why is the code not displaying cont
我想要动态生成相同数量的面板,因为sqlcommand会读取不同值的数量,然后根据另一个sqlcommand读取的值在面板中动态显示控件,请参阅代码。 但是控件即按钮仅在一个面板中显示,而不是在所有相应的面板中显示。 生成结果的屏幕截图: 为什么即使控件绘制在正确的位置,代码也不会在所有面板中显示控件? private void show_button() { //InitializeComponent(); con1.con.Open(); SqlCommand cmd = new SqlCom
I have a problem, because in my code I am dynamically creating new buttons, and after that, the window looks in that way: This is code that I used for that: private void DrawButtons() { for (int i = 0; i < 90; i++) { Button button = new Button(); button.Location = new Point(15 + 40 * i, 10); button.Size = new Size(35, 30); button.Parent = panel4;
我有一个问题,因为在我的代码中,我动态地创建了新的按钮,之后,窗口看起来就是这样的: 这是我使用的代码: private void DrawButtons() { for (int i = 0; i < 90; i++) { Button button = new Button(); button.Location = new Point(15 + 40 * i, 10); button.Size = new Size(35, 30); button.Parent = panel4; button.Tag = i; Controls.Add(button);
I have an element containing a panel : this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tableLayoutPanel1.SetColumnSpan(this.panel1, 2); this.panel1.Controls.Add(this.tableLay
我有一个包含面板的元素: this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tableLayoutPanel1.SetColumnSpan(this.panel1, 2); this.panel1.Controls.Add(this.tableLayoutPanel2); th
In my form, I created two panels panel1 and panel2, within each panel I created one button named button1 and button2 respectively. if I want to add event handler using, this.button1.Click += buttonEvent; is fine. But, when I use foreach for each controls in form, It is not detected. Whats the problem here? public myForm1() { InitializeComponent(); foreach (Control c in this.Control
在我的表单中,我创建了两个面板panel1和panel2,在每个面板中,我分别创建了一个名为button1和button2的按钮。 如果我想添加事件处理程序使用, this.button1.Click += buttonEvent; 很好。 但是,当我在表单中使用每个控件的foreach时,它不会被检测到。 这里有什么问题? public myForm1() { InitializeComponent(); foreach (Control c in this.Controls) { TextBox tb = c as TextBox;
My form has a row of buttons along the top and another along the bottom. In order to improve the appearance, I put a Panel behind each of the two rows. This gives me the problem that I can no longer have a routine which can refer to any button. This is because I now need to include the name of the panel in the reference. For instance, I have a routine which makes the button forecolor red whe
我的表单沿着顶部有一排按钮,沿着底部有一排按钮。 为了改善外观,我在两行后面放了一个面板。 这给我一个问题,我不能再有一个可以引用任何按钮的例程。 这是因为我现在需要在参考中包含面板的名称。 例如,我有一个例程,它使得按钮在获得焦点时呈前鲜红色。 Internal void ButtonGotFocus() { CurrentFieldName = this.ActiveControl.Name; this.Controls[CurrentFieldName].ForeColor = Color.FromArgb(192, 0
My problem is that i've got a panel called PanelNewFriend, where i'm dynamically creating buttons from all users from a mysql database. So when someone clicks on a user and sends an invite , what should be happening is that it should remove all buttons (Except for the back button which has a tag of "1") and then place all the buttons again for the new list of all users. When
我的问题是,我有一个名为PanelNewFriend的面板,在那里我从一个mysql数据库动态创建所有用户的按钮。 所以当有人点击一个用户并发送一个邀请时,应该发生的事情是它应该删除所有按钮(除了标签为“1”的后退按钮),然后再次将所有按钮放到新列表中全部用户。 当创建按钮时,我为它们分配了一个值为“0”的标签。 即使我不认为问题出在标签上,所有按钮都有。 我正在使用此代码删除面板中的所有按钮。 foreach (Button item i
I have an update panel I need inside of another panel. This panel is controlled by Ajax update control. When I have this update panel inside the desired panel, both the update panel and the panel controlled by ajax does not display when pressing the link button. If I pull this update panel out into its own panel above, both will display, however, it looks a bit tacky and really needs to be ins
我有另一个面板内需要的更新面板。 该面板由Ajax更新控制控制。 当我在所需的面板中有这个更新面板时,当按下链接按钮时,更新面板和由ajax控制的面板不会显示。 如果我把这个更新面板放到它自己的面板上面,两个都会显示,但是,它看起来有点俗气,真的需要在ajax控制面板内。 我明白,他们如何互动有一些冲突,但不知道如何去取得理想的结果。
I have a C# Windows Form that has a SplitContainer. Inside SplitContainer2 I have a Panel (Panel1). Within that Panel I am creating 10 smaller panels that 5 TextBoxes apiece. I then add each of these panels to Panel1. for (int i = 1; i < 11; i++) { Panel panel = new Panel(); TextBox txtBox1 = new TextBox(); TextBox txtBox2 = new TextBox(); TextBox txtBox3 = new TextBox();
我有一个具有SplitContainer的C#Windows窗体。 里面SplitContainer2我有一个面板(Panel1)。 在这个小组中,我创建了10个更小的面板,每个文本框5个。 然后,我将这些面板中的每一个添加到Panel1。 for (int i = 1; i < 11; i++) { Panel panel = new Panel(); TextBox txtBox1 = new TextBox(); TextBox txtBox2 = new TextBox(); TextBox txtBox3 = new TextBox(); TextBox txtBox4 = new TextBo
Well, I am doing a project on online movie ticket booking. My problem is, I want to show the seating arrangement in a screen of a particular theater. As in every row the number of seats can vary so what I have done is add a panel and in it a checkboxlist is dynamically added during runtime. each checkboxlist represents a single row. string s; for (int i = 0; i < ds.Tables["row_id_no_of
那么,我正在做一个在线电影票预订的项目。 我的问题是,我想在特定的剧院的屏幕上显示座位安排。 就像在每行中一样,座位的数量可能会有所不同,所以我所做的是添加一个面板,并在其中运行时动态地添加一个checkboxlist。 每个复选框列表代表一行。 string s; for (int i = 0; i < ds.Tables["row_id_no_of_seats"].Rows.Count; i++) { cbl = new CheckBoxList(); cbl.RepeatDirection = 0; //horizontal
On the form called "Dev" I have the following OnFormClosing function to make sure a thread is closed properly when a user closes the form. protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); dev.stopMultipleColorsWatcher(); } Works fine if I close the "Dev" form directly. But if the "Dev" form closes because the main form
在称为“开发”的窗体上,我有以下OnFormClosing函数以确保用户关闭窗体时正确关闭线程。 protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); dev.stopMultipleColorsWatcher(); } 如果我直接关闭“Dev”表单,可以正常工作。 但是,如果由于主窗体(“Form1”)关闭(导致程序退出)而导致“Dev”窗体关闭,“Dev”中的OnFormClosing()函数永远不会被调用,所以线程继续运行,进程需要