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 展开
'(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 展开
展开全部
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
}
{
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
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询