You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Steve

Unregistered

1

Saturday, January 10th 2009, 6:01pm

PictureX.Line... How to do it in Jabaco?

Hi. I've been seeing how easy/difficult it has been to port some of my simpler VB5 programs over to Jabaco.

One area of difficulty has been the XXXXX.Line command. In VB5, it is typically...

XXXXX.Line (x1,y1)-(x2,y2), RGB(a,b,c), bf [Example: Picture1.Line (10,20)-(100,200), RGB(120,46,255), BF]

As I've come to understand it, Jabaco has a different format. It is...

XXXXX.Line (x1,y1,x2,y2,[Rect as Boolean], [Long Variable as Color])

Has anyone had sufficient success with understanding what the "[Rect as Boolean]" & "[Long Variable as Color]" parts are? I would be interested in knowing so that I could adapt my programs & their future variants accordingly.

Despite these difficulties, I am finding the Jabaco program very pleasing & definitely would like to see it continue to be supported. Thank you.

JCato

Beginner

  • "JCato" is male

Posts: 4

Date of registration: Jan 3rd 2009

Location: Meridian, MS USA

Occupation: Manager

Hobbies: Martial Arts

  • Send private message

2

Thursday, January 15th 2009, 5:36am

Picturebox line

The following code will draw a rectangle in picture1 (the picturebox). Use the boolean value true for rect to draw a rectangle, or use false to draw a line. The forecolor of the picturebox will be the color of the line. You can use the RGB function to obtain the long value for the color you are wanting to fill your rectangle with or you can use a common dialog box ( :thumbup: ). Hope this helps and good luck.

Global TempX As Long
Global TempY As Long

Public Sub ChooseFontColor()
' The following code will set the color of the line you are going to draw in the picturebox.
Dim e As New CommonDialog
e.DialogTitle = "Choose the Font Color"
e.ShowColor
Picture1.ForeColor = e.color
End Sub

Public Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Get the line's start point.
TempX = X
TempY = Y
End Sub

Public Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Get the line's end point and draw it.
' Use the RGB function as a temporary measure to obtain a long value fill color for the rectangle.

Picture1.Line(TempX,TempY,X,Y,True,RGB(100,100,100))

End Sub


PS: Use the SavePicture function to save what you've created.

Public Sub SavePicturebox()
Dim DC As New CommonDialog
DC.DialogTitle("Save Picture As:")
DC.showSave
If DC.FileName = "" Then
Msgbox "File was not saved: No file name provided"
Else
SavePicture (Picture1.Image, DC.FileName)
End If

End Sub

Rate this thread
WoltLab Burning Board