Hello ,
Im trying to have it so when you pick t-shirt 29m in the combobox it displays a picture in a canvas. i can get it to display the picture only once and if i try and change it to Long Sleeve 29m it keeps the old picture there still. I’m not sure how to clear everything in the canvas to display the new image. kinda stuck atm. Here is what i have .
I have a Property named Front29M_S as Picture and the others are named to correspond with each picture.
Next i have in the Canvas paint event to handle resizing the image.
[quote] Dim scaleX, scaleY, scale as Double
Dim theLeft, theTop as integer
if Front29M_S <> nil then //Logo is a property that has been added to the window
if Front29M_S.width <= canvas5.width and Front29M_S.height <= canvas5.height then //if pic is smaller than the canvas
theLeft = (canvas5.width - Front29M_S.width)/2 //center the image horizontally
theTop = (canvas5.height - Front29M_S.height)/2 //center the image vertically
g.DrawPicture Front29M_S, theLeft, theTop
else
scaleX = canvas5.width / Front29M_S.width
scaleY = canvas5.height / Front29m_S.height
scale = Min( scaleX, scaleY ) //choose the smaller value
theLeft = (canvas5.width - (Front29M_S.widthscale))/2 //center the image horizontally
theTop = (canvas5.height - (Front29M_S.heightscale))/2 //center the image vertically
g.DrawPicture Front29M_S, theLeft, theTop, Front29M_S.width * scale, Front29M_S.height * scale, 0, 0, Front29M_S.width, Front29M_S.height
end if
end if
[/quote]
In my Combobox Change event i have the following which doesn’t work correctly . once you pick an item it won’t change to another picture.
[quote] Dim Front29M_File as FolderItem
Dim Front996_File as FolderItem
Dim FrontCrew562_File as FolderItem
Dim Front29M_LS_File as FolderItem
Front29M_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/Front29M_S.png", FolderItem.PathTypeShell)
Front996_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/Front996_S.png", FolderItem.PathTypeShell)
FrontCrew562_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/FrontCrew562_S.png", FolderItem.PathTypeShell)
Front29M_LS_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/Front29M_LS_S.png", Folderitem.PathTypeShell)
if Front29M_File <> nil and me.text = “T-Shirt 29M” then
Front29M_S = Front29M_File.OpenAsPicture //Uses the T-Shirt Picture and adds to window
if Front29M_S <> nil then
canvas5.refresh //forces the canvas to display the scaled image
elseif Front996_File <> nil and me.text =“Hoodie 996” then
Front996_H = Front996_File.OpenAsPicture // Uses the Hoodie Picture and adds to window
if Front996_H <> nil then
Canvas5.EraseBackground = true
Canvas5.Refresh //forces the canvas to display the scaled image
elseif Front29M_LS_File <> nil and me.text = “Long Sleeve 29LS” then
Front29M_LS = Front29M_LS_File.OpenAsPicture // Uses the LongSleeve Picture and adds to window
if Front29M_LS <> nil then
Canvas5.Refresh //forces the canvas to display the scaled image
elseif FrontCrew562_File <> nil and me.text = “Crew Neck Sweat Shirt 562” then
FrontCrew562 = FrontCrew562_File.OpenAsPicture // Uses the Crew Neck Sweat Shirt Picture and adds to window
if FrontCrew562 <> nil then
Canvas5.Refresh //forces the canvas to display the scaled image
end if
end if
end if
end if
end if
Dim Back29M_File as FolderItem
Dim Back996_File as FolderItem
Dim BackCrew562_File as FolderItem
Dim Back29M_LS_File as FolderItem
Back29M_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/Back29M_S.png", FolderItem.PathTypeShell)
Back996_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/Back996_S.png", FolderItem.PathTypeShell)
BackCrew562_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/BackCrew562_S.png", FolderItem.PathTypeShell)
Back29M_LS_File = GetFolderItem("/Users/tracynolte/Documents/InvoiceProgram/img/Garments/Back29M_LS_S.png", Folderitem.PathTypeShell)
if Back29M_File <> nil and me.text = “T-Shirt 29M” then
Back29M_S = Back29M_File.OpenAsPicture //Uses the T-Shirt Picture and adds to window
if Back29M_S <> nil then
canvas6.refresh //forces the canvas to display the scaled image
elseif Back996_File <> nil and me.text =“Hoodie 996” then
Back996_H = Back996_File.OpenAsPicture // Uses the Hoodie Picture and adds to window
if Back996_H <> nil then
Canvas6.Refresh
elseif Back29M_LS_File <> nil and me.text = “Long Sleeve 29LS” then
Back29M_LS = Back29M_LS_File.OpenAsPicture // Uses the LongSleeve Picture and adds to window
if Back29M_LS <> nil then
Canvas6.Refresh
elseif BackCrew562_File <> nil and me.text = “Crew Neck Sweat Shirt 562” then
BackCrew562 = BackCrew562_File.OpenAsPicture // Uses the Crew Neck Sweat Shirt Picture and adds to window
if BackCrew562 <> nil then
Canvas6.Refresh
end if
end if
end if
end if
end if
[/quote]
any ideas.
P.S. im a visual learner so can you show me an example or idea.