public void TabControl_Appearance_Set_GetReturnsExpected(TabAppearance value) { var control = new TabControl { Appearance = value }; Assert.Equal(value, control.Appearance); // Set same. control.Appearance = value; Assert.Equal(value, control.Appearance); }
private TabControl MakeTab(int x, int y, TabAlignment a, TabAppearance ap) { TabControl tab = new TabControl(); // tab.Padding = new Point(20, 3); tab.Location = new Point (x, y); tab.Alignment = a; tab.Appearance = ap; tab.Controls.Add (CreateTabPage ("Red", Color.FromArgb (255, 255, 0, 0))); tab.Controls.Add (CreateTabPage ("Orange", Color.FromArgb (255, 255, 153, 0))); tab.Controls.Add (CreateTabPage ("Yellow", Color.FromArgb (255, 255, 255, 0))); tab.Controls.Add (CreateTabPage ("Green", Color.Green)); tab.Controls.Add (CreateTabPage ("Blue", Color.FromArgb (255, 0, 0, 255))); tab.Controls.Add (CreateTabPage ("Purple", Color.FromArgb (255, 197, 0, 148))); tab.Height = 200; tab.Width = 200; tab.SelectedIndex = 3; return tab; }
public void TabControl_Appearance_SetWithHandle_GetReturnsExpected(TabAppearance value) { var control = new TabControl(); IntPtr oldHandle = control.Handle; Assert.NotEqual(IntPtr.Zero, oldHandle); control.Appearance = value; Assert.Equal(value, control.Appearance); IntPtr newHandle = control.Handle; Assert.NotEqual(IntPtr.Zero, newHandle); Assert.NotEqual(oldHandle, newHandle); // Set same. control.Appearance = value; Assert.Equal(value, control.Appearance); Assert.Equal(newHandle, control.Handle); }
private TabControl MakeTab(int x, int y, TabAlignment a, TabAppearance ap) { TabControl tab = new TabControl(); // tab.Padding = new Point(20, 3); tab.Location = new Point(x, y); tab.Alignment = a; tab.Appearance = ap; tab.Controls.Add(CreateTabPage("Red", Color.FromArgb(255, 255, 0, 0))); tab.Controls.Add(CreateTabPage("Orange", Color.FromArgb(255, 255, 153, 0))); tab.Controls.Add(CreateTabPage("Yellow", Color.FromArgb(255, 255, 255, 0))); tab.Controls.Add(CreateTabPage("Green", Color.Green)); tab.Controls.Add(CreateTabPage("Blue", Color.FromArgb(255, 0, 0, 255))); tab.Controls.Add(CreateTabPage("Purple", Color.FromArgb(255, 197, 0, 148))); tab.Height = 200; tab.Width = 200; tab.SelectedIndex = 3; return(tab); }
private void OnMsgControlConfig(string sn) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { OnMsgControlConfig(sn); })); return; } if (sn == MonitorAllConfig.Instance().ALLScreenName) { _appearance = brightnessSettingTabControl.Appearance; _size = brightnessSettingTabControl.ItemSize; _tabSizeMode = brightnessSettingTabControl.SizeMode; brightnessSettingTabControl.Appearance = TabAppearance.FlatButtons; brightnessSettingTabControl.ItemSize = new Size(0, 1); brightnessSettingTabControl.SizeMode = TabSizeMode.Fixed; brightnessSettingTabControl.SelectTab("globSettingTabPage"); //brightnessSettingTabControl.Visible = false; //this.Enabled = false; //label_tip.Text = CommonUI.GetCustomMessage(_langTable, "choicesinglescreen", "请选择单个显示屏,配置亮度调节"); //label_tip.BringToFront(); //label_tip.Visible = true; //ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "choicesinglescreen", "请选择单个显示屏,配置亮度调节"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert); //groupBox_AutoBrightConfig.Parent = panel_ConfigBase; //groupBox_AutoBrightConfig.Visible = true; //groupBox_BrightnessTable.Visible = false; return; } else { if (MonitorAllConfig.Instance().LedInfoList != null && MonitorAllConfig.Instance().LedInfoList.Count == 1) { brightnessSettingTabControl.Appearance = _appearance; brightnessSettingTabControl.ItemSize = _size; brightnessSettingTabControl.SizeMode = _tabSizeMode; brightnessSettingTabControl.SelectTab("brightnessConfigTabPage"); //tabControl1.Dock = DockStyle.Fill; //tabControl1.Visible = true; //groupBox_AutoBrightConfig.Visible = true; //groupBox_AutoBrightConfig.Parent = tabPage_AutoBrightConfig; //groupBox_BrightnessTable.Visible = true; //groupBox_BrightnessTable.Parent = tabPage_BrightnessTable; //label_tip.Visible = false; } else { brightnessSettingTabControl.Appearance = TabAppearance.FlatButtons; brightnessSettingTabControl.ItemSize = new Size(0, 1); brightnessSettingTabControl.SizeMode = TabSizeMode.Fixed; brightnessSettingTabControl.SelectTab("brightnessConfigTabPage"); //tabControl1.Visible = false; //groupBox_AutoBrightConfig.Visible = false; //groupBox_BrightnessTable.Visible = true; //groupBox_BrightnessTable.Parent = panel_ConfigBase; //label_tip.Visible = true; } } //label_tip.Visible = false; //this.Enabled = true; //if (sn == _sn) //{ // return; //} //_sn = sn; //if (MonitorAllConfig.Instance().BrightnessConfigList != null) //{ // SmartLightConfigInfo tmp = MonitorAllConfig.Instance().BrightnessConfigList.Find(a => a.ScreenSN == sn); // if (tmp == null) // { // _screenConfigInfo = new SmartLightConfigInfo(); // _screenConfigInfo.ScreenSN = sn; // _screenConfigInfo.HwExecTypeValue = BrightnessHWExecType.SoftWareControl; // } // else _screenConfigInfo = (SmartLightConfigInfo)(tmp.Clone()); //} //else //{ // _screenConfigInfo = new SmartLightConfigInfo(); _screenConfigInfo.ScreenSN = sn; // _screenConfigInfo.HwExecTypeValue = BrightnessHWExecType.SoftWareControl; //} //switch (_screenConfigInfo.HwExecTypeValue) //{ // case BrightnessHWExecType.DisDisplayBlack: // radioButton_Software.Checked = true; // checkBox_ScreenDisplay.Checked = true; // break; // case BrightnessHWExecType.DisHardWareControl: // radioButton_Software.Checked = true; // if (_screenConfigInfo.DisplayHardcareConfig == null || _screenConfigInfo.DisplayHardcareConfig.OneDayConfigList == null || _screenConfigInfo.DisplayHardcareConfig.OneDayConfigList.Count == 0) // { // checkBox_Hareware.Checked = false; // } // else checkBox_Hareware.Checked = true; // break; // case BrightnessHWExecType.HardWareControl: // radioButton_Hardware.Checked = true; // break; // case BrightnessHWExecType.SoftWareControl: // radioButton_Software.Checked = true; // checkBox_Hareware.Checked = false; // checkBox_ScreenDisplay.Checked = false; // break; // default: // break; //} }
public void TabControl_Appearance_SetInvalidValue_ThrowsInvalidEnumArgumentException(TabAppearance value) { var control = new TabControl(); Assert.Throws <InvalidEnumArgumentException>("value", () => control.Appearance = value); }
public TabControl() { selectedIndex = -1; alignment = TabAlignment.Top; drawMode = TabDrawMode.Normal; itemSize = new Size(42, 21); padding = new Point(6, 3); moveButtonSize = new Size (17, 17); sizeMode = TabSizeMode.Normal; appearance = TabAppearance.Normal; tabPageCollection = new TabPageCollection(this); SetStyle(ControlStyles.UserPaint, true); moveButtonLeftState = ButtonState.Normal; moveButtonRightState = ButtonState.Normal; hotTrackIndex = -1; SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); }