tiyaoli 发表于 2009-2-22 09:04:00

[求助]如何把颜色对话框中选择的颜色值转换为图层颜色能识别的颜色值

如题,也就是说如何统一两种类型的颜色?<br/>我是这样做的:先把颜色对话框选择的颜色赋给ComboBox列表框的背景色,然后把该背景色赋给图层的颜色<br/>If lt.Has(Me.TBoxZDHtcm.Text) Then<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;LayerID = lt(Me.TBoxZDHtcm.Text)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Else<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Dim ltr As LayerTableRecord = New LayerTableRecord<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;ltr.Name = Me.TBoxZDHtcm.Text<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;ltr.Color = Autodesk.AutoCAD.Colors.Color.FromColor(Me.CBoxZDHys.BackColor)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;LayerID = lt.Add(ltr)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;trans.AddNewlyCreatedDBObject(ltr, True)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;End If<br/>编译没有错,可是运行时提示无法识别的文本!请求大家帮忙怎么做

tiyaoli 发表于 2009-2-22 22:56:00

如果直接写出这样:<br/>ltr.Color = Me.ColorDialog1.Color<br/>提示错误:<br/>类型“System.Drawing.Color”的值无法转换为“Autodesk.AutoCAD.Colors.Color”<br/>现在就是想知道如何相互转换这两种颜色
页: [1]
查看完整版本: [求助]如何把颜色对话框中选择的颜色值转换为图层颜色能识别的颜色值