C#2005自己制作控件疑难
大家帮我看下这是什么问题?E:\ipBox\ipBox\UserControl1.cs(26,16): 错误 CS0117: “ipBox.ipBox”并不包含“MaskIpAddr”的定义
E:\ipBox\ipBox\UserControl1.Designer.cs(35,18): 错误 CS0117: “ipBox.ipBox”并不包含“AutoScaleDimensions”的定义
E:\ipBox\ipBox\UserControl1.Designer.cs(36,18): 错误 CS0117: “ipBox.ipBox”并不包含“AutoScaleMode”的定义 --------------------编程问答-------------------- 你是怎么声明的?把代码贴出来看看 --------------------编程问答-------------------- using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace ipBox
{
public partial class ipBox : System.Windows.Forms.TextBox
{
public ipBox()
{
InitializeComponent();
}
private int digitPos = 0;
private int DelimitNumber = 0;
private void ipBox_KeyPress(object sender, KeyPressEventArgs e)
{
ipBox sd = (ipBox)sender;
sd.MaskIpAddr(e);
}
private void MastIpAddr(KeyPressEventArgs e)
{
int len = this.Text.Length;
int indx = this.Text.LastIndexOf(".");
if(this.SelectedText==this.Text)
{
indx=-1;
digitPos=0;
DelimitNumber=0;
}
if(Char.IsDigit(e.KeyChar)||e.KeyChar=='.'||e.KeyChar==8)
{
string tmp=this.Text;
if(e.KeyChar!=8)
{
if(e.KeyChar!='.')
{
if(indx>0)
digitPos=len-indx;
else
digitPos++;
}
if(digitPos==3&&e.KeyChar!='.')
{
string tmp2=this.Text.Substring(indx+1)+e.KeyChar;
if(Int32.Parse(tmp2)>255)//check validation
MessageBox.Show("The number can't be bigger than 255->"+tmp2);
else
{
if(DelimitNumber<3)
{
this.AppendText(e.KeyChar.ToString());
this.AppendText(".");
DelimitNumber++;
e.Handled=true;
}
}
}
else if(digitPos==4 && DelimitNumber<3)
this.AppendText(".");
}
else
{
e.Handled=false;
if((len-indx)==1)
{
DelimitNumber--;
if(indx>-1)
{
digitPos=len-indx;
}
else
digitPos--;
}
else
{
if(indx>-1)
digitPos=len-indx-1;
}
}
}
else
e.Handled = true;
}
}
}
这就是我写的代码?帮忙看看 --------------------编程问答-------------------- 高手们来帮我看看啊
补充:.NET技术 , C#