Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

par pitanja o dizajnu

[es] :: Visual Basic 6 :: par pitanja o dizajnu

[ Pregleda: 4532 | Odgovora: 9 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

quit

Član broj: 133114
Poruke: 38
*.PPPoE-7487.sa.bih.net.ba.



Profil

icon par pitanja o dizajnu22.07.2007. u 10:38 - pre 203 meseci
Poz.
imao bih par pitanja u vezi dizajna u vb-u:

-kako najjednostavnije ucitati .png sliku?
-kako da vise labela pod istim imenom(razlicitim indexom) promijene u neku boju?
-kako da resize forme ogranici do odredjenog mjesta,znaci dok se forma smanjuje(povecava)na jednom mjestu da stane?

eto ako neko ima vremena za ova pitanja pls help, poprilicno je hitno (;
 
Odgovor na temu

goranvuc
Goran Vucicevic
Novi Sad

Član broj: 4934
Poruke: 1846
*.dialup.neobee.net.



+41 Profil

icon Re: par pitanja o dizajnu22.07.2007. u 11:24 - pre 203 meseci
1. Na standardni nacin (LoadPicture i sl.) tesko, tako da ti ostaje API ili koriscenje nekih vec gotovih biblioteka (npr. imas na VB Acceleratoru). U svakom slucaju, pomocu Google-a ces lako naci gomilu razlicitih nacina za to.
2. Pa najjednostavnije je prolaskom kroz niz kontrola:
Code:

   Dim intCounter As Integer
   
   For intCounter = Label1.LBound To Label1.UBound
      Label1(intCounter).BackColor = RGB(255, 0, 0)
   Next

ali je navedeni nacin los ako tvoj niz kontrola nije kontinualan (imas labele sa indeksom 0, 1, 2, pa 5, 7, 9 npr.) tj. doci ce do runtime greske. Zbog toga je uvek bolje koristiti pristup ovom nizu kao koleciji (sto i jeste):
Code:

   Dim lblObj As Label
   
   For Each lblObj In Label1
      lblObj.BackColor = RGB(255, 0, 0)
   Next

3. Pa mozes koristiti Resize dogadjaj:
Code:

Private Sub Form_Resize()
   
   If Me.Width <> 4000 Then Me.Width = 4000
   
End Sub
 
Odgovor na temu

Shadowed
Vojvodina

Član broj: 649
Poruke: 12846



+4783 Profil

icon Re: par pitanja o dizajnu22.07.2007. u 12:44 - pre 203 meseci
Ovo resenje pod 3 nece dozvoliti promenu ni na vise ni na manje, nisam siguran da li je to hteo (nekako mi se cini da je hteo minimum i maximum size).
No, u svakom slucaju, nece izgledati bas tako lepo (seckace). Ako hoce fiksnu velicinu, onda najbolje da postavi broderstyle na fixed a ako hoce ovo sa max i min size, moze preko API-a i mislim da u API Guide-u ima primera za to (99% sam siguran).
 
Odgovor na temu

goranvuc
Goran Vucicevic
Novi Sad

Član broj: 4934
Poruke: 1846
*.dialup.neobee.net.



+41 Profil

icon Re: par pitanja o dizajnu22.07.2007. u 15:03 - pre 203 meseci
Sve to stoji sto kazes (seckanje, blinkanje), ali pricao je o smanjivanju/povecavanju pa sam mu dao takav primer. Koliko se secam, postoji i pristip preko API-ja (mislim da je mladenovicz cak i postavio svojevremeno resenje ovde).
 
Odgovor na temu

Aleksandar Ružičić
Software Architect, Appricot d.o.o.
Beograd

Član broj: 26939
Poruke: 2881

Jabber: krckoorascic@gmail.com
Sajt: krcko.net


+44 Profil

icon Re: par pitanja o dizajnu23.07.2007. u 17:25 - pre 203 meseci
za ovo pod 3) mora da se radi subclassing forme i da se hvata WM_GETMINMAXINFO poruka potom se izmeni prosledjena MINMAXINFO struktura i sve radi super. jedini problem je sto je subclassing malo tezi za shvatanje (a i upotrebu) pocetnicima u vb-u...

posto cu imati danas malo slobodnog vremena uradicu ti primer pa cu okaciti veceras...


sto se tice ucitavanja png-a moja preporuka je LaVolpe 32bpp DIB Suite - jednostavno a brzo ucitavanje i iscrtavanje png-a
 
Odgovor na temu

Aleksandar Ružičić
Software Architect, Appricot d.o.o.
Beograd

Član broj: 26939
Poruke: 2881

Jabber: krckoorascic@gmail.com
Sajt: krcko.net


+44 Profil

icon Re: par pitanja o dizajnu24.07.2007. u 04:47 - pre 203 meseci
kada sam pokrenuo vb da bih napisao primer za MINMAXINFO dosao sam do ideje da napisem jednu klasu koja ce dodati neke opcije VB-ovim formama koje "nedostaju" (kao sto je ovo za min/max velicinu forme), za sad je implementirana samo kontrola minimalne/maximalne velicine forme (mada treba da se doradi jos malio za bolji useabillity) tj ovo sto je quit trazio...

prikacio sam projekat koji demonstrira min/max size...


u projekat dodate cFormEx.cls i ovaj kod u Form1:
Code:

Option Explicit

Public ex   As New cFormEx
'

Private Sub Form_Load()
    
    ex.Extend Me
    
    
    ' maximalna velicina (u pixelima)
    ex.MaxWidth = 600
    ex.MaxHeight = 400
    
    ' minimalna velicina (u pixelima)
    ex.MinWidth = 300
    ex.MinHeight = 200
    
End Sub


i to je to!


kao sto sam napisao u komentarima ovo je 'pre-alpha' verzija, namenjena samo da ilustruje min/max size control... kada zavrsim projekat (tj kad dodjem do prve beta verzije) okacicu ovde na es-u, stay tuned...
Prikačeni fajlovi
 
Odgovor na temu

Shadowed
Vojvodina

Član broj: 649
Poruke: 12846



+4783 Profil

icon Re: par pitanja o dizajnu24.07.2007. u 06:51 - pre 203 meseci
Mislim da se to moze uraditi sa jednim pozivom SetWindowPos, tj. da su parametri za to min i max felicina prozora, ali nisam sasvim siguran (a mrzi me da google-am ).
 
Odgovor na temu

Aleksandar Ružičić
Software Architect, Appricot d.o.o.
Beograd

Član broj: 26939
Poruke: 2881

Jabber: krckoorascic@gmail.com
Sajt: krcko.net


+44 Profil

icon Re: par pitanja o dizajnu24.07.2007. u 19:36 - pre 203 meseci
Ne moze da se koristi SetWindowPos za to, evo paste is MSDN-a:
Citat:

The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.

Syntax

BOOL SetWindowPos( HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);
Parameters

hWnd
[in] Handle to the window.
hWndInsertAfter
[in] Handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values.
HWND_BOTTOM
Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST
Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP
Places the window at the top of the Z order.
HWND_TOPMOST
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
For more information about how this parameter is used, see the following Remarks section.
X
[in] Specifies the new position of the left side of the window, in client coordinates.
Y
[in] Specifies the new position of the top of the window, in client coordinates.
cx
[in] Specifies the new width of the window, in pixels.
cy
[in] Specifies the new height of the window, in pixels.
uFlags
[in] Specifies the window sizing and positioning flags. This parameter can be a combination of the following values.
SWP_ASYNCWINDOWPOS
If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.
SWP_DEFERERASE
Prevents generation of the WM_SYNCPAINT message.
SWP_DRAWFRAME
Draws a frame (defined in the window's class description) around the window.
SWP_FRAMECHANGED
Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
SWP_HIDEWINDOW
Hides the window.
SWP_NOACTIVATE
Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS
Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE
Retains the current position (ignores X and Y parameters).
SWP_NOOWNERZORDER
Does not change the owner window's position in the Z order.
SWP_NOREDRAW
Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION
Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING
Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER
Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW
Displays the window.
Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.




Remarks

If the SWP_SHOWWINDOW or SWP_HIDEWINDOW flag is set, the window cannot be moved or sized.

If you have changed certain window data using SetWindowLong, you must call SetWindowPos to have the changes take effect. Use the following combination for uFlags: SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED.

A window can be made a topmost window either by setting the hWndInsertAfter parameter to HWND_TOPMOST and ensuring that the SWP_NOZORDER flag is not set, or by setting a window's position in the Z order so that it is above any existing topmost windows. When a non-topmost window is made topmost, its owned windows are also made topmost. Its owners, however, are not changed.

If neither the SWP_NOACTIVATE nor SWP_NOZORDER flag is specified (that is, when the application requests that a window be simultaneously activated and its position in the Z order changed), the value specified in hWndInsertAfter is used only in the following circumstances:


Neither the HWND_TOPMOST nor HWND_NOTOPMOST flag is specified in hWndInsertAfter.
The window identified by hWnd is not the active window.

An application cannot activate an inactive window without also bringing it to the top of the Z order. Applications can change an activated window's position in the Z order without restrictions, or it can activate a window and then move it to the top of the topmost or non-topmost windows.

If a topmost window is repositioned to the bottom (HWND_BOTTOM) of the Z order or after any non-topmost window, it is no longer topmost. When a topmost window is made non-topmost, its owners and its owned windows are also made non-topmost windows.

A non-topmost window can own a topmost window, but the reverse cannot occur. Any window (for example, a dialog box) owned by a topmost window is itself made a topmost window, to ensure that all owned windows stay above their owner.

If an application is not in the foreground, and should be in the foreground, it must call the SetForegroundWindow function.


SetWindowPos se koristi za pomeranje i promenu velicine prozora (kao kada se koristi Move metoda forme ili pojedinacno postavljanje Left, TOp, Width i Height propertija) a za ogranicavanje minimalne i maximalne velicine forme (prilikom resize-ovanja) mora (koliko ja znam) da se "hvata" WM_GETMINMAXINFO poruka...
 
Odgovor na temu

quit

Član broj: 133114
Poruke: 38
*.PPPoE-406.sa.bih.net.ba.



Profil

icon Re: par pitanja o dizajnu25.07.2007. u 19:37 - pre 203 meseci
Citat:
Aleksandar Ružičić: kada sam pokrenuo vb da bih napisao primer za MINMAXINFO dosao sam do ideje da napisem jednu klasu koja ce dodati neke opcije VB-ovim formama koje "nedostaju" (kao sto je ovo za min/max velicinu forme), za sad je implementirana samo kontrola minimalne/maximalne velicine forme (mada treba da se doradi jos malio za bolji useabillity) tj ovo sto je quit trazio...

prikacio sam projekat koji demonstrira min/max size...


u projekat dodate cFormEx.cls i ovaj kod u Form1:
Code:

Option Explicit

Public ex   As New cFormEx
'

Private Sub Form_Load()
    
    ex.Extend Me
    
    
    ' maximalna velicina (u pixelima)
    ex.MaxWidth = 600
    ex.MaxHeight = 400
    
    ' minimalna velicina (u pixelima)
    ex.MinWidth = 300
    ex.MinHeight = 200
    
End Sub



i to je to!


kao sto sam napisao u komentarima ovo je 'pre-alpha' verzija, namenjena samo da ilustruje min/max size control... kada zavrsim projekat (tj kad dodjem do prve beta verzije) okacicu ovde na es-u, stay tuned...


to mi je trebalo , hvala ljudi , pogotovo tebi Aleksandre ;)
 
Odgovor na temu

Aleksandar Ružičić
Software Architect, Appricot d.o.o.
Beograd

Član broj: 26939
Poruke: 2881

Jabber: krckoorascic@gmail.com
Sajt: krcko.net


+44 Profil

icon Re: par pitanja o dizajnu26.07.2007. u 22:51 - pre 203 meseci
Zato smo tu, da pomazemo :)
 
Odgovor na temu

[es] :: Visual Basic 6 :: par pitanja o dizajnu

[ Pregleda: 4532 | Odgovora: 9 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.