如何让combobox只读

Gide 2003-09-15 11:03:49
如何不让combobox里的显示不能进行编辑,只能进行选择?
...全文
119 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lishu2002 2003-09-15
  • 打赏
  • 举报
回复
呵呵,看来知道的人不少,楼上的都是正确的!
newnewworm 2003-09-15
  • 打赏
  • 举报
回复
Style:=csDropDownList
limd 2003-09-15
  • 打赏
  • 举报
回复
Style := csDropDownList 呀
ysycrazy 2003-09-15
  • 打赏
  • 举报
回复
他的style := csdropdownlist or csOwnerDrawFixed or csOwnerDrawVariable
LSF1982 2003-09-15
  • 打赏
  • 举报
回复
Style
csDropDownList

来晚了
duxin 2003-09-15
  • 打赏
  • 举报
回复
Style属性--》csDropDownList
hongqi162 2003-09-15
  • 打赏
  • 举报
回复
设置Style属性csDropDownList
BES 2003-09-15
  • 打赏
  • 举报
回复
设属性 Style := csDropDownList;
private void Save2Excel() { //string file = "F:\\11\\ck.xlsx"; //string path = "F:\\11\\excel\\"; string time = DateTime.Now.ToString("yyyyMMdd"); string file = System.Windows.Forms.Application.StartupPath + "\\ck.xlsx"; string path = System.Windows.Forms.Application.StartupPath + "\\excel\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string saveName1 = path + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx"; excel = new CCExcel(file,saveName1); excel.Exceldata(); } private void textBox1_TextChanged(object sender, EventArgs e) { Form1.name = textBox1.Text.ToString(); } private void Form1_Load(object sender, EventArgs e) { comboBox1.Text = 11.ToString(); comboBox2.Text = 100.ToString(); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { Form1.comB1 = comboBox1.Text.ToString(); } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { Form1.comB2 = comboBox2.Text.ToString(); } } public class CCExcel { public Excel.Application appExcel; public Excel.Workbooks wbs; public Excel.Workbook wb; public Excel.Worksheets wss; public Excel.Worksheet ws; private string fileName; private string saveName; public CCExcel(string fileName,string saveName) { // //TODO: 在此处添加构造函数逻辑 // this.fileName = fileName; this.saveName = saveName; } public void Exceldata() { Create(); //Open(fileName); Data2Excel(); Save(saveName); //Save(wb,saveName); //appExcel.ActiveWorkbook.SaveCopyAs(fileName); //判断当前激活的表,并保存这个表。否则,保存时会弹出“是否保存Sheet1.xlsx”的对话框 wb.Close(Type.Missing, Type.Missing, Type.Missing); wbs.Close(); appExcel.Quit(); wb = null; wbs = null; appExcel = null; GC.Collect(); } private void Create()//创建一个Excel对象 { appExcel = new Excel.Application(); wbs = appExcel.Workbooks; wb = wbs.Add(true); //ws = (Excel.Worksheet)wb.ActiveSheet;//这是一个只读sheets集合 //Excel.Worksheet worksheet = wb.ActiveSheet as Excel.Worksheet;//这也是一个只读sheets集合 //Excel.Worksheet ws = (Worksheet)wb.Worksheets[1];//创建工作页sheet单页 ws = wb.Worksheets[1] as Worksheet; //第一个sheet页 ws.Name = "ck"; //这里修改sheet名称 } public void Open(string fileName) { appExcel = new Excel.Application(); wbs = appExcel.Workbooks; wb = wbs.Add(fileName); wb = wbs.Open(fileName,Type.Missing,Type.Missing,Type.Missing,Type.Missing, Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing, Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing); }

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧