小妹求救!求救!问一个超难的TabControl去边框的问题! 我有一个TabControl控件!里面分别有两个TabPage!每一个TabPage我都会设置一个BackgroundImage.但是设置完以后总会发现这个TabPage外面会有一个边框!我仔细查看了是这个TabControl控件的边框!小妹求救了!如何去掉这个边框或者让它成为透明色!谢谢各位师哥了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 this.tabPage1.BorderStyle = BorderStyle.None; 这是我窗体设计代码!#region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.button1 = new System.Windows.Forms.Button(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); this.SuspendLayout(); // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Location = new System.Drawing.Point(36, 71); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(223, 143); this.tabControl1.TabIndex = 0; // // tabPage1 // this.tabPage1.BackColor = System.Drawing.Color.Black; this.tabPage1.Controls.Add(this.button1); this.tabPage1.Location = new System.Drawing.Point(4, 21); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(215, 118); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "tabPage1"; this.tabPage1.UseVisualStyleBackColor = true; // // tabPage2 // this.tabPage2.BackColor = System.Drawing.Color.Silver; this.tabPage2.BorderStyle = BorderStyle.None; this.tabPage2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("tabPage2.BackgroundImage"))); this.tabPage2.Controls.Add(this.checkBox1); this.tabPage2.Location = new System.Drawing.Point(4, 21); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(215, 118); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "tabPage2"; this.tabPage2.UseVisualStyleBackColor = true; // // button1 // this.button1.Location = new System.Drawing.Point(27, 40); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; // // checkBox1 // this.checkBox1.AutoSize = true; this.checkBox1.Location = new System.Drawing.Point(73, 52); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(78, 16); this.checkBox1.TabIndex = 0; this.checkBox1.Text = "checkBox1"; this.checkBox1.UseVisualStyleBackColor = true; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.tabControl1); this.Name = "Form1"; this.Text = "Form1"; this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); this.ResumeLayout(false); } #endregion TabControl控件里设置border="0"可以么? 我是WinFrom程序没有border属性! 有个 Padding 的属性默认是3,3,3,3 你改成 0,0,0,0还有个 Margin 默认的也是 3,3,3,3 你也改成 0,0,0,0试下 TabPage.borderstyle=BorderStyle.None;试下。 图片没问题!是充满整个窗体的图片!TabPage.borderstyle=BorderStyle.None;也没有用 用下面这个:tabContain.Appearance = TabAppearance.FlatButtons; 这个是Windows主题的问题~ 今天我也出现了这个问题~ 改了好几次主题~ 最后边框就没了~ 以前我做WPF 程序时也出现过按钮变丑了的问题~ 发现也是主题的原因~ 呵呵~ 因为有些主题跟微软的软件不是完全兼容~ .Net GridView 如何在服务端设置选中某一行 PlaceHolder动态加载GridView,当更换时GridView内数据显示错误!! 请教关于C#正规替换的一个问题 [Help]如何通过Win32API向串口发16进制指令(数组)? 如何在点击按钮后重启C#做的应用程序? 拖动控件可以改变控件的大小,并且改变控件的字体大小??怎么实现 目录名无效 在无线互联时代,C#怎么和VB.NET比较??C#能调用VBA吗,繁举个例????? C#listview中如何进行列的排序 对象当前正在其他地方使用。。。。急在线等!!! winform可以 wcf不可以? 分享一个表达式计算的代码
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(36, 71);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(223, 143);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.Black;
this.tabPage1.Controls.Add(this.button1);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(215, 118);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.Color.Silver;
this.tabPage2.BorderStyle = BorderStyle.None;
this.tabPage2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("tabPage2.BackgroundImage")));
this.tabPage2.Controls.Add(this.checkBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(215, 118);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Location = new System.Drawing.Point(27, 40);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(73, 52);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(78, 16);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "checkBox1";
this.checkBox1.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.tabControl1);
this.Name = "Form1";
this.Text = "Form1";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.ResumeLayout(false); } #endregion
还有个 Margin 默认的也是 3,3,3,3 你也改成 0,0,0,0
试下
TabPage.borderstyle=BorderStyle.None;
试下。
TabPage.borderstyle=BorderStyle.None;
也没有用
以前我做WPF 程序时也出现过按钮变丑了的问题~ 发现也是主题的原因~ 呵呵~ 因为有些主题跟微软的软件不是完全兼容~