| |
|
|
- Seite 1 - |
|
Julian Schmidt | Hallo, ich würde gerne aus optischen Gründen ein Fenster erstellen das weiterhin skalierbar ist, allerdings keinen Dicken Rahmen besitzt. Ist so etwas möglich?
LG
Julian57 |
|
|
| |
|
|
|
« Dieser Beitrag wurde als Lösung gekennzeichnet. » |
|
- Seite 2 - |
|
Andreas Miethe
| iF (21.09.11)
Du hast ja schon einen fetten Block: case (%mouseXheight(%hWnd)-10) : hwnd.scaleByMouse()
iF (21.09.11)
da kannst Du doch der hWnd.scaleByMouse-Proc als Parameter übergeben welche Ecke/ Kante gemeint war um zu Ersparen das Du das in der Proc erst wieder ermitteln musst.
Das geht mir irgendwie gegen den Strich
Das wird normalerweise über die Message WM_NCHITTEST geregelt.
Hier mal ein kleines Beispiel für einen skalier / verschiebbaren Button. Sollte sich wohl für ein Fenster anpassen lassen.
$H Windows.ph
$H Messages.ph
$H Structs.ph
STRUCT TRect = ~Rect
STRUCT TPoint = ~Point
Proc HitTest
Parameters hCtl&,lParam&
Declare Point#
Declare Rect#
Dim Point#,TPoint
Dim Rect#,TRect
Point#.x& = LoWord(lParam&)
Point#.y& = HiWord(lParam&)
~ScreenToClient(hCtl&,Point#)
~GetWindowRect(hCtl&,Rect#)
~MapWindowPoints(~GetDesktopWindow(),%Hwnd,Rect#,2)
If (Point#.y& < 4) AND (Point#.x& < 4)
Dispose Point#,Rect#
Return ~HTTOPLEFT
ElseIf (Point#.y& < 4) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))
Dispose Point#,Rect#
Return ~HTTOPRIGHT
ElseIf (Point#.y& >= (Rect#.bottom& - Rect#.top&-4)) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))
Dispose Point#,Rect#
Return ~HTBOTTOMRIGHT
ElseIf (Point#.x& < 4) AND (Point#.y& >= (Rect#.bottom& - Rect#.top& - 4))
Dispose Point#,Rect#
Return ~HTBOTTOMLEFT
ElseIf Point#.y& < 4
Dispose Point#,Rect#
Return ~HTTOP
ElseIf Point#.x& < 4
Dispose Point#,Rect#
Return ~HTLEFT
ElseIf Point#.x& >= (Rect#.right& - Rect#.left& - 4)
Dispose Point#,Rect#
Return ~HTRIGHT
ElseIf Point#.y& >= (Rect#.bottom& - Rect#.top& - 4)
Dispose Point#,Rect#
Return ~HTBOTTOM
Else
Dispose Point#,Rect#
Return ~HTCAPTION
EndIf
EndProc
SubClassProc
If SubClassMessage(&sWnd,~WM_NCHITTEST)
Set("WinProc", 0)
Return HitTest(&swnd,&slParam)
Endif
EndProc
cls
Var Ende& = 0
Var Button& = Create("Button",%hwnd,"OK",10,10,120,30)
SubClass Button&,1
whilenot ende&
waitinput
endwhile
|
|
|
| Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...] | 21.09.2011 ▲ |
|
|
|
|
|
| |
|
- Seite 2 - |
|
| Ich weiß nicht ob es sinnvoller ist z.B. bei jeder Mausbewegung statt nur einmalig nach Klick zu prüfen in welchen Bereich geklickt wurde. oO |
|
|
| |
|
|
|
Andreas Miethe
| Naja, zumindest wird bei Mausbewegung gleich der richtige Cursor angezeigt und nicht erst nach ''KLICK'' |
|
|
| Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...] | 21.09.2011 ▲ |
|
|
|
|
| Hm, wirds doch beim 1. Beispiel dazu auch:
'URL: https://xprofan.com/intl/de/forum/skalierbares-fenster-erstellen-ohne-dicken-rahmen/
/*
{$cleq}
{$compiler c:\xprofan11\}
{$runtime c:\xprofan11\}
*/
windowstyle 1 | 2 | 8 | 16 | 512
window 640,480
userMessages 16,513,20//wm_close,wm_lButtonDown,wm_eraseBkGnd
subClass %hWnd,1
while 1
waitInput
select %uMessage
caseof 16 : break
caseof 513
case (%mouseX>width(%hWnd)-10) and (%mouseY>height(%hWnd)-10) : hWnd.scaleByMouse()
endSelect
wend
end
subClassProc
case subClassMessage(%hWnd, 512):useCursor (%mouseX>width(%hWnd)-10) and (%mouseY>height(%hWnd)-10)*7//wm_mouseMove
endProc
proc hWnd.scaleByMouse
declare m#
dim m#,8
external("user32","GetCursorPos",m#)
var omx%=long(m#,0)
var omy%=long(m#,4)
var wi&=%winRight-%winLeft
var he&=%winBottom-%winTop
while isKey(1)
waitInput 10
external("user32","GetCursorPos",m#)
setWindowPos %hWnd=%winLeft,%winTop - wi&-omx%+long(m#,0),he&-omy%+long(m#,4)
wend
dispose m#
endProc
-
ist halt wm_mouseMove statt wm_ncHitTest.
Nachtrag: Ah, jetzt sehe ich den Unterschied und Vorteil! |
|
|
| |
|
|
|
Julian Schmidt | Der Quelltext mit wm_ncHitTest funktioniert wirklich super! Danke Andreas
$H Windows.ph
$H Messages.ph
$H Structs.ph
STRUCT TRect = ~Rect
STRUCT TPoint = ~Point
Proc HitTest
Parameters hCtl&,lParam&
Declare Point#
Declare Rect#
Dim Point#,TPoint
Dim Rect#,TRect
Point#.x& = LoWord(lParam&)
Point#.y& = HiWord(lParam&)
~ScreenToClient(hCtl&,Point#)
~GetWindowRect(hCtl&,Rect#)
~MapWindowPoints(~GetDesktopWindow(),%Hwnd,Rect#,2)
If (Point#.y& < 4) AND (Point#.x& < 4)
Dispose Point#,Rect#
Return ~HTTOPLEFT
ElseIf (Point#.y& < 4) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))
Dispose Point#,Rect#
Return ~HTTOPRIGHT
ElseIf (Point#.y& >= (Rect#.bottom& - Rect#.top&-4)) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))
Dispose Point#,Rect#
Return ~HTBOTTOMRIGHT
ElseIf (Point#.x& < 4) AND (Point#.y& >= (Rect#.bottom& - Rect#.top& - 4))
Dispose Point#,Rect#
Return ~HTBOTTOMLEFT
ElseIf Point#.y& < 4
Dispose Point#,Rect#
Return ~HTTOP
ElseIf Point#.x& < 4
Dispose Point#,Rect#
Return ~HTLEFT
ElseIf Point#.x& >= (Rect#.right& - Rect#.left& - 4)
Dispose Point#,Rect#
Return ~HTRIGHT
ElseIf Point#.y& >= (Rect#.bottom& - Rect#.top& - 4)
Dispose Point#,Rect#
Return ~HTBOTTOM
Else
Dispose Point#,Rect#
Return ~HTCAPTION
EndIf
EndProc
SubClassProc
If SubClassMessage(&sWnd,~WM_NCHITTEST)
Set("WinProc", 0)
Return HitTest(&swnd,&slParam)
Endif
EndProc
windowstyle 2+16+64
window 600,400
cls 255
var dg&=Create("Window",%hwnd,"",10,10,200,100)
StartPaint dg&
cls 255
EndPaint
SubClass dg&,1
SubClass %hwnd,1
while 1
waitinput 30
case iskey(27) : end
endwhile
|
|
|
| |
|
|
|
Jörg Sellmeyer | Na - wenn das nicht Rolf für seinen ROC gebrauchen kann, weiß ich's auch nicht. Irgendwer woltte doch auch mal Edits skalieren. Man hier zwar nicht reinschreiben aber für einen Entwurfsmodus ist das doch großartig!! |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 23.09.2011 ▲ |
|
|
|
|
| Vlt. noch nen Verschieben mit einbauen. |
|
|
| |
|
|
|
Jörg Sellmeyer | |
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 23.09.2011 ▲ |
|
|
|
|
| Ah, bestimmt wegen else HTCAPTION. |
|
|
| |
|
|
|
Jörg Sellmeyer | Kann man das so einrichten, daß es mit Statics ebenfalls funktioniert? |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 11.11.2011 ▲ |
|
|
|
|
| Von Andreas seiner Variante per wm_ncHitTest weiß ich es nicht aber mit "meiner" analogeren Variante ginge es auch mit unsichtbaren Controls: [...] |
|
|
| |
|
|
| |
|
- Seite 3 - |
|
|
Jörg Sellmeyer | Was meinst Du mit unsichtbaren Controls? Irgendwie mag ich die Variante von Andreas mehr, obwohl Deine auch interessant ist. Die von Andreas scheint mir systemnäher. |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 11.11.2011 ▲ |
|
|
|
|
| Andreas seine ist so wie es von System gedacht ist und "meine" Variante ist eher eine analoge Selbermachvariante.
Beide Varianten haben ihre Vor- und Nachteile. Bei "meiner" Variante hat man mehr Eingriffsmöglichkeiten und kann auch Verschiebungen ermöglichen die vom System eben nicht "gedacht" sind. Wer also Controls wie vom System gedacht verschieben möchte nimmt wm_ncHitTest und für Spezialitäten halt die analogere Variante. |
|
|
| |
|
|