-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Possible you have an outdated GDI+ dll? On XP and Vista, simply loading the image in reply #419 into the AIC, it displays properly. Saving it to file on both systems, the saved file displays properly when loaded into the AIC. I cannot reproduce your problem. Everything works just fine
For your info, the GDI+ version I have on my XP box is dated Oct 2010
Now if you are saying that some other program can't read the image correctly, but the AIC can, then the other program has a problem. If however, you are saying that after manipulating the image, it is saved as a black rectangle, then I think it would be helpful to see some of the code you use to change the image before saving it.
To prevent any confusion, please post an image that displays properly in a typical viewer but doesn't display correctly in the AIC.
Edited: Regarding v3 of the AIC. I think I'll have the save functions rewritten/debugged this week. Then I just need to test the control out against the sample projects to ensure I didn't foul something up during some of the rewrites. I probably did, just hope I can find most of them so you guys don't have to ;).
If all goes well, it'll be released within 1-2 weeks from today
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
Possible you have an outdated GDI+ dll?
doubt that...Like I tried to explain, this is NOT a bug. it is the way the image was crafted.
Quote:
Originally Posted by
LaVolpe
On XP and Vista, simply loading the image in reply #419 into the AIC, it displays properly. Saving it to file on both systems, the saved file displays properly
try to save the file as BMP, you'll understand what I am experimenting. As I have stated before though, this is not a bug with your component. This image is crafted in a special way to give that result. However, in order to deal with the way this image is crafted, I need to be able to change the color of the Transparency. To explain myself more properly, I made 2 images imageA.png has a RED transparency and imageB.png has a BLACK transparency (more common)
file can be found here:
http://vbnetmatrix.com/Download/Lavolpe/imageb.zip
This is the same method GIF use in order to make transparency. It take 1 color and set it as the transparent color. All pixel of that color are then transparent.
in png it work a little bit different but when applied, it is like each pixel with this color has opacity set to 0.
Quote:
Originally Posted by
LaVolpe
For your info, the GDI+ version I have on my XP box is dated Oct 2010
what file in particular should I look for ?
Quote:
Originally Posted by
LaVolpe
If however, you are saying that after manipulating the image, it is saved as a black rectangle, then I think it would be helpful to see some of the code you use to change the image before saving it.
Use the code I sent in post #418 and change Dest format to BMP. but again... this IS NOT A BUG. The result is the consequence of the way the file was crafted.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
VbNetMatrix
Use the code I sent in post #418 and change Dest format to BMP. but again... this IS NOT A BUG. The result is the consequence of the way the file was crafted.
It's a matter of understanding GDI+ limitations. The AIC will display it correctly after it has been saved to a BMP. But on XP, anyway, window's picture/fax viewer, MS Paint, & others may display it as a black rectangle when saved to bitmap. This is because GDI+ doesn't support 32 bpp alpha channel bitmaps. Not sure if Vista & Win7 versions of GDI+ have been fixed to provide that capability. With my AIC, I've known this for years and have custom routines to determine if the alpha channel is used and if so, how it is used.
a) all alpha values are 255 - the alpha channel exists but has no effect on the image
b) all alpha values are zero - the entire image is either transparent or app should treat it as all are 255
c) alpha value applies & the RGB components may or may not be premultiplied against the alpha values
-- read comments at bottom of sample code provided below.
-- regarding para b) above: In the rare case of a 100% transparent 32bit bitmap (not one pixel is opaque nor semi-opaque), then image is treated as if all alpha values are 255 not zero. A decision needed to be made & that was my decision
When an app does not support the alpha channel of bitmaps, then the channel is assumed to be all opaque. Since the image forecolor is black and the color of the transparent pixels are black, the image appears 100% black on software that doesn't properly read the bitmap format. Changing the color of the transparent pixels to say white would make the bitmap appear as black text over white background. However, this is WRONG. Even though the pixels are white, their opacity level is 0% -- fully transparent. It doesn't matter what color those pixels are, they should never be visible in a decent viewer; unless the viewer has options to render with/without the alpha channel
Note: PNG & GIF viewers handled these situations a bit differently when their formats were new to the world. Both have a special field in their format that identifies a background color. This bkg color would be used if the software displaying the PNG/GIF could not or would not render transparency.
Note: If some app is using the alpha channel to write their own information in it, then apps like mine are going to assume the alpha channel is used for the image, not for some custom values. In those cases, then the only apps that may display the image as intended is the one that created the custom values or apps that do not honor the alpha channel
Edited: Now to discuss changing colors of transparent pixels so they are not always black? This has no real advantage except for viewers that cannot properly recognize 32bpp bitmap formats using the alpha channel.
-- Not doable with GDI+ easily as far as I know. The problem is that when GDI+ sees 100% transparency, it always changes the pixel values to black when rendering. This means you can have an all-white image at 100% transparency. If you save it like that; no problem. But if you draw anything onto it then save it, GDI+ changes any remaining transparent white pixels, within the drawing area, to now be transparent black pixels
-- GDI+ won't let you create a blank image containing 100% transparent pixels other than black. If you try to create a GDI+ brush of any transparent color and fill the blank image, all transparency is changed to 0,0,0,0 regardless of the brush color
-- Here's a bit of proof
Code:
Option Explicit
Private Declare Function GdipGetImageGraphicsContext Lib "gdiplus.dll" (ByVal pImage As Long, ByRef graphics As Long) As Long
Private Declare Function GdipDeleteGraphics Lib "gdiplus.dll" (ByVal mGraphics As Long) As Long
Private Declare Function GdipCreateSolidFill Lib "gdiplus.dll" (ByVal mColor As Long, ByRef mBrush As Long) As Long
Private Declare Function GdipDeleteBrush Lib "gdiplus.dll" (ByVal mBrush As Long) As Long
Private Declare Function GdipFillRectangleI Lib "gdiplus.dll" (ByVal graphics As Long, ByVal brush As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Sub Command1_Click()
Dim SS As SAVESTRUCT, tImg As GDIpImage, bAlphas() As Byte
SS.Width = 256: SS.Height = 256
SS.ColorDepth = lvicConvert_TrueColor32bpp_ARGB
SS.RSS.FillColorARGB = ConvertRGBtoARGB(vbGreen, 0) ' transparent green
SS.RSS.FillColorUsed = True
Set tImg = New GDIpImage
' call function to create new bitmap. That function calls a GDI+ API that erases the bitmap
' with the passed color (transparent green). But you will see, all transparency ends up black
SavePictureGDIplus Nothing, tImg, lvicSaveAsBitmap, SS
SavePictureGDIplus tImg, App.Path & "\test1.bmp", lvicSaveAsBitmap
' now we'll use a solid green brush and change the alpha values to zero manually
SS.RSS.FillColorARGB = ConvertRGBtoARGB(vbGreen, 255) ' opaque green
SavePictureGDIplus Nothing, tImg, lvicSaveAsBitmap, SS
ReDim bAlphas(0 To CLng(SS.Width) * SS.Height - 1&) ' all zero values
tImg.AlphaMask bAlphas(), True ' change alpha values
Erase bAlphas()
SavePictureGDIplus tImg, App.Path & "\test2.bmp", lvicSaveAsBitmap
' sounds promising, no? Nope. Now if you draw anything onto this green transparent image using GDI+,
' any green transparency reverts to black transparency
Dim tIcon As GDIpImage, hGraphics As Long, hBrush As Long
Set tIcon = LoadPictureGDIplus(Me.Icon)
GdipGetImageGraphicsContext tImg.Handle, hGraphics
tIcon.Render 0&, , , , , , , , , , , hGraphics
' and for the fun of it, we'll create a transparent blue brush and fill part of the image with it
' but where it paints, it will be black not blue
GdipCreateSolidFill ConvertRGBtoARGB(vbBlue, 0), hBrush
GdipFillRectangleI hGraphics, hBrush, 128, 128, 96, 96
GdipDeleteBrush hBrush
GdipDeleteGraphics hGraphics
Set tIcon = Nothing
SavePictureGDIplus tImg, App.Path & "\test3.bmp", lvicSaveAsBitmap
' Loading the 3 test bitmaps into the AIC, you'll get these results:
' 1) all black transparent bmp: Image will appear 100% opaque black not transparent
' 2) all green transparent bmp: Image will appear 100% opaque green not transparent
' 3) green & black transparency with icon. Image will be 100% transparent except for the icon in top/left corner
' Why is 100% transparency in bitmaps 1 & 2 being shown as opaque? Simply because of the tie breaker rules
' my routines use when trying to determine alpha usage. The rules are simple enough:
' a) Any alpha values other than 0, then alpha is assumed in use & applied to the image
' b) If all alpha values are zero then either image is 100% transparent or alpha values are not used and image is 100% opaque
' -- since the AIC is designed to display images, the default tie breaker is: 100% opaque, not 100% transparent
' -- odds of seeing a 100% transparent 32bit bitmap are extremely rare, so assume it is not on purpose
End Sub
-- So, how does one change the transparent color in a bitmap? Pixel by pixel modifications. Prior to saving, one needs to loop thru the image bits and check for zero alpha values. Once found, change the RGB component of that pixel to the desired color
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
very interesting indeed.
about your conclusion, it was exactly what I had in mind... in fact right before I read your post, I already had an export of the file that I did pixel by pixel by modifying the alpha channel of thoses who were crafted in that special way.
thanks, I really learned a lot.
you're still the pro!
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi Lavolpe,
I found something you would be interested in.
a bug (that is easy to fix) that make your component completely crash inside the IDE.
here the process to REPRODUCE the bug from your side.
1. make a project, put a Lavolpe Component on the form.
2. add a BUTTON on the form (important)
3. add an image inside the component with the property page.
4. save and exit.
5. Open your project back,
6. open the property page of the lavolpe image.
7. Click browse to select a new image (DO NOT CHOOSE THE IMAGE YET)
8. Click on the form button... (the one you added)
the Lavolpe component will crash.
regards.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi again...
I got a little question about SaveControlAsDrawnToGDIpImage parameter...
I've tried to see the difference... but it seem in PNG there is no difference.
I can see difference if I export to BMP, there will be squared instead of stranparency while setting the parameter to True, will "emulate" the transparency color...
but in PNG, does it change anything ?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Regarding the error generated within the property page. Thanx and here's the fix which will be applied to the updated control when I post it later this month. FYI. Error was not generated in Vista.
Object: Property Page (ppgCustom)
Routine: cmdBrowse_Click
1. At very bottom of the event, add this
Code:
ExitRoutine:
If Err Then Err.Clear
2. In same event, find this line: If cBrowser.ShowOpen(PropertyPage.hWnd) Then
Just before that line, add this: On Error GoTo ExitRoutine
3. In same event, find this line: With cFolderBrowser
Just before that line, add this: On Error GoTo ExitRoutine
Ok, regarding your question about PNG and SaveControlAsDrawnToGDIpImage... Sorry I don't understand what you are asking.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I'm trying to load a lavolpe.picture into tImg (GDIpImage) and then modify SOME pixel and then save result back...
unfortunately, when I do that, I can SHOW on screen on another control the RESULT and it is Fine. but when I try to save that result to DISK, I got the original file unchanged.
as for SaveControlAsDrawnToGDIpImage, it does work but some pixel are slightly changed no matter what parameter I provide. And I wanted to know more about what that parameter was really doing.
but my main question is more "how I can save back to disk the picture I have modified" since it doesn't seem to work.
If instead of using a picture as source, I use a blank image and then copy pixel by pixel the "source" image and then add my modification, then SavePictureGDIplus work correctly...
in other word:
this work:
Set tImg = New GDIpImage
ss.Width = lavPicture.ScaleWidth
ss.Height = lavPicture.ScaleHeight
ss.ColorDepth = lvicConvert_TrueColor32bpp_ARGB
SavePictureGDIplus Nothing, tImg, , ss
... 'here pixel modification
SavePictureGDIplus tImg, App.Path & "\00.png", lvicSaveAsPNG, ss
This doesn't work:
Set tImg = lavPicture.picture
ss.Width = lavPicture.ScaleWidth
ss.Height = lavPicture.ScaleHeight
ss.ColorDepth = lvicConvert_TrueColor32bpp_ARGB
SavePictureGDIplus lavPicture.picture, tImg, , ss
... 'here pixel modification
SavePictureGDIplus tImg, App.Path & "\00.png", lvicSaveAsPNG, ss
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
When tImg has no image and you pass a SS to SavePictureGDIplus, you are telling the routines to create a new blank image of the requested bit/color depth: lvicConvert_TrueColor32bpp_ARGB
When tImg is a loaded picture and you call SavePictureGDIplus with a passed SS that contains a bit/color depth, it is possible that a conversion occurs in the save routines. That conversion may be what you are experiencing. You have no control over the conversion process
Try 1 of these:
1) set SS.ColorDepth = lvicNoColorReduction
Else one of these:
If the image in tImg is 32bpp then...
a) After loading the image into tImg, make tImg.KeepOriginalFormat to false. This converts tImg to a 32bpp bitmap format
b) change your pixel values, save image to PNG
If the image in tImg is not 32bpp or you are not sure, then...
a) save tImg with SS.ColorDepth as lvicConvert_TrueColor32bpp_ARGB as a bitmap format, not PNG
b) do your pixel modifications
c) now save to PNG as needed
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I never work with something lower then aPNG why settle for less when you can have no degradation, compression and alpha blending?! So, it's eitheir ICO or PNG for me ;)
I started with a working project on a BLANK image... then I changed:
SavePictureGDIplus Nothing, tImg, , SS
to
SavePictureGDIplus aicLine.Picture, tImg, , SS
(now not working)
then I tried solution #1 (before and after SavePictureGDIplus in 2 different try)
not working...
then I tried:
tImg.KeepOriginalFormat = false - as proposed
this work.
what are the implication ? what will it do to the image ? Should I expect weirdo reaction under some parameter ?
thanks
set SS.ColorDepth = lvicNoColorReduction
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
(read previous msg)
should I understood that SS is not required if I pass an image ?
SavePictureGDIplus aicLine.Picture, tImg
instead of
SavePictureGDIplus aicLine.Picture, tImg, , SS
will it take the SS struct from the image ?
I tried it, seem to work...
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Working with 32bpp bitmaps is ideal. All image formats (png, jpg, icon, etc) are reduced to bitmap when being displayed on screen. 32bpp bitmaps can have their bits accessed easily with GDI+. A 32bpp bitmap can be saved to any format that uses the alpha channel without any degradation. Regarding passing SS, it is not needed unless you want to change the image during saving. When not passed, all values are filled from the image, as necessary. PNG, TGA are formats that can compress most color depths without color loss. Other image formats may be limited to specific ranges of color depths before loss occurs
Exception: If saving to an image format that doesn't support the source image color depth, then loss of original data may apply. For example, GIF doesn't support 32bpp unless alpha values are either 0 or 255.
Note about saving. If passing a SS, then there is a chance that the image can be redrawn, depending on the SS structure values/settings. If the image is redrawn, then any transparent pixels will be reset to black transparency by GDI+.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
yeah I knew a lot about image format. I did an essay at university on them (and it's online too) but it is in french...
I speculate that in the long run, GIF and JPEG will vanish (for good)
ok, so in my case, SS is optional...
but what are the implication of the added line:
tImg.KeepOriginalFormat = false
wich make me able to SAVE the change to the real image.
does it imply more then just changing the pixel I have changed ?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
VbNetMatrix
but what are the implication of the added line:
tImg.KeepOriginalFormat = false
wich make me able to SAVE the change to the real image.
does it imply more then just changing the pixel I have changed ?
When that property is set to false, any cached data is thrown away and the image is reduced to a bitmap of equal color depth of the source. That property is intended to reduce memory consumption for loaded images. By default, loaded images keep their original source data (with few exceptions) and this can be seen as wasted memory use.
Unless the source image was a bitmap to begin with, resetting that property will result in the image being reported as PNG, but internally, the image will always be bitmap. Reading the comments at the the top of the GDIpImage class may be helpful
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
very interesting.
the cache thing is an interesting feature though, even if it can be seen as a waste of memory.
I didn't saw that KeepOriginalFormat in the documentation, I must have missed it.
thanks again
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi Lavolpe,
I remember once you told us that in order to preserve memory, we could use a technique if 2 button has the same image...
can't find the post :(
I thing it was
Set lavolpe1.picture = lavolpe2.picture
but was it all ?
sorry to make you repeat yourself.
edited: yes, right... sorry for that. I looked everywhere, I thought I read that not long ago!
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
VbNetMatrix
can't find the post :(
Post #3, 1st page ;)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
LaVolpe you're a Genius. I wonder if i could ever learn as much as you!
I Have a question tho my friend, I've been using AlphaImageControl 1.1.0 since quite a while, and i recently found out about this Great NEW VERSION!
However i'm trying to make a game like Pokemon with your control and it seems to lagg quite a bit with 1.1.0 ...
Please check this Out:
11 AlphaImagePictures Animated and moving.
http://img20.imageshack.us/img20/9757/battle2010.png
I'd like to know with all the implementations in this Newest version would it be Faster or slower to this kind of project if i use it instead of the old version 1.1.0 of your Alpha Image Control.
I really would appreciate your comment back. :wave: Greetings!
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi alanXp,
I see that your application rely on large image. Lavolpe component is no doubt the best for handling different image format, but like you, I have notice some problem with large image.
The fix I propose and use in my program is to use regular image/picture box component for image that doesn'T need to have alpha blending (transparency) .
Lavolpe (a few post back) showed me how to load a PNG into memory and then transfer it to a regular image/picturebox control.
I think the same effect could be used in your program by replacing the background image (zorder1) by a picture box.
I have used this technique on a game myself with a background png of 1280x768 without any lag effect using a simple Pentium 4 - 3.0ghz
I never tried the v1.1 Component and I'm using the latest version.
hope this help.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
that would be nice, all i would need is the PNG loaded with TRANSPARENCY. does it support transparency correct?
I'm trying to look for that post but i've got no luck
Thank you for Helping me man!
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi
reference to page 8, post #309
http://www.vbforums.com/showthread.php?t=630193&page=8
Not sure I explained myself properly.
What I was trying to say is:
1. use Normal image or picture box for the background as this doesn't require transparency,
2. use Lavolpe component for all other image that require transparency.
You'll achieve better speed that way as Lavolpe component is running a lot of subroutine in the background and (correct me Lavolpe if I'm wrong) Background image doesn't require all of what Lavolpe component is doing.
also I don't know your level of expertise in programmation, so ensure your subrountine is all fine tuned in order to use maximum speed. Use API as much as possible instead of low Vb6 class like PSET and such if you require them. I never saw a pokemon game, therefore I don't know what you're trying to achieve, but I once did a replica of Starcraft (not all the game, just the running 191 frames of the intro where you decide wich game type to choose)) with Lavolpe component, so I know the component can handle a lot of stress and action when used correctly.
I'm rather pretty busy right now but I'll do my best to answer your answer if you have any.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
ah, helping others is always good and very well rewarded, so i have my Background which is Already a PictureBox. Then The rest of the objects are LaVolpe's Alpha Image Control v1.0
So my Only Question is.... Moving to Alpha Image Control v2.0 will make things Smoothly or Slower?
What i use to move the images is a simple loop like this:
vb Code:
for i = 1 to max_frames
lavolpesaic.loadpicture = frame(i)
lavolpesaic.left = lavolpesaic.left + (i *10)
sleep 1
doevents
next i
Here is a Sample of the Controls from AIC i've used:
http://img526.imageshack.us/img526/5...visualbasi.jpg
Except that i move like 5 Lavolpes Image Controls a the same time, Resizing and Loading the Images.. All during the same Loop. That happends every time when the person gets into Battle.
I know this is pretty Basic, and everything seems to move slowly. What am i doing wrong? I apreciate your help here. :(
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Ok, now I understand it more.
first of all, I see in your code that you are using Doevents and Sleep.
this is a NO GO... for many reason. one of them is that you'll slow down your entire program.
you would be better to use a timer with a public variable to keep the frame number as reference instead of your for next loop.
Doevents is good when you have a LONG process and you want to be able to still click on button and do other thing. it is not recommended otherwise.
Sleep is to be avoided AT ALL cost, especialy in game.
during sleep, your program is locked up. and existing of sleep, it will have to take into account everything that happen while it was sleeping, including button clicking, mouse hover and all.
even if you sleep 1ms, you are still delaying a lot of thing you're not aware of. That's probably the main cause for your lag.
you're looking for something more like this:
Code:
Option Explicit
Public lngframeNo As Long
Private Sub Form_Load()
lngframeNo = 1
Timer1.Interval = 15 '(that's the maximum accurency of 98% of computer on the market) Raise it if it's too fast for you
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
lavolpesaic.LoadPicture = Frame(lngframeNo)
lavolpesaic.Left = lavolpesaic.Left + (lngframeNo * 10)
lngframeNo = lngframeNo + 1
If (lngframeNo > max_frames) Then
lngframeNo = 1
'Timer1.Enabled = False 'This line is optional. use it if your sequence END here, don't use it if it's perpetual moving sequence
End If
End Sub
hope that help.
oh... and if you need even more speed,
I would recommend an ARRAY of Lavolpe component and getting rid of loadpicture,
use visible or zorder instead.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi. LaVolpe
Your UnicodeFileDialog Class is very good for me.
But it has a little bug.
//Below Code
' returns/sets the filename the dialog starts with or returns
Public Property Get filename() As String
...
lLen = InStr(ofn.nFileOffset, ofn.lpstrFile, vbNullChar) - 1&
...
End Property
should be changed as below:
lLen = InStr(ofn.nFileOffset, ofn.lpstrFile, vbNullChar & vbNullChar) - 1&
otherwise, when select mult files, the filename will only return the path, not all the files's name.
Please see below link:
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
lpstrFile
Type: LPTSTR
The file name used to initialize the File Name edit control. The first character of this buffer must be NULL if initialization is not necessary. When the GetOpenFileName or GetSaveFileName function returns successfully, this buffer contains the drive designator, path, file name, and extension of the selected file.
If the OFN_ALLOWMULTISELECT flag is set and the user selects multiple files, the buffer contains the current directory followed by the file names of the selected files. For Explorer-style dialog boxes, the directory and file name strings are NULL separated, with an extra NULL character after the last file name. For old-style dialog boxes, the strings are space separated and the function uses short file names for file names with spaces. You can use the FindFirstFile function to convert between long and short file names. If the user selects only one file, the lpstrFile string does not have a separator between the path and file name.
If the buffer is too small, the function returns FALSE and the CommDlgExtendedError function returns FNERR_BUFFERTOOSMALL. In this case, the first two bytes of the lpstrFile buffer contain the required size, in bytes or characters.
Thanks!
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi Lavolpe
Thanks a lot for awesome codes.
I'm a just beginner.
I want to set the animated pics to work just 1 cycle(No loop).
I have tryed using the EndLoopOnFirstFrame function, but it doesn't work.
I don't know....
Would you please let me know how to solve it?
And I have one more question about that when I use the AlphaImgCtl1.Animate2.Stop function.
How to display the first frame of pics. I mean, get back to the first frame of pics.
Thanks a lot.
Private Sub command1_Click()
AlphaImgCtl1.Animate2.EndLoopOnFirstFrame = True
AlphaImgCtl1.Animate2.StartAnimation
End Sub
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
wham
Hi Lavolpe
I want to set the animated pics to work just 1 cycle(No loop).
I have tryed using the EndLoopOnFirstFrame function, but it doesn't work.
And I have one more question about that when I use the AlphaImgCtl1.Animate2.Stop function.
How to display the first frame of pics. I mean, get back to the first frame of pics.
End Sub
Hi Wham,
I think the EndLoopOnFirstFrame tell the component to STOP on the first frame AFTER it completed the cycle. Is that what you're trying to accomplish ? I'm not sure I understand your problem properly.
One more thing, are you using Animated Gif or Animated Png ?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
ok I found something...
it is not in the documentation per say but Lavolpe code is pretty well documented.
so here what we read in the EndLoopOnFirstFrame Code:
' default behavior is to have last frame displayed when animation terminates due to loop count met
' If desired to display 1st frame instead of last frame, set this property to true
and here what you have to do:
AlphaImgCtl1.Animate2.LoopCount = 1 'mean you only want one 1 LOOP of all frame of the image.
AlphaImgCtl1.Animate2.EndLoopOnFirstFrame = True 'mean that when loop end (it is now on LAST frame), it will display FIRST frame instead
AlphaImgCtl1.Animate2.StartAnimation 'do the magic..
hope that help.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
VbNetMatrix
ok I found something...
it is not in the documentation per say but Lavolpe code is pretty well documented.
so here what we read in the EndLoopOnFirstFrame Code:
' default behavior is to have last frame displayed when animation terminates due to loop count met
' If desired to display 1st frame instead of last frame, set this property to true
and here what you have to do:
AlphaImgCtl1.Animate2.LoopCount = 1 'mean you only want one 1 LOOP of all frame of the image.
AlphaImgCtl1.Animate2.EndLoopOnFirstFrame = True 'mean that when loop end (it is now on LAST frame), it will display FIRST frame instead
AlphaImgCtl1.Animate2.StartAnimation 'do the magic..
hope that help.
Hi VbNetMatrix,
Thank you so much!!!!
It works great!!!!:thumb::thumb::thumb:
Your answer is just what I was looking for.
Thanks again.
Thanks to your help, I can save my time.
I used the below codes. But I don't need it anymore.
Thank you!!!
Private Sub AlphaImgCtl1_AnimationFrameChanged(Frame As Long)
If AlphaImgCtl1.ImageCount = AlphaImgCtl1.Animate2.CurrentFrame Then
AlphaImgCtl1.Animate2.StopAnimation
AlphaImgCtl1.Animate2.MoveTo (1)
End If
End Sub
Private Sub AlphaImgCtl1_Click()
AlphaImgCtl1.Animate2.StartAnimation
End Sub
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I'm glad I could help.
Lavolpe is currently kind of very busy with the BIG NEW release he is preparing.
we will all enjoy the upcoming release of this excellent component.
take care.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Is there any reason why UserControl_OLEStartDrag doesn't raise the StartDrag event when set to Automatic?
Ideally I'd like to set some drag data when the drag starts.
Code:
'//// standard OLE event
Private Sub UserControl_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
Data.Clear
If Me.OLEDragMode = vbOLEDragAutomatic Then
If modCommon.SaveImage(m_Image, Data, lvicSaveAsCurrentFormat) Then
AllowedEffects = vbDropEffectCopy
Else
AllowedEffects = vbDropEffectNone
End If
Else
RaiseEvent OLEStartDrag(Data, AllowedEffects)
' if user doesn't set AllowedEffects, VB will cancel drag event
End If
End Sub
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Stidor
Is there any reason why UserControl_OLEStartDrag doesn't raise the StartDrag event when set to Automatic?
Ideally I'd like to set some drag data when the drag starts.
In order to answer your question, it would need to be more specific.
are you trying to drag lavolpe control over something else, or trying to drag another control onto Lavolpe control?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Onto another Lavolpe control.
I replaced standard pictureboxes - which used to fire the StartDrag event with the Lavolpe control which does not fire off the StartDrag event in OLEDrag automatic mode.
Just curious why?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I think the OLE Drag Start is for another purpose (with an external component).
you're trying to get to know when the drag even start.
use a boolean flag with a global variable and use the
DragOver event of the lavolpe component and you'll know when the Drag Start.
when the object is dropped, cancel your boolean flag.
tried here, work like a charm.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I downloaded the latest version from this topic when I was browsing the source.
This is from the control;
vb Code:
'//// standard OLE event
Private Sub UserControl_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
Data.Clear
If Me.OLEDragMode = vbOLEDragAutomatic Then
If modCommon.SaveImage(m_Image, Data, lvicSaveAsCurrentFormat) Then
AllowedEffects = vbDropEffectCopy
Else
AllowedEffects = vbDropEffectNone
End If
Else
RaiseEvent OLEStartDrag(Data, AllowedEffects)
' if user doesn't set AllowedEffects, VB will cancel drag event
End If
End Sub
As you can see, in Automatic mode StartDrag event is not fired
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
yeah I just check the code and that event is never fired in automatic mode...
it puzzle me a little but I'm not sure it is an issue. I think only Lavolpe can answer that one.
however, take a look at that link.
http://www.datadynamics.com/Help/Sha...ragMode7A.html
it explain the proper expected behavior.
I'm hoping Lavolpe could step in and explain us.
but as I said, you can use the workaround I explained early.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
This is somewhat related, and thought I'd be best asking here.
What's the possibility of somehow getting alpha images into a the listview control?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Wondering why Lavolpe not appearing on this thread for a long time. I wish him peace and health.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
same from my part... I really have a lot of admiration for that guy. He gave us a nice product.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I think he is busy developing new version of Alpha Image Control.
This new version will not be backward compatible!
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi, i have this LavolpeAlphaImage2 activeX control. what i want is to load a picture in it via common dialog during runtime. how can i possibly do this. kindly show me an example. thanks in advance :ehh:
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Did Anybody know how is Lavolpe doing? Has he changed a new job or was something happened?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi I use THis Control In mY form But When I want Print mY form By form.print this error whas show -----------> error 482 : printer error ? Why this Happen?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Try to use following code to load image.
Quote:
AlphaImageLib1.Picture = LoadPictureGDIplus("C:\MyTest.jpg")
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
can this control be used to replace the vb6 one
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi at all,
i found this control a fiew days ago, and it is a great one.
I tested it a fiew times, and i understand the most features.
My question is, is it possible to shape a form with this control? I have nothin found about it, and no idea to do this.
Sorry about my bad english! :-)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Frido
My question is, is it possible to shape a form with this control? I have nothin found about it, and no idea to do this.
No, it can't do that. However, you may want to check out How to Make a Round (Circular) Form and Here's How to Make a Form With a HOLE in it for possible solutions.
-
1 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
the image is always distorted when using "apply tolerance" with size reduction
with any output format
Attachment 105503
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi to all,
While searching for a alternate image control for MS Access (2010) I found this control. Looks great but I have issues using this ActiveX in MS Access. Would anyone post a sample Access DB to show how to use this control? I need this control to save/retrieve image from the database.
Thanks in advance.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
How to make this control above other controls. send to back, and send to front does not work
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
mleo1
How to make this control above other controls. send to back, and send to front does not work
You can't send it to front. It is a windowless control. It will always be behind other controls.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Cube8
You can't send it to front. It is a windowless control. It will always be behind other controls.
Or more precisely, the AlphaImgCtl UserControl can't be positioned on top of any non-graphical control (those with an hWnd property). You can, however, put the AlphaImgCtl in front of any graphical control (such as an Image, Label, Shape or other windowless UserControls) either during design time or at run time via the control's ZOrder method.
Quote:
Originally Posted by MSDN
Three graphical layers are associated with forms and containers. The back layer is the drawing space where the results of the graphics methods are displayed. Next is the middle layer where graphical objects and Label controls are displayed. The front layer is where all nongraphical controls like CommandButton, CheckBox, or ListBox are displayed. Anything contained in a layer closer to the front covers anything contained in the layer(s) behind it. ZOrder arranges objects only within the layer where the object is displayed.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Indeed. I just gave a simplified answer :)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
The IDE will not let me add the "fox" control to a form.
I get that "prohibet" icon when I hover above a form when the "fox" control is selected.
Any idea what I am doing wrong?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
well...
1. have you registered the component using Administrator privilege ?
2. make sure IE10 IS NOT installed. if you have installed it BEFORE upgrading to IE11, you need to uninstall IE11, then uninstall IE10, then install IE11 (if you really want IE11)
plz note that this only affect IDE and IE10 has no bad side effect on compiled program. as for myself, I kept IE9 on my Dev computer because it's the safest course of action.
Once IE11 is installed, OCA file are no longuer created (ocx transit file) and most OCX will require the file before compilation. Again, the problem only affect DEV machine, not the compiled result.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Bonnie West
Or more precisely, the AlphaImgCtl UserControl can't be positioned on top of any non-graphical control (those with an hWnd property). You can, however, put the AlphaImgCtl in front of any graphical control (such as an Image, Label, Shape or other windowless UserControls) either during design time or at run time via the control's
ZOrder method.
I haven't played with the control, but I would imagine you could put the control in a panel (or picturebox even), and then adjust the zorder of the container. But, that might defeat the purpose of the control, since the background of the container would be visible and that may be undesirable.
I should probably read the whole thread, and try the control before commenting, but then I'll probably not get around to it.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Thanks for your answer. Been using VB6 for a long time. Never registered a component before. Can you tell me how? I googled and did not find much. Thanks!
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Wow! I got it running. Now comes the big question:
How to add a shadow to the image.
I have seen La Volpe's work before with PNGs and have seen a shadow effect on some examples.
Any advice would be welcome.
David
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Why don't you start a new thread instead of posting in an old codebank thread?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi!
I don't know if anyone is still using this wonderful activex control. I've made a few enhacements but i stumbled on a little bug. When i resize the control in a secondary display (monitor) using windows extended desktop to full screen size it does not work properly. Since my debug pc has not a secondary display adapter so as to debug the ocx i was wondering if anyone noticed this too. And if so can help me out of this situation.
Any help would be apreciated.
Thanks!