VBA代码转换C#

'画点'(x1,y1)是圆点的圆心,r是圆点的半径'PublicFunctionDrawDot(ByValx1AsDouble,ByValy1AsDouble,Optio... '画点
'(x1,y1)是圆点的圆心,r是圆点的半径
'
Public Function DrawDot(ByVal x1 As Double, ByVal y1 As Double, Optional ByVal r As Double = 1) As Object
Dim TempX As Double
Dim TempY As Double
Dim TempR As Double

TempX = Ox + (x1 * 10)
TempY = Oy - (y1 * 10)
TempR = r * 10
DialogDisplay = False
If (TempX - TempR < Ox - Lx / 2) Or (TempX + TempR > Ox + Lx / 2) Or (TempY - TempR < Oy - Ly / 2) Or (TempY + TempR > Oy + Ly / 2) Then
' DialogMsg = "超出了边界!请重新输入!"
' DialogType = "vbExclamation"
DialogDisplay = True
' DialogOk.Show
MsgBox "超出了边界!", vbExclamation + vbOKOnly, "提示"
DrawFlag = False
Exit Function
End If

Set DrawDot = ActiveDocument.Shapes.AddShape(msoShapeOval, TempX - TempR, TempY - TempR, 2 * TempR, 2 * TempR)
DrawDot.Fill.ForeColor = RGB(0, 0, 0)
DrawFlag = True
End Function
展开
 我来答
careff
2009-04-24 · 超过10用户采纳过TA的回答
知道答主
回答量:40
采纳率:0%
帮助的人:30.4万
展开全部
public object DrawDot(Double x1,Double y1 ,Double r )
{
bool DialogDisplay, DrawFlag;
Double TempX, Tempy, TempR;
TempX = Ox + (x1 * 10) ;
TempY = Oy - (y1 * 10) ;
TempR = r * 10;
DialogDisplay = False;
if((TempX - TempR < Ox - Lx / 2) || (TempX + TempR > Ox + Lx / 2) || (TempY - TempR < Oy - Ly / 2) || (TempY + TempR > Oy + Ly / 2))
{
DialogDisplay = True ;
MessageBox.Show("超出了边界!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
DrawFlag = False;
return ;
}

//不知道你用的是什么?
//Set DrawDot = ActiveDocument.Shapes.AddShape(msoShapeOval, TempX - TempR, TempY - TempR, 2 * TempR, 2 * TempR)
//DrawDot.Fill.ForeColor = RGB(0, 0, 0)
//DrawFlag = True
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式