且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

移动角色雕文

更新时间:2023-11-22 23:02:40

" Mark" < Ma ** @ discuss.microsoft.com写信息

新闻:F9 ************************** ******** @ microsof t.com ...
"Mark" <Ma**@discussions.microsoft.comwrote in message
news:F9**********************************@microsof t.com...

我修改了鲍勃鲍威尔的C#应用​​程序移动图形

将屏幕上的原语放到Vb.NET 2005应用程序中。

我想修改这个应用程序,这样随着移动常规

的几何形状,我也可以移动字母数字字符为

。由于我通过实例学习得***,我为

字符编写了另一个类,但它不起作用。我问鲍勃鲍威尔和他

建议我将字符转换为字形并点击测试这些,

但是因为VB.NET只是对Visual Basic的重新平衡

编程语言只是名义上的我现在完全迷失了。
I modified a C# application from Bob Powell that moves graphics
primitives around on the screen into a Vb.NET 2005 application.
I want to modify this application so along with moving regular
geometric shapes, I can also move the alphanumeric characters as
well. Since I learn best by example I wrote another class for the
Characters, but it doesn''t work. I asked Bob Powell and he
suggested I convert the characters to glyphs and hit test these,
but since VB.NET''s only resembalance to the Visual Basic
programming language is in name only I''m now completely lost.



这很奇怪。我是一名VB6程序员,正在寻找某个地方转移到
,我被一些人告知,特别是在这个新闻组中有人叫做Bill

McCarthy,vb。 net确实与VB6兼容。

但你要说的是,VB.Net与Visual Basic的唯一相似之处

编程语言只是名义上的 ?你确定你对

这是正确的吗?想必你有一些vb.net编程经验?是不是你认为vb.net毕竟与VB6不兼容?比尔麦卡锡

说它是,而且我一直依赖他的建议。


迈克

That''s very strange. I am a VB6 programmer looking for somewhere to move to
and I am being told by a few people, specifically someone called Bill
McCarthy on this very newsgroup, that vb.net is indeed compatible with VB6.
But you are saying that, "VB.Net''s only resemblance to the Visual Basic
programming language is in name only"? Are you sure you are correct about
that? Presumably you have some experience with vb.net programming? Is it
your opinion that vb.net is not compatible with VB6 after all? Bill McCarthy
says that it is, and I have been relying on his advice.

Mike


Mark,


绘图是典型的Bob。所以你唯一的希望就是他看到了这个,或者你在他的主页上把他邮寄给他。


乍一看我什么也看不见你的代码有问题,但你可以通过设置一个断点而不是看看会发生什么来测试它自己更好。

http://www.bobpowell.net/


我看到他还有他的旧网站(很老的MVP标识)所以我不知道

这封电子邮件是有效的。


Cor


标记 < ma ** @ discussion.microsoft.comschreef in bericht

新闻:F9 ************************** ******** @ microsof t.com ...
Mark,

Drawing is typical Bob. So your only hope is that he sees this, or that you
mail him on his home page.

At first sight I don''t see any trouble in your code, but you can test it
yourself better by setting a breakpoint and than see what happens.

http://www.bobpowell.net/

I see he has still his old website (very old MVP logo) so I don''t know of
the email is valid.

Cor

"Mark" <Ma**@discussions.microsoft.comschreef in bericht
news:F9**********************************@microsof t.com...

>我修改了Bob Powell的C#应用​​程序移动图形基元

在屏幕上显示为Vb.NET 2005应用程序。我想修改这个

应用程序,以便移动常规几何形状,我也可以移动

字母数字字符。例如,我将屏幕上的字符A

放在屏幕上,当我用鼠标指向它时,字符将是

勾勒出来并按住鼠标左键,在屏幕上移动A



else。


自我通过实例学得***我为角色写了另一个课,

但是

它不起作用。我问过鲍勃鲍威尔,他建议我将

字符

转换成字形并点击测试这些,但是因为VB.NET只是对于
的重新平衡
Visual Basic编程语言只是名义上我现在完全迷失了。


这是我写的类:

Public Class DrawText

继承原语


Public Sub New()

MyBase.New()

End Sub


公共超载覆盖子绘制(ByVal g As Graphics)

Dim b As New SolidBrush(Me.Color)

Dim txt As String =" Aa"

''Dim big_font As New Font(" Times New Roman",30,

FontStyle.Bold)

''g.TextRenderingHint =

Drawing.Text.TextRenderingHint.AntiAliasGridFit

''g.DrawString(txt,big_font,Brushes.Black,10,100)


''g .FillRectangle(b,New Rectangle(Me.Location,Me.Size))

''b.Dispose()


''创建一个GraphicsPath

Dim graphics_path As New Drawing2D.GraphicsPath

''在路径中添加一些文字

graphics_path.AddString(txt,_

New FontFamily(Times New Roman),_

CInt(FontStyle.Bold),_

80,New Point(10,100),_

StringFormat.GenericTypographic)

g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

g.FillPath(Brushes.White,graphics_path )

g.DrawPath(New Pen(Drawing.Color.Black,3),graphics_path)

b.Dispose()

如果突出显示然后

Dim p As New Pen(Drawing.Color.Red ,3)

p.DashStyle = Drawing2D.DashStyle.DashDot

g.DrawRectangle(p,New Rectangle(Me.Location,Me.Size))

p.Dispose()

结束如果

结束子


公共过载覆盖函数HitTest(ByVal p As点)As

布尔

Dim pth As New Drawing2D.GraphicsPath()

pth.AddEllipse(新矩形(位置,大小))

Dim retval As Boolean = pth.IsVisible(p)

pth.Dispose()

返回retval

结束功能

结束课


有人能告诉我我做错了吗?

-

Mark
>I modified a C# application from Bob Powell that moves graphics primitives
around on the screen into a Vb.NET 2005 application. I want to modify this
application so along with moving regular geometric shapes, I can also move
the alphanumeric characters as well. For example I place the character "A"
on
the screen and when I point to it with the mouse the character will be
outlined and while holding down the left mouse button move the "A"
somewhere
else on the screen.

Since I learn best by example I wrote another class for the Characters,
but
it doesn''t work. I asked Bob Powell and he suggested I convert the
characters
to glyphs and hit test these, but since VB.NET''s only resembalance to the
Visual Basic programming language is in name only I''m now completely lost.

Here is the Class I wrote:
Public Class DrawText
Inherits Primitive

Public Sub New()
MyBase.New()
End Sub

Public Overloads Overrides Sub Draw(ByVal g As Graphics)
Dim b As New SolidBrush(Me.Color)
Dim txt As String = "Aa"
''Dim big_font As New Font("Times New Roman", 30,
FontStyle.Bold)
''g.TextRenderingHint =
Drawing.Text.TextRenderingHint.AntiAliasGridFit
''g.DrawString(txt, big_font, Brushes.Black, 10, 100)

''g.FillRectangle(b, New Rectangle(Me.Location, Me.Size))
''b.Dispose()

''Create a GraphicsPath
Dim graphics_path As New Drawing2D.GraphicsPath
''Add some text to the path
graphics_path.AddString(txt, _
New FontFamily("Times New Roman"), _
CInt(FontStyle.Bold), _
80, New Point(10, 100), _
StringFormat.GenericTypographic)

g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
g.FillPath(Brushes.White, graphics_path)
g.DrawPath(New Pen(Drawing.Color.Black, 3), graphics_path)
b.Dispose()
If Highlight Then
Dim p As New Pen(Drawing.Color.Red, 3)
p.DashStyle = Drawing2D.DashStyle.DashDot
g.DrawRectangle(p, New Rectangle(Me.Location, Me.Size))
p.Dispose()
End If
End Sub

Public Overloads Overrides Function HitTest(ByVal p As Point) As
Boolean
Dim pth As New Drawing2D.GraphicsPath()
pth.AddEllipse(New Rectangle(Location, Size))
Dim retval As Boolean = pth.IsVisible(p)
pth.Dispose()
Return retval
End Function
End Class

Can someone tell me what I''m doing wrong?
--
Mark


Mike,
Mike,

这很奇怪。我是一名VB6程序员,正在寻找一个可以移动

的地方,我被一些人告知,特别是在这个新闻组中有人叫做Bill

McCarthy,vb。 net确实与

VB6兼容。但是你说的是,VB.Net与Visual

基本编程语言的唯一相似之处仅在于名称?你确定你是对的吗

那个?大概你有一些vb.net编程的经验吗?

你认为vb.net毕竟与VB6不兼容吗?比尔

McCarthy说它是,而且我一直依赖他的建议。
That''s very strange. I am a VB6 programmer looking for somewhere to move
to and I am being told by a few people, specifically someone called Bill
McCarthy on this very newsgroup, that vb.net is indeed compatible with
VB6. But you are saying that, "VB.Net''s only resemblance to the Visual
Basic programming language is in name only"? Are you sure you are correct
about that? Presumably you have some experience with vb.net programming?
Is it your opinion that vb.net is not compatible with VB6 after all? Bill
McCarthy says that it is, and I have been relying on his advice.



Bill写的是非常正确的,VB7,VB7.1 VB8和VB9的语言几乎完全向上兼容VB6。


但是Visual Basic''98(1998)的工具非常不同,这个工具实际上对于Com来说是
(因为没有Net)。


Visual Basic 1998(编号为2002,2003 2005和2008,带有

不同版本)之后的工具是针对Net制作的,同时仍然可以使用

Com。但是,大多数使用Visual Basic''98提供的类都是

后一版本是Microsoft Visual Basic兼容的命名空间,其中
与Microsoft.VisualBasic命名空间不同来自

Net的官方命名空间,将来可能会消失。后者对于这个千禧年开始后的Visual Studio版本的处理也非常糟糕,而

有些类甚至都没有,例如FlexGrid,是在Visual Studio 2002-2008中使用的

犯罪


因此,当您编写程序语言VB6与VB.Net不兼容时

然后你要比较苹果和梨(这没有什么不对,因为

这是大多数错误的写法,包括我在内)。


工具Visual Basic''98与Visual Studio工具不兼容

,但是所有VB程序语言版本都非常向上

与所有兼容VB版本AFAIK从VB1开始。


我希望这可以清除你的误解。然而比尔在他的陈述中有我的

意见权。


Cor

What Bill writes is very true, the languages VB7, VB7.1 VB8 and VB9 are
almost completely upwards compatible with VB6.

However the tool Visual Basic ''98 (1998) is very much different, this tool
was in fact for Com (as there was no Net).

The tools after Visual Basic 1998 (numbered 2002, 2003 2005 and 2008 with
different versions) were made for Net, while it is still possible to use
Com. However most classes which are delivered with Visual Basic ''98 are in
the latter version im the Microsoft Visual Basic compatible namespace, which
is not like the Microsoft.VisualBasic namespace an official namespace from
Net and probably will disapear in future. The latter is also very bad to
handle in Visual Studio version behind the start of this millenium, while
some classes are not even in that, by instance the FlexGrid, which is a
crime to use in Visual Studio 2002-2008

So as you write that the program language VB6 is not compatible with VB.Net
then you are comparing apples and pears (Nothing wrong with that because
that is the way it is mostly incorrect written, including by me).

The tool Visual Basic ''98 is not compatible with the Visual Studio Tools
behind that, however all VB program language versions are very much upwards
compatible with all VB versions AFAIK starting at VB1.

I hope this clears your misunderstanding a little bit. However Bill is in my
opinion right with his statement.

Cor