Hallo liebes Forum,
um ein bestimmtes Control abzurunden, benutze ich in Visual Basic.NET folgenden Code:
Mit dem Converter von DeveloperFusion bekomme ich folgenden Code in C#/CSharp:
Nur ich bekomme bei ObjForm.region = new System.Drawing.Region(gp);, folgenden Fehler:
Die Verweise:
Kann mir kurz jemand erklären wie ich dies abändern kann bzw. was falsch ist? Habt Ihr einen Link oder einen Denkanstoß?
Gruß,
Jan
um ein bestimmtes Control abzurunden, benutze ich in Visual Basic.NET folgenden Code:
Visual Basic-Quellcode
- Private Sub Round(ByVal ObjForm As Object, ByVal iX As Integer, ByVal iY As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer, ByVal iRadius As Integer)
- Dim gp As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath()
- gp.AddLine(iX + iRadius, iY, iX + Width - iRadius, iY)
- gp.AddArc(iX + Width - iRadius, iY, iRadius, iRadius, 270, 90)
- gp.AddLine(iX + Width, iY + iRadius, iX + iWidth, iY + iHeight - iRadius)
- gp.AddArc(iX + Width - iRadius, iY + Height - iRadius, iRadius, iRadius, 0, 90)
- gp.AddLine(iX + iWidth - iRadius, iY + iHeight, iX + iRadius, iY + iHeight)
- gp.AddArc(iX, iY + iHeight - iRadius, iRadius, iRadius, 90, 90)
- gp.AddLine(iX, iY + Height - iRadius, iX, iY + iRadius)
- gp.AddArc(iX, iY, iRadius, iRadius, 180, 90)
- gp.CloseFigure()
- ObjForm.region = New System.Drawing.Region(gp)
- gp.Dispose()
- End Sub
Mit dem Converter von DeveloperFusion bekomme ich folgenden Code in C#/CSharp:
C#-Quellcode
- private void Round(object ObjForm, int iX, int iY, int iWidth, int iHeight, int iRadius)
- {
- System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
- gp.AddLine(iX + iRadius, iY, iX + Width - iRadius, iY);
- gp.AddArc(iX + Width - iRadius, iY, iRadius, iRadius, 270, 90);
- gp.AddLine(iX + Width, iY + iRadius, iX + iWidth, iY + iHeight - iRadius);
- gp.AddArc(iX + Width - iRadius, iY + Height - iRadius, iRadius, iRadius, 0, 90);
- gp.AddLine(iX + iWidth - iRadius, iY + iHeight, iX + iRadius, iY + iHeight);
- gp.AddArc(iX, iY + iHeight - iRadius, iRadius, iRadius, 90, 90);
- gp.AddLine(iX, iY + Height - iRadius, iX, iY + iRadius);
- gp.AddArc(iX, iY, iRadius, iRadius, 180, 90);
- gp.CloseFigure();
- ObjForm.region = new System.Drawing.Region(gp);
- gp.Dispose();
- }
Nur ich bekomme bei ObjForm.region = new System.Drawing.Region(gp);, folgenden Fehler:
Microsoft Visual C# Express 2010 schrieb:
Fehler 2 "object" enthält keine Definition für "region", und es konnte keine Erweiterungsmethode "region" gefunden werden, die ein erstes Argument vom Typ "object" akzeptiert. (Fehlt eine Using-Direktive oder ein Assemblyverweis?)
Die Verweise:
Kann mir kurz jemand erklären wie ich dies abändern kann bzw. was falsch ist? Habt Ihr einen Link oder einen Denkanstoß?
Gruß,
Jan
Software being "Done" is like lawn being "Mowed". (Jim Benson)