|
Kalendß° | Program |
3D grid | Program |
BigNum | Program |
Editor ikon | Program |
XP panel | Program |
V²b∞rov² rßmec | K≤d |
Tisk textu pomocφ API | K≤d |
Zalomen² text | K≤d |
UkonΦenφ programu spuÜt∞nΘho p°φkazem Shell | K≤d |
Kalendß° | |
Prvek kalendß°, kter² b∞₧φ v SystemTray. Ukazuje jak zapisovat do registru a INI soubor∙, pou₧itφ prvku DTPicker, prßci s datem a Φasem a dalÜφ. | |
411396 bajt∙ | Kopφrovat |
3D grid | |
P°φklad objektov∞ orientovan²ch technik na vytvo°enφ 3D povrchu. | |
25838 bajt∙ | Kopφrovat |
BigNum | |
P°φklad kalkulßtoru pro poΦφtßnφ s cel²mi Φφsly s libovoln²m poΦtem Φφslic. | |
19803 bajt∙ | Kopφrovat |
Editor ikon | |
Editor ikon a kurzor∙ s velkou mno₧inou funkcφ. | |
48206 bajt∙ | Kopφrovat |
XP panel | |
Prvek pro vytvß°enφ panel∙, jakΘ pou₧φvajφ Windows XP. | |
21531 bajt∙ | Kopφrovat |
Ka₧d² grafick² program pou₧φvß pro v²b∞r Φßsti kreslφcφ plochy r∙znΘ zp∙soby. NejjednoduÜÜφ
je v²b∞r pomocφ obdΘlnφku. JednoduÜe se dß tato mo₧nost vytvo°it pomocφ
funkce API DrawFocuRect
.
Private Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private mx1 As Integer Private mx2 As Integer Private my1 As Integer Private my2 As Integer Private mRect As RECT Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then mx1 = X my1 = Y End If End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then DrawFocusRect Me.hdc, mRect mx2 = X my2 = Y With mRect .Left = IIf(mx1 > mx2, mx2, mx1) \ Screen.TwipsPerPixelX .Top = IIf(my1 > my2, my2, my1) \ Screen.TwipsPerPixelY .Right = IIf(mx1 > mx2, mx1, mx2) \ Screen.TwipsPerPixelX .Bottom = IIf(my1 > my2, my1, my2) \ Screen.TwipsPerPixelY End With DrawFocusRect Me.hdc, mRect End If End Sub
Objekt Printer
a nap°. i PictureBox umo₧≥ujφ zobrazovat text pomocφ
metody Print
. Funkce API TextOut
umo₧≥uje to samΘ, ale
m∙₧ete p°φmo zadßvat sou°adnice pro tisk.
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" _ (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, _ ByVal nCount As Long) As Long Dim text As String text = "Tisknuty text" TextOut Me.hdc, 50, 20, text, Len(text)
Chcete-li zobrazit n∞jak² text v PictureBoxu, pou₧ijete nap°. metodu Print
,
nebo v²Üe zmφn∞nou funkci textOut
. Mß-li vÜak text b²t v n∞jakΘm
obdΘlnφku, musφte si sami text rozd∞lit a °ßdkovat. Funkce API DrawText
tohle ud∞lß za vßs.
Private Const DT_WORDBREAK = &H10 Private Const DT_LEFT = &H0 Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Dim text As String Dim r As RECT text = "Text, kter² bude zalamovßn v zadanΘm obdΘlnφku" 'definice obdΘlnφku With r .Left = 10 .Top = 10 .Right = 100 .Bottom = 100 End With 'vykreslenφ textu - DT_LEFT = zarovnßnφ do leva DrawText Me.hdc, text, Len(text), r, DT_WORDBREAK + DT_LEFT
UkonΦenφ programu spuÜt∞nΘho p°φkazem Shell
p°φkaz Shell
umo₧≥uje spouÜt∞t externφ programy. Neumo₧≥uje vÜak takto
spuÜt∞n² program ukonΦit. Pro ukonΦenφ tedy vyu₧ijeme funkce API a Φφslo procesu, kterΘ
p°φkaz Shell
vracφ
Private Const PROCESS_ALL_ACCESS = &H1F0FFF Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, _ ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, _ lpExitCode As Long) As Long Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, _ ByVal uExitCode As Long) As Long Dim hInst As Long, hProcess As Long, exCode As Long hInst = Shell("C:\WINNT\notepad.exe", vbNormalFocus) If hInst <> 0 Then If MsgBox("UkonΦit?", vbOKCancel) = vbOK Then hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0&, hInst) If hProcess <> 0 Then GetExitCodeProcess hProcess, exCode If exCode <> 0 Then TerminateProcess hProcess, exCode End If End If End If End If