Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / May 2008

Tip: Looking for answers? Try searching our database.

Moving character Glyphs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark - 05 May 2008 15:29 GMT
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?
Signature

Mark

Mike Williams - 10 May 2008 12:07 GMT
> I modified a C# application from Bob Powell that moves graphics
> primitives around on the screen into a Vb.NET 2005 application.
[quoted text clipped - 5 lines]
> but since VB.NET's only resembalance to the Visual Basic
> programming language is in name only I'm now completely lost.

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
Cor Ligthert[MVP] - 10 May 2008 16:42 GMT
Mike,

> 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
[quoted text clipped - 4 lines]
> 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.

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
Cor Ligthert[MVP] - 10 May 2008 17:52 GMT
Correction, the name of the tool was not Visual Basic 98 however Visual
Studio 6 (not VB6)

Cor

> Mike,
>
[quoted text clipped - 35 lines]
>
> Cor
Bill McCarthy - 10 May 2008 18:12 GMT
Actually it was named VB6, or at least the exe was.  But it was installed in
the VB98 folder by default.

> Correction, the name of the tool was not Visual Basic 98 however Visual
> Studio 6 (not VB6)
[quoted text clipped - 41 lines]
>>
>> Cor
Cor Ligthert[MVP] - 10 May 2008 19:29 GMT
Bill,

Because I was in doubt I took the old installation CD, on that was written
Visual Studio 6

Cor

> Actually it was named VB6, or at least the exe was.  But it was installed
> in the VB98 folder by default.
[quoted text clipped - 46 lines]
>>>
>>> Cor
Cor Ligthert[MVP] - 10 May 2008 19:30 GMT
Sorry,

You are right, that what I wrote in my last reply about was the tool
including C++, there were as well more limited versions.

Cor

> Correction, the name of the tool was not Visual Basic 98 however Visual
> Studio 6 (not VB6)
[quoted text clipped - 41 lines]
>>
>> Cor
Mark - 10 May 2008 23:12 GMT
Mike:
Please forgive me for that comment. I have used VB6 for quite awhile and
what I once could do easily in VB6 has now been complicated by VB.NET and the
dotnet framework.

--Mark

> > I modified a C# application from Bob Powell that moves graphics
> > primitives around on the screen into a Vb.NET 2005 application.
[quoted text clipped - 16 lines]
>
> Mike
Bill McCarthy - 11 May 2008 02:55 GMT
Post the code you would use in VB6

> Mike:
> Please forgive me for that comment. I have used VB6 for quite awhile and
[quoted text clipped - 27 lines]
>>
>> Mike
Al Reid - 12 May 2008 19:13 GMT
Signature

Al Reid

>
> > I modified a C# application from Bob Powell that moves graphics
[quoted text clipped - 17 lines]
>
> Mike

Vb.Net and VB6 are so similar that I find that switching between development on either one several times a day is easy, simple and
painless.  The language/syntax is, for the most part, identical.  It's just a matter of learning the .Net Framework.

YMMV
Signature

Al Reid

Cor Ligthert[MVP] - 10 May 2008 16:14 GMT
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

>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
[quoted text clipped - 65 lines]
>
> Can someone tell me what I'm doing wrong?
Mark - 10 May 2008 23:23 GMT
Cor:
I did write Bob Powell. HE was the one who suggested using glyphs. What I
don't understand is how I get VB.NET to recongnize that the character I'm
pointing too is a glyph. All fonts are basically glyphs, so if I point to a
character glyph I should be able to hit test it.
Signature

Mark

> Mark,
>
[quoted text clipped - 80 lines]
> >
> > Can someone tell me what I'm doing wrong?
Cor Ligthert[MVP] - 11 May 2008 08:29 GMT
Mark,

As Bob  not can tell you this, I am for sure not the best in helping you
with this.
Drawing is absolute not my favorite part of programming.

I only wanted you to supply the link to Bob his homepage.

Sorry,

Cor

> Cor:
> I did write Bob Powell. HE was the one who suggested using glyphs. What I
[quoted text clipped - 94 lines]
>> >
>> > Can someone tell me what I'm doing wrong?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.