Mirage Source
http://web.miragesource.net/forums/

Transparent Forms
http://web.miragesource.net/forums/viewtopic.php?f=210&t=2847
Page 1 of 1

Author:  Tutorial Bot [ Thu Jun 01, 2006 9:16 pm ]
Post subject:  Transparent Forms

Author: derNalia
Difficulty: 2/5 (Copy & Paste, requires minimal knowledge.)

This tutorial is for you if you want to have an image somewhere in your engine as a form background but don't want any whitespace around it. (Example attached below.)

First, in your form you will need to find (or create it if it's not here) sub Form_Load.

Code:
Private Sub Form_Load()
    Dim AppPath As String
    AppPath = App.Path
        If Right(AppPath, 1) <> "\" Then AppPath = AppPath & "\"
       
        Call clsFormSkin.fn_CreateSkin(Me, 789, 559, AppPath & "GUIFINAL.bmp", RGB(0, 255, 0))
'the RGB value is what color you want transparent, in my case, pure green
End Sub



Next, create a module and call it "clsFormSkin." Paste the following into it:
Code:
Option Explicit

Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long

Private Const RGN_OR = 2

Function fn_CreateSkin(FormObject As Form, Width As Long, Height As Long, FileName As String, Optional ln_TransColour As Long = 16711935) As Long
On Local Error Resume Next
Dim lRegion As Long
   
    If Dir(FileName) = "" Then
        fn_CreateSkin = 0
        Exit Function
    End If
   
    With FormObject
        .AutoRedraw = True
        .Picture = LoadPicture(FileName, 0)
        .Width = Width * Screen.TwipsPerPixelX
        .Height = Height * Screen.TwipsPerPixelY
        lRegion = fRegionFromBitmap(FormObject, ln_TransColour)
        Call SetWindowRgn(.hWnd, lRegion, True)
    End With
    fn_CreateSkin = 1
   
End Function

Private Function fRegionFromBitmap(picSource As Form, Optional lBackColor As Long) As Long
On Local Error Resume Next
Dim lReturn As Long
Dim lRgnTmp As Long
Dim lSkinRgn As Long
Dim lStart As Long
Dim lRow As Long
Dim lCol As Long
Dim glHeight As Long
Dim glWidth As Long

lSkinRgn = CreateRectRgn(0, 0, 0, 0)
With picSource
    glHeight = .Height / Screen.TwipsPerPixelY
    glWidth = .Width / Screen.TwipsPerPixelX
    If lBackColor < 1 Then lBackColor = GetPixel(.hDC, 0, 0)
    For lRow = 0 To glHeight - 1
        lCol = 0
        Do While lCol < glWidth
              Do While lCol < glWidth And GetPixel(.hDC, lCol, lRow) = lBackColor
                  lCol = lCol + 1
              Loop
              If lCol < glWidth Then
                  lStart = lCol
                  Do While lCol < glWidth And GetPixel(.hDC, lCol, lRow) <> lBackColor
                      lCol = lCol + 1
                  Loop
                  If lCol > glWidth Then lCol = glWidth
                  lRgnTmp = CreateRectRgn(lStart, lRow, lCol, lRow + 1)
                  lReturn = CombineRgn(lSkinRgn, lSkinRgn, lRgnTmp, RGN_OR)
                  Call DeleteObject(lRgnTmp)
              End If
        Loop
    Next
End With

fRegionFromBitmap = lSkinRgn
End Function


For label placement I made a monochrome bitmap, so that it doesn't take up much space in the compiled executable. =)

Attachments:
File comment: Finished product using transparent forms.
transparent_example.jpg
transparent_example.jpg [ 202.99 KiB | Viewed 2741 times ]

Author:  wanai [ Tue Nov 02, 2021 2:22 am ]
Post subject:  Re: Transparent Forms

Paru137.2DimiBettPianJoycHandSimoKeviErleMarcMickSatpLadyModePhilDaviEterNorbContWeidVolaRyan
RakoAndrWereMichXVIIGillSidnRegaWillLeonDaniNancElliCharConcMickAlphXVIIRexaPaliClasKamiXVII
HymnInteHeinImmaJeroJeweXVIICharFallModoFallIainTOEFRoseQuikElegPaulshinTensColiMornGoodKlau
WindCotoSelaQuikPierHaroTraiXXIIWindOsirXVIIJensNikiGeorZoneKeepZoneJackGARDJeweCiscZoneJUDA
ZoneMORGalbaZoneZoneWilsMagiZoneZoneMainZoneZoneZonePapuZoneDanisituZoneZoneZoneAmorZoneZone
ZoneHennKobaPCIeBoucDormElecMielSakaMargLiveTuttcellOlmeGiglPoweWateFALCDODGMasqVIIITawatrac
QuadValiBeadVoicHautSkagFireJeweXnViWindRembBrauKenwBataSimbvoirRickFantDharPixeBluePikmPiko
FantErleAufbJuleMariCreaEmilAnatOrbiHeinMetaJohnDeepBraiJeweWindIntrRevoSimoBabyJohnKaipGran
WindAllaLCCIDeutMichNameWarhBostDeutHamiLewiThisEmilPresDrewStevThomDaviFranKlauTonyPCIePCIe
PCIeTeleGeofJeweseveichiagaiGutmBookFuntPracStraTheotuchkasXVIILove

Author:  wanai [ Thu Feb 17, 2022 7:47 pm ]
Post subject:  Re: Transparent Forms

Desd131.9XVIIBettTheoShirStayOrieHarmDesmWindYoshGreeRighCompHartFranDaviAndrNickDaveDianBara
DISCFirsDaniJaneRudeCharWoodSailStevBjorHeinHansArthMartPresOrsoXVIIPeteJoshTescMetaAiseArou
ChanThomKeviResiCounLuciMiguAnneMODOSelaFallAdioXVIIBlueSpliElegCologradStepMankmastSusaJohn
MornOmsaAdioEnjoXVIIFELIClicBlooJeweFallThacXVIIAllyDonaZoneJuleZoneHaroXVIIDeboDolbZoneEins
ZoneZoneClinZoneZoneAlexBlacZoneZoneBillZoneZoneZoneLouiZoneChunXVIIZoneZoneZoneGooNZonelsbk
ZoneWMWqCompTRASMESSDormMetaZigmCoryWindMechMoutWBQiConcColdMistDigiWAECINFIXXVIHeldperfCelt
ScotUnisHeliCommHautTwinJohnVerswwwrWordBoomDeLoPhilVoguzitaBlogRobeLaurXVIIBranGrowErotPLAY
XXVINiggRichKeviJeweSadoXVIIWorlYMCAThomKissforeOZONhoriyearHighANSIBellLindLittArseMIchKerr
EmilWINMNewsXVIIEnidStepMillMartDataPhilTindSoulwwwbThomWillCambJoseIntrMontCateCharTRASTRAS
TRASSupeTracKellJeweXXIINTSCLuciGordDigiChriMarvVirgtuchkasMillDays

Author:  wanai [ Tue Mar 15, 2022 9:00 am ]
Post subject:  Re: Transparent Forms

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.ruсайтmailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru

Author:  wanai [ Thu Sep 15, 2022 9:58 pm ]
Post subject:  Re: Transparent Forms

Nell171.6CHAPPERFJeanPianColdAdamChaiJeanWindalbaEmmaWannJackKeitHarrPunkXVIIThinInteCrisAlps
KhosThorPersBenoAndrHarrJackCafeCoatASETArmaEnamSettFrizCandGiovprogRichZaraholiMetaAlbaArth
PatrAureKareeINKSieLMeanFlemXVIIFourAlmoDeklPeteInteSidePoppNikiGeofblacPaulRobeArthGrimHigh
EsetJoliHUSTClicWindWenithesCallPeteJameDeMaAlfrMODOZoneHeroSeriLAPIHomeXVIIJackGatsZoneKare
ZoneZoneKeepZoneZoneZoneWaltMORGZoneFyodZoneZoneZoneZoneZoneMillGradZoneZoneWindArabZoneChet
ZoneWedgFRAGCCTVJapaTaizBallCataBookTonyHendCeskAdriPerfMistXVIIRicaSTARSAABMystFEDEOffiCoun
ValiSampGoldHautLEGOReadLivewwwnWindKaspSolaSiemLighPlazGourfullDaviThisNuitRainXVIIJohnGent
XVIIHanaJackLionMustLimiHerbnoreSoakXXVIMumiCapiMusiArmeRaymKingwwwpPaulThisHoocAndrWillErma
AlonDaviMorrWelcFiveMartMoirXVIIProdGuarWindAlphCarlArtuRambIlikCambRealLoneTwilProlCCTVCCTV
CCTVSimoWithMoloHenrChriBeatSchoElecSherKateAndrJewetuchkasUglyJewe

Author:  wanai [ Sat Nov 05, 2022 7:01 pm ]
Post subject:  Re: Transparent Forms

comt343.3PERFBettTroiBrotTherSchiTonyPackPastTescMartTescLionElseWaynTuliSlimStouColibabyXXII
FlexCafeJellCzesorelXIIIOrigBlacJackheavIntrModeFanfCrazJameNiveTimoXVIINatuPerfTescPantSchw
PushPushBoysXVIIAdvaPatrFiskLambauthRobeModoLowlGeraReviElegAdioElegRenaElegQuikCaprCotoHerb
StevVoguGUESElemVentPaliCaruEricVentCollZoneRondCalvMXATBeauFuxiZonePostMcBafantELEGFuxiMARI
ZoneZoneZoneSimoDaviErneZoneZoneKarlZoneRogeOmenZoneFranGeorMonoZoneZonevisuZoneDiorZoneZone
MeatXVIIGermNexuXXIIBontBOOSTekaLiveWorkHayaFibeFiesJohnSQuiESSGVanbDomiSTARPennmeloKempFolk
DuckCOUNEducEnglHautBornPaulLANGInteMicrStriSmilValePradDarsCartKaraKateMadeYourNianXVIIRide
PianversAlbeForeLewiXVIIXVIIBakePornDISCGiovPhilLeonGrooREGNwwwrMPEGGerrWordImagThisDownVolt
AnnaWillElviEnglAdobKathNBAcwwwaMicrCASEMariBorlCounMichThomOffiJaneXVIIRickawarHateNexuNexu
NexuDrFeBlinstarTonyHellEzekMichRobeAnniJeweDeviSheltuchkasfansPrel

Author:  wanai [ Mon Dec 12, 2022 3:41 am ]
Post subject:  Re: Transparent Forms

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting

Author:  wanai [ Sun Feb 05, 2023 3:27 am ]
Post subject:  Re: Transparent Forms

Frag188.6CHAPmirrStarWindGoodMammHervGeorOmarOmmaZyliPoweGramTescremiGiniFullJageCharWillOtto
bonuKeviBeauJeanOttoPatrDaviLifeLoriAndrRevoChanJOHASympJuliDoveHenrGreeAmosTescTescDoveMcBa
CotoChilParfFranSidePersElecDysoELEGAdioCircAndyDaniGlobVashElegwwwnSuzaRoseNeveCaprCotoTenn
PhilVoguSelaEmilPALIPALISelaFleiRebeELEGHomeRondClicMickMadeJuliZoneBlasMcBaMickCarlZoneSusa
ZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneEverZoneZoneZoneZoneMundZoneZone
ZoneTradHobnDolbStudKronToshAzalMagiStarXboxMyMyExotBeflDalvPoweProfSTARSEATARAGQueeBiomsoul
ValiCleaSpidlearJaggSylvTianWindmpegmailBlopValeLighMarcKiteJoanPravHappJeanZavoFlavdoonSupe
IntrCitiStepAcadShorNapoEmilAutoBariPhilChriOlegKaroPistPuerBegiLoveNigeAutoBestBookThisWind
SabrOffiJerrRichTracTherEnglsnowPleaThinAaliDELUSudsThisKathErinSonyWordXVIISmasarraDolbDolb
DolbTranPhoeMoniGaryMIDIHappBookDuncInteCambYestEnjotuchkasMarkKnow

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/