Results for "Author: lavolpe"
Create a cool 3D shape from a 2D region. See screenshot which pretty much says it all. The direction of the 3D shape is hardcoded at 45deg angles. If you choose, you can modify to allow any angle. Updated to include sample of blt'ing an image over the plain shape.
27 shaped regions from 3 functions can be used for custom buttons, windows or whatever. The logic used is pretty easy to follow so you can create even more shapes & add them to your collection. Also included is a simple but effective routine to add 3D-ish border to those shapes & could be used to apply borders to most custom shapes. A what-if project that took off but really can't use the code for anything right now -- hope you can find a good home for it :) Updated to include right triangles & showing a digitial timer as a practical example of using regions for drawing.
A compilation of region functions & examples. Included is probably the fastest window shaping routine on PSC. Regions used to create shaped windows, regions used for simple animation, rotating & stretching regions, and using regions similar to FloodFill are examples shown. All are heavily commented to assist in learning.
It appears this VB function can easily replace APIs like BitBlt, StretchBlt, DrawIconEx and others. So how do you use this function that no one seems to use? Included are a few ideas and "how to's". Hoping others more knowledgeable will add positive comments so others can learn too. Zip updated to include sample of portion Rendering. No BitBlt API used at all in examples.
Single class module, plug & play. Maybe the last color selector you will ever use? Lots of options & will list most of them here: 1) 3 palettes to choose from, 2) palette tabs can be disabled, 3) grab color from anywhere on screen, 4) fail-safe mode will display std color dialog if routines fail, 5) mouse wheel support, 6) prevent non-palette selections, 7) auto-convert negative sys colors to positive values, 8)add custom colors & personal colors to the default palette or replace completely, 9) easy window placement, 10) even more options. Heavily documented, jump to end of the module for a detailed description of options & their settings. 22Feb06 - Converted to a stand-alone, single class. 26Feb06: Keybd navigation. Now movable. 30Mar06: Reworked to make Win9x-safe & make more MDI-friendly. 31Mar06: Changed memory APIs used to help prevent XP DEP warnings & addressed the error messages being reported that are not errors rather a result of VB IDE settings. 4 Apr. Prev repost broke ability to select listbox items; fixed. 10 Nov 06: listboxes didn't scroll down w/mousewheel, played with XP Manifests to replicate reported issues w/some luck. 11Nov06: running out of bugs... patch minor keybd navigation issues, add layered window support, patch MDI parent losing active titlebar when common color dialog closes. See change history in module if interested.
Rotating captions are hard but doable. Keeping track of an accelerator key is complicated. This example has portable routines to rotate captions at 90 or 270 degrees & properly display the underscore on the hot key. In addition, you dictate where text is displayed by passing the bounding parameters. This will be used for a soon-2b-released vertical version of my buttons, so if you see errors, please let me know. Thanx.
Small updates & converted to Class Module. Maybe usercontrol writers might find this useful; other than that? The attached code is a bunch of memory manipulation to convert/serialize any dimension array into a single dimensioned byte array, primarily for storage into a property bag. The routines also convert that single dimensional byte array back into the same mulitdimensional array it came from; maintaining all array attributes. I would think good knowledge of how various data types are stored by VB would be needed to fully understand the code. P.S. No screenshot because there really is nothing to show - 1 button. 13Dec06::Patched. Logic to determine if a passed string array contained fixed or variable length strings was incorrect.
Updatd to fix 2 logic errors. Enclosed is a suite of classes that allow you to work strictly with 32bpp DIBs, including recognizing transparency/alpha channels in gifs, icons, pngs, tga & bitmaps. There are a bunch of "nice to have" routines and maybe an eye-opener or two for some of you. The classes are heavily commented. 18Feb08. Added text support & tiling. 9Mar08: Added TGA read/write, save as JPG, added Paul Caton's revised CDECL thunks for safer zlib usage, updated sample form. Review Change History in the RTF file for important notes & overview of class functions/properties. Most recent changes: Manually parsing grayscale PNGs can fail to correctly parse transparency, and the icon parser could fail to recognize some transparency in the icon mask.
Updated: See end of description for change... A hybrid collection class that kind of combines a TreeView collection (nodes and heirarchy) and the standard VB collection object. Supports arrays, objects & classes. The project exposes over 30 methods/properties to assist in managing the collection. It even has the ability of persisting the collection. Please play and offer suggestions and report bugs. Don't forget to review the RTF document included. 7Dec06::Added SortCollection & IndexFromKeyIndex routines. AddItem,MoveItem now allow sorting too. 14Dec06: Overhauled array serialization. Now supports all arrays, even supports nested variant arrays. Only user intervention would be serialization of your objects, if applicable. Added another test form to test Variant Arrays. 15Dec06::Reference counts on deserialized objects were not always correct. Fixed. 17Dec06: Added support to save stdPic/stdFont objects too. Final version, barring bugs/enhancements.
Now that we are getting into the age of alphablending, PNGs, etc, wouldn't it be nice to offer ability to display 32bpp alpha bitmaps without having to know in advance if it indeed uses the alpha channel or whether or not the bitmap has its RGB bytes pre-multiplied? Try this out. It is a simple project wrapped around a routine that attempts to let you know those things a runtime. The project has some tips, shows a simple way to use AlphaBlend with non-premultiplied bitmaps and an pretty effective way to use GDI+ with 32bpp alpha bitmaps. Two test images are included in the RES file, but other than that, happing hunting for 32bpp alpha bitmaps, unless you care to create your own like I did for this test project.
Want to compare 2 same-size bitmaps for equality? Want to compare 2 arrays for equality (even if arrays are different VarTypes)? NT-based systems have RTLCompareMemory, C has MemCmp. Win9x is reduced to byte by byte loops, more or less. This twist on that loop process comes really close to matching the speed of the two aforementioned API functions and can be used in every O/S. Thought I could use this for a project of mine, but the requirement went away. Compile the project for true tests (IDE is always slower). As always, stuffed with lots of comments.
Not really transparent, but a "fun" project using a transparent usercontrol (UC) that acts as a proxy for a picturebox. The UC prevents need for subclassing. It gets paint events from the Form and the UC then updates the picturebox. In short, a niffty little hack to make a picturebox appear transparent. Think some of you might like this & it is quite simple too. Feel free to expand on the idea.
As I move closer to acquiring XP and also moving towards .Net, I came across these two pages on MSDN. One page is a free, softcopy book converting VB6 to .Net & the other actually pertains to VB6 and Vista. I found them worthwhile, and you might too.
An extremely resource friendly, unique approach to viewing animated GIFs. Draw to any DC (no need for transparent usercontrols, timers). Self-contained class creates own timer, back buffer for flicker free drawing, and parses/renders animation frames. This new approach uses just 2 GDI objects per GIF, regardless how many frames it may have. It uses 0 to 3 more GDI objects for flicker-free drawing depending on animation settings and target DC contents. Well commented. Recommended improvements welcomed. This is not a GIF editor. ======================================= 5Aug06: Patched to address: Clearing solid bkg would overpaint 1 pixel width & height. Refreshing scaled single frame GIF could rescale from scaled dimensions & not original dimensions. Offscreen DC could be created (wasted resource) when not needed. 26Fe07. Added ability to quick-render 1st frame of GIF. Previously, ppl said they didn't like the delay between loading & displaying image.
Edited to expand comments & samples: Just one of many ways to check for previous instances across processes, that can also pass command line parameters used to start another instance. By now, many of you realize that App.PrevInstance doesn't work all the time. This version is a non-subclassing approach, a subclassing approach may be slightly cleaner. Compile sample project and test.
Ever want to change the textbox, listbox, and other common control border colors to something besides grayscale? The attached is one solution using Paul Caton's safe subclassing technique. The project was started for someone else that couldn't use it as is, so I posted it per his recommendation. It has limitations, but might be something worth playing with or maybe even using. Added & tested a few more controls, cleaned up remarks/unused code.
Desktop subclassing with VB. An icon uber-tweaker. FINAL CUT barring bugs. Per-Icon color & caption settings transforms a blah desktop to something pretty nice. Other options and tools are included with the project. =========================== This project put together to highlight the flexibility of VB. The effects are accomplished by subclassing the desktop. The DLL used to subclass the desktop is created in VB, the DLL used for injection into the desktop (global hooking) is the same DLL. =========================== Well, I can't upload compiled DLLs on PSC, you will have to compile the hybrid DLL yourself. I have included instructions on 2 ways to accomplish this: an easy way & the hard way (my way). Unzip the file using "Use Folders" option because this is 3 projects in one. =========================== Updates: 15May05::Fix issues reported by Steve and others; DLL was not coloring text & was result of DLL typo. 17May05::added save/restore/un-restore icon positions, tweaked GUI, & enabled removal of injected DLL. 17May05::found/fixed bug that can crash when items sent to recycle bin. InstallDLL function now does version check before install. Fixed losing saved icon positions on startup & ability to toggle AutoArrange on NT & 9x. 20May05::Reworked RebuildListView to prevent NT icons from unrestoring in some cases, added more options, tweaked GUI. 24May05:: Fixed auto-icon restore after display res change & a couple minor bugs. ======================= Always destroy your previous version of this project & run the TxtToBin to create compiled DLLs or compile them yourself. As of this upload, the frmDTop will have the required DLL version nr to help reduce any confusion. This version & any future updates will have 2 DLLs. One is simply used to remove the injected DLL. Read comments in Declaration section of frmDTop & also the HowToSetup.rtf file.
We all know the hand icon is not available as a MousePointer option. Most of us know how to use LoadCursorFromFile so we can use a hand icon. This is a minor spin on that age-old procedure. What if user has a mouse theme going, wouldn't it be cool to show the hand of that theme instead of some static icon you have in your RES file? There are 2 similar examples shown in this project on how to accomplish this.
(Updated w/more Functions) The attached code will shape a window around a bitmap faster than anything else I've seen on any other site. A simple modification to the code (really optional parameters), can produce the desired results up to 4x faster! Surprised I haven't considered it before. This time the code is moved into a class that has many region-related functions. If the only reason you download is to strip out the RegionFromBitmap function, I think you will also appreciate learning about those other functions. Oh, why is this one faster; cause it uses a method none of the others do -- documented in the code. Patched: 18Nov/1430. SaveRegionToFile fixed, added 1 more ImportRegion option, cleaned-up code, made IsRegion public, & minor touch ups, more comments. 31Jan06/1800z: correct calc errors for rare cases in RegionFromBitmap() & minor tweaks throughout. 1Feb/0200z. Added many more region functions, added more examples in sample project, commented the code to death. History of changes at top of the class module. 2Feb/2130z: Added all remaining functions I can think of and even threw in a Region Collision routine. Short of bugs or bone-head errors, this class is done and now contains 99% of all known functions that actually create, destroy or modify regions.
Nothing special. An example on how to extract a portion of an image or DC into a DIB Section. The project basically is gray scaling, but the guts of the project can be used for most image byte processing. I wanted a way to extract only a small piece (16x16) of a large bitmap, but didn't want to extract the entire bitmap into an array. Also, I needed to be able to update only that small section (16x16) in the appropriate location. This sample project shows how I plan on doing it & thought it might be of use to some of you too. The routines, by using DIB Sections, are extremely fast, regardless of the size of the target. Tweaked just a bit: 3 Oct/15:00 est