Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.visual-basic > #19112

Re: VB6 usare le forme

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Paperino <non_te@lo.dico.invalid>
Newsgroups it.comp.lang.visual-basic
Subject Re: VB6 usare le forme
Date Tue, 1 Aug 2017 01:09:32 +0200
Organization Aioe.org NNTP Server
Lines 110
Message-ID <olodb7$p79$1@gioia.aioe.org> (permalink)
References <oln34g$hg7$1@solani.org>
NNTP-Posting-Host J0Sv6cEIZEi5jg0q6e/3Fg.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding 8bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.5.666
X-Notice Filtered by postfilter v. 0.8.2
Content-Language it
Xref csiph.com it.comp.lang.visual-basic:19112

Show key headers only | View raw


Greg ha scritto:
> C'è un modo di usare, o costruire, una forma sullo stile di quelle
> contenute in word? Nello specifico mi servirebbe avre un rettanfolo
> dove ci possa scrivere dentro e impostare il colore di sfondo - e mi
> andrebbe bene una labl - ma anche che assomigli ad una freccia. Merci
> e buone vacanze a tutti :)

Il sistema del drawing suggerito da SB non solo è ottimo in sé,
ma  può essere usato anche sulle Region, che hanno il vantaggio
di avere i margini trasparenti.

Il concetto è creare una region (cioè una forma "astratta")
usando una o più API, poi assegnarla a un oggetto che abbia
un .hWnd (Picturebox, Form o altro) per "ritagliarlo".

Ho fatto un po' di copia e incolla da degli esempi che ho
preso in rete. (Da qualche parte avevo un programma più
complesso già fatto, ma è roba di svariati anni fa :-(
e ritrovarlo è un po' un casino, ho fatto prima così)

Segui le istruzioni:
Crea un form, mettici sopra un command.
Metti qualche controllo, per esempio una Filelistbox, poi
aggiungi una Picturebox non enorme, ma abbastanza grande,
che la copra parzialmente.
Alla Picturebox metti un .BackColor diverso dal grigio,
diciamo blu,

Nelle dichiarazioni del Form incolla questo:

'***************
Option Explicit
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd _
As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 _
As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) _
As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 _
As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, _
ByVal X3 As Long, ByVal Y3 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 CreatePolygonRgn Lib "gdi32" (lpPoint _
As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) _
As Long
'nPolyFillMode
'Exactly one of the following flags specifying the polygon
' filling mode to use:
Const ALTERNATE = 1
' The device alternates between filling and not filling
' contiguous sections whose boundaries are determined by
' the edge(s) of the polygon crossing through the polygon's
' interior.
Const WINDING = 2
' Any section inside the polygon is filled, regardless of
' any intra-polygonal boundaries and edges.


'Will hold the handle to the new region.
Dim hRegion As Long

Private Type POINTAPI
     X As Long
     Y As Long
End Type
'*******************

Nel command metti questo:

'*******************
Dim Punti() As POINTAPI

Dim NumeroPunti As Integer
NumeroPunti = 8
ReDim Punti(1 To NumeroPunti)

Punti(1).X = 100
Punti(1).Y = 10

Punti(2).X = 10
Punti(2).Y = 100

Punti(3).X = 100
Punti(3).Y = 200

Punti(4).X = 100
Punti(4).Y = 120

Punti(5).X = 200
Punti(5).Y = 120

Punti(6).X = 200
Punti(6).Y = 80

Punti(7).X = 100
Punti(7).Y = 80

Punti(8).X = 100
Punti(8).Y = 10

hRegion = CreatePolygonRgn(Punti(1), NumeroPunti, ALTERNATE)

'Change the Form to the new region shape.
  SetWindowRgn Freccia.hWnd, hRegion, True
'*******************

Lancia e clicca :-)

Bye, G.

Back to it.comp.lang.visual-basic | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

VB6 usare le forme Greg <greg@alicie.com> - 2017-07-31 13:09 +0200
  Re: VB6 usare le forme SB <stNOOObenevSPAM@tin.it> - 2017-07-31 19:39 +0200
    Re: VB6 usare le forme Greg <greg@alicie.com> - 2017-07-31 21:46 +0200
      Re: VB6 usare le forme SB <stNOOObenevSPAM@tin.it> - 2017-08-01 19:22 +0200
        Re: VB6 usare le forme Paperino <non_te@lo.dico.invalid> - 2017-08-02 15:25 +0200
          Re: VB6 usare le forme SB <stNOOObenevSPAM@tin.it> - 2017-08-02 19:10 +0200
            Re: VB6 usare le forme Paperino <non_te@lo.dico.invalid> - 2017-08-02 19:23 +0200
  Re: VB6 usare le forme Paperino <non_te@lo.dico.invalid> - 2017-08-01 01:09 +0200
    Re: VB6 usare le forme Greg <greg@alicie.com> - 2017-08-01 08:05 +0200

csiph-web