|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB6 to VB.Net - Using X1,X2,Y1,Y2 in .Nettimes on Rentacoder because of various reasons... too difficult, wants more $, needs complete rewrite, and coder never got bit acceptance. The snippet below is a working example of a VB6 program. How would one do the below in VB.Net? Thanks for any help. [CODE] Option Explicit Private nPicMidX As Single Private nPicMidY As Single Private nPicWidth As Single Private nPicHeight As Single Private clickX As Single Private clickY As Single Private Sub Form_Load() With picImage(0) nPicMidX = .Width / 2 nPicMidY = .Height / 2 nPicWidth = .Width nPicHeight = .Height End With 'picImage(0) End Sub Private Sub Form_MouseDown(Button As Integer, _ Shift As Integer, _ X As Single, _ Y As Single) Dim SelectedImg As Integer FindImage X, Y moveImage SelectedImg, 0, 0 End Sub Private Sub moveImage(ImageIndex As Integer, _ ByVal DX As Single, _ ByVal DY As Single) Dim newTop As Single Dim newLeft As Single With picImage(ImageIndex) newTop = .Top + DY newLeft = .Left + DX .Top = newTop .Left = newLeft End With 'picImage(ImageIndex) moveImageLinks ImageIndex, newLeft + nPicMidX, newTop + nPicMidY End Sub Private Sub moveImageLinks(ByVal ImageIndex As Integer, _ ByVal newx As Single, _ ByVal newy As Single) If ImageIndex = 0 Then lineLink(0).X1 = newx lineLink(0).Y1 = newy Else lineLink(0).X2 = newx lineLink(0).Y2 = newy End If End Sub Private Sub picImage_MouseDown(Index As Integer, _ Button As Integer, _ Shift As Integer, _ X As Single, _ Y As Single) clickX = X clickY = Y End Sub Private Sub picImage_MouseMove(Index As Integer, _ Button As Integer, _ Shift As Integer, _ X As Single, _ Y As Single) If Button = 1 Then moveImage Index, X - clickX, Y - clickY End If End Sub Private Function FindImage(ByVal X As Single, _ ByVal Y As Single) As Integer Dim myImg As Variant For Each myImg In picImage If myImg.Left < X Then If ((myImg.Left + myImg.Width) > X) Then If myImg.Top < Y Then If ((myImg.Top + myImg.Height) > Y) Then FindImage = myImg.Index Exit Function End If End If End If End If Next myImg FindImage = 0 End Function [/CODE] "Y2K" <y2khi***@gmail.com> schrieb Have the wizard migrate it to a VB.Net project.> I'm hoping someone can lend a hand. I've now been turned down four > times on Rentacoder because of various reasons... too difficult, > wants more $, needs complete rewrite, and coder never got bit > acceptance. > > The snippet below is a working example of a VB6 program. How would > one > > do the below in VB.Net? See also: http://msdn.microsoft.com/library/en-us/vbcon/html/vboriIntroductionToVisualBasic70ForVisualBasicVeterans.asp in particular: http://msdn.microsoft.com/library/en-us/vbcon/html/vxconChangesToLineControlInVisualBasicNET.asp Armin I tried the built-in conversion, but it changes my line to a label.
I'll revisit that with 2005 (I used .Net 2003 previously). I'll also check the MSDN link. Thanks. "Y2K" <y2khi***@gmail.com> wrote in message Don't you wish the converter would >not< convert lines to labels? Geez. What news:1142286152.250742.209010@j33g2000cwa.googlegroups.com... >I tried the built-in conversion, but it changes my line to a label. > I'll revisit that with 2005 (I used .Net 2003 previously). I'll also > check the MSDN link. Thanks. a pain. If I wanted a label, I would've used one, eh? <g> The code to duplicate the functionality of a line control is what.... 5 or 6 lines? Probably fewer than the converter uses to convert a line control to a label in the first place. I can't imagine it taking a "team" of developers to say "just convert them all to labels. they should be happy with that". -- Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com Please keep all discussions in the groups.. On Mon, 13 Mar 2006 15:27:36 -0800, "Ken Halter"
<Ken_Halter@Use_Sparingly_Hotmail.com> wrote: >"Y2K" <y2khi***@gmail.com> wrote in message Kind of how VB6 handles the situation when it can't find a control>news:1142286152.250742.209010@j33g2000cwa.googlegroups.com... >>I tried the built-in conversion, but it changes my line to a label. >> I'll revisit that with 2005 (I used .Net 2003 previously). I'll also >> check the MSDN link. Thanks. > >Don't you wish the converter would >not< convert lines to labels? Geez. What >a pain. If I wanted a label, I would've used one, eh? <g> The code to >duplicate the functionality of a line control is what.... 5 or 6 lines? >Probably fewer than the converter uses to convert a line control to a label >in the first place. I can't imagine it taking a "team" of developers to say >"just convert them all to labels. they should be happy with that". that's been moved or deleted - it substitues a PictureBox as I recall. If I wanted a PictureBox, I would have used one. Regarding Lines: Me.Label1.Location = New System.Drawing.Point(10,10) Me.Label1.Size = New System.Drawing.Size(200, 1) Above produces a 200 pixel x 1 pixel line, starting at 10,10 and whose color is the the current backcolor of the label. Same can be done for a vertical line. If you need a diaganal line, then sorry, you'll have to use the Graphics.DrawLine method. That's the way it is. You can either go with what's available, or, stick with what you have, or find another alternative. That's just the way life is sometimes. This constant, cynical nitpicking serves no constructive purpose IMO. Gene Gene
Converted code
Bug with VS.NET inheriting from a control Urgent: VB.NET Code to Change Excel Worksheet Header/Footer Export Data to Excel VB.NET Automatic code typing features "ambiguous" problem with VB.NET 2005 ListView.SelectedItems.Clear if result = system.dbnull how to load a .csv file to a temporary table in sql 2000 load .csv data to a datagrid |
|||||||||||||||||||||||