TabControl tabControl = new TabControl(); //i have made the tabcontrol draw mode to be ownerdrawfixed private void tabControl_DrawItem(object sender, DrawItemEventArgs e) {//this is to color my tabcontrol but nothing happens,it only works if i use drag and drop tabcontrol Brush txt, box_brush; Pen bp; Rectangle tab_rect = tabControl.GetTabRect(e.Index); if (e.State == DrawItemState.Selected) { e.Graphics.FillRectangle(Brushes.Red, tab_rect); e.DrawFocusRectangle(); txt = Brushes.Black; box_brush = Brushes.Silver; bp = Pens.DarkBlue; } else { e.Graphics.FillRectangle(Brushes.Red, tab_rect); txt = Brushes.Blue; box_brush = Brushes.Silver; bp = Pens.DarkBlue; } //BUT I CREATED THE BUTTON UNDER BTNQUESTION public void btnquestion_Click(object sender, EventArgs e) { this.Controls.Add(tabControl); int page; //am= amount of the questions int am=20; for (int i = 0; i < am; i++) { TabPage tp = new TabPage(); page = i + 1; tp.Text = page.ToString(); tabControl.Controls.Add(tp); Label lb1 = new Label(); RadioButton r1 = new RadioButton(); RadioButton r2 = new RadioButton(); RadioButton r3 = new RadioButton(); RadioButton r4 = new RadioButton(); //i have done the locations and the font tp.Controls.Add(lb1); tp.Controls.Add(r1); tp.Controls.Add(r2); tp.Controls.Add(r3); tp.Controls.Add(r4); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)