Forum | | | | - page 1 - |
|  Stephan Sonneborn | allô zusammen,
gibt es une Possibilité, un Éditer aussi vertikal mittig (aussi dessus et unten) auszurichten, so comme z.B. chez einer Excel-cellule allez?
Horizontal ça va:
DEF CreateEditC(6) CONTROL("EDIT" ,@$(2),$50000001,@%(3),@%(4),@%(5),@%(6),@%(1),106, %HInstance, $0200)
|
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 27.02.2011 ▲ |
| |
|  | « cette Beitrag wurde comme Solution gekennzeichnet. » | |  Thomas Freier | bof, si qui Font pas einstellbar ist ca va sans viel Rechnerei.
DEF GETSYSCOLOR(1) !"User32","GetSysColor"
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
var hWnd&=%hwnd
Var Font1&=CreateButton(%hwnd,"Font-H = 12",400,40,100,30)
Var Font2&=CreateButton(%hwnd,"Font-H = 16",400,80,100,30)
Var Font3&=CreateButton(%hwnd,"Font-H = 22",400,120,100,30)
var Hdlg&=control("Static",»,$54000106,10,50,300,80,%hwnd,5000,0)
var Edit&=control("Edit",»,$50000005,0,0,0,0,Hdlg&,5000,0)
settext Edit&,"Bitte ici Text eingeben"
Déclarer Edi_Font&
SET_EDIT 16,32
tandis que 1
WaitInput
cas %clé=2:BREAK
cas @Clicked(Font1&): SET_EDIT 12,36
cas @Clicked(Font2&): SET_EDIT 16,32
cas @Clicked(Font3&): SET_EDIT 22,28
Wend
DeleteObject edi_Font&
end
Proc SET_EDIT
Paramètres x%,y%
Edi_Font& = CreateFont(Arial,x%,0,0,0,0)
SetFont Edit&,edi_Font&
SetWindowPos Edit&=0,y% - 300,x%+6;0
ENDPROC
|
| | | | |  |
| |  | allô Stephan,
M$ bietet cela imho selbst pas direct à -
je pourrait un "CanvasEditControl" herstellen/ anbieten cela "wie De toute façon geartete" Eigenschaften besitzen peux mais je serait wahrscheinlich seulement prochain semaine en supplément venons. |
| | | | |
| |  Stephan Sonneborn | allô iF,
ne...aucune Pronlem. tant pis, dass MS cela pas vorgesehen hat, chez Statics hab ego hinbekommen,,,
je hab mich avec dem Canvas-Thema encore pas beschäftigt, quoi steckt car derrière elle? |
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 27.02.2011 ▲ |
| |
| |  | | | | | |
| |  E.T. | seulement so comme idée: qui Hauteur des Edit's qui verwendeten Font-Hauteur anpassen (ou bien renversé: qui Hauteur des Edits auslesen et qui Font-Hauteur anpassen) ... 
était seulement so un idée....  |
| | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 28.02.2011 ▲ |
| |
| |  Thomas Freier | bof, si qui Font pas einstellbar ist ca va sans viel Rechnerei.
DEF GETSYSCOLOR(1) !"User32","GetSysColor"
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
var hWnd&=%hwnd
Var Font1&=CreateButton(%hwnd,"Font-H = 12",400,40,100,30)
Var Font2&=CreateButton(%hwnd,"Font-H = 16",400,80,100,30)
Var Font3&=CreateButton(%hwnd,"Font-H = 22",400,120,100,30)
var Hdlg&=control("Static",»,$54000106,10,50,300,80,%hwnd,5000,0)
var Edit&=control("Edit",»,$50000005,0,0,0,0,Hdlg&,5000,0)
settext Edit&,"Bitte ici Text eingeben"
Déclarer Edi_Font&
SET_EDIT 16,32
tandis que 1
WaitInput
cas %clé=2:BREAK
cas @Clicked(Font1&): SET_EDIT 12,36
cas @Clicked(Font2&): SET_EDIT 16,32
cas @Clicked(Font3&): SET_EDIT 22,28
Wend
DeleteObject edi_Font&
end
Proc SET_EDIT
Paramètres x%,y%
Edi_Font& = CreateFont(Arial,x%,0,0,0,0)
SetFont Edit&,edi_Font&
SetWindowPos Edit&=0,y% - 300,x%+6;0
ENDPROC
|
| | | | |
| |  | la fois testen...
Cls
Var edit& = Créer("Edit", %hWnd, "Testtest", 10, 10, 200, 30)
Var edit2& = Contrôle("EDIT", "TestTest", $54040000, 10, 50, 200, 30, %hwnd, 2001, %hInstance, $00020000)
Tandis que 1
WaitInput
Cas %clé=2: BREAK
Endwhile
|
| | | | |
| |  Thomas Freier | qui Text ist dans beiden Fällen dessus à gauche. Habe encore une vieille Fontauswahl incorporé, avec qui de 12 jusqu'à 28 px Fonthöhe alles trop 90% mittig ist. Jedenfalls chez meinem System.
$H Windows.ph
DEF GETSYSCOLOR(1) !"User32","GetSysColor"
Def GetTextExtentPoint32(4) !"GDI32","GetTextExtentPoint32A"
Def ReleaseDC(2) !"User32","ReleaseDC"
Def ApiChooseFont(1) ! "COMDLG32.DLL","ChooseFontA","#","%"
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
var hWnd&=%hwnd
Var Font1&=CreateButton(%hwnd,"Font",400,40,100,30)
var Hdlg&=control("Static",»,$54000106,10,50,300,80,%hwnd,5000,0)
var Edit&=control("Edit",»,$50000005,0,0,0,0,Hdlg&,5000,0)
settext Edit&,"Bitte ici Text eingeben"
Déclarer Edi_Font&
var Font$=Arial
var hoehe%=16
var Fett%=0
var Kursiv%=0
var Underline%=0
SET_EDIT
tandis que 1
WaitInput
cas %clé=2:BREAK
Si @Clicked(Font1&)
cas fett%=1 : fett%=500
LR_Font_Wahl Font$,(hoehe%*122),Fett%, Kursiv%
SET_EDIT
EndIf
Wend
DeleteObject edi_Font&
end
Proc SET_EDIT
Edi_Font& = CreateFont(Font$,hoehe%,0,Fett%,Kursiv%,Underline%)
SetFont Edit&,edi_Font&
O_GetTextExtent GetText $(edit&),1'Longueur
var StringBreite& = &(0)
O_GetTextExtent GetText $(edit&),0'Hauteur
var StringHoehe& = &(0)
var x!=hoehe%/10
SetWindowPos Edit&=0,22+(StringHoehe&/x!) - 300,(StringHoehe&+(x!*6));0
ENDPROC
Proc O_GetTextExtent
Paramètres _t$,_w%
declare _size#,_TEXT#,_result&,_hdc&
dim _TEXT#,Len(_t $) + 1
dim _size#,8
String _TEXT#,0 = _t$
_hdc& = ~GetDC(hWnd&)
GetTextExtentPoint32(_hdc&,_TEXT#,Len(_t $),_size#)
_result& = Long(# _size,4)
Cas _w% : _result& = Long(# _size,0)
ReleaseDC(hWnd&,_hdc&)
dispose _TEXT#
dispose _size#
return _result&
ENDPROC
Proc LR_Font_Wahl
Paramètres nFont$,nhoehe%,nFett%,nkurs%
Déclarer logfont#, choosefont#
dim logfont#,80'-> muss gross genug son, là sonst qui NAME gekürzt wird !
Long logfont#,0=(nhoehe%/90)'FONTHeight 1000 entspricht 10
Long logfont#,4=20'FONTWidth 1000 entspricht 10
Long logfont#,8=0'
Long logfont#,12=200'FONTOrientation
Long logfont#,16=nFett%'FONTWeight - jusqu'à 400 ist normal, alles drüber heisst fett !
String logfont#,20=@Chr$(nkurs%)'Italic
String logfont#,21=@Chr$(Underline%)'Underline
String logfont#,22=»'StrikeOut
String logfont#,23="0"'CharSet
String logfont#,24="T"'OutPrecision
String logfont#,25="T"'ClipPrecision
String logfont#,26="0"'Quality
String logfont#,27="2"'PitchAndFamily
String logfont#,28=nFont$'FaceName
Faible choosefont#,60
Long choosefont#,0 = 60'Longueur qui Strukturvariable
Long choosefont#,4 = %hwnd'Handle des Hauptfensters
Long choosefont#,8 = 0'Instance-Handle des Hauptfensters
Long choosefont#,12= logfont#'LogFontStruktur
Long choosefont#,16 = 0'Pointsize
Long choosefont#,20 = $00002341'Flags
Long choosefont#,24 = rgb(0,0,0)'RGB - Voreinstellung et Wert qui ausgelesen wird
Long choosefont#,28 = 0'Custdata
Long choosefont#,32 = 0'Hook
long choosefont#,36= 0'Templatename
Long choosefont#,40= 0'Hinstance
long choosefont#,44= 0'Lpszstyle
Long choosefont#,48= $00000001'FONTtype
Long choosefont#,52= 8'FONTSizeMin
Long choosefont#,56= 36'FONTSizeMax
Decimals 0
apichoosefont(choosefont#)
si @Long(choosefont#,16)/10 > 0' si Grösse = 0 wurde abgebrochen
'la couleur auslesen
'Imprimer @GetRValue(@long(choosefont#,24)),\
' @GetGValue(@long(choosefont#,24)),\
' @GetBValue(@long(choosefont#,24))," <- Textfarbe RGB"
'Attribute auslesen
Hoehe%=(@word(choosefont#,16)/10)
Font$=@string$(logfont#,28)
Kursiv%=@Ord(@string$(logfont#,20))
Underline%=@Ord(@string$(logfont#,21))
Fett%=@Long(logfont#,16)
si Fett% > 400
Fett%=1
d'autre
Fett%=0
endif
endif
Dispose logfont#
Dispose choosefont#
ENDPROC
|
| | | | |
| |  Stephan Sonneborn | Thomas Freier (28.02.11)
bof, si qui Font pas einstellbar ist ca va sans viel Rechnerei.
Hi Thomas,
funzt prima!  qui Font wird seulement einmal programmtechnisch eingestellt et bleibt ensuite unveränderlich.
Vielen Dank!!! |
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 28.02.2011 ▲ |
| |
| |  Stephan Sonneborn | allô zusammen,
je qui Présentation de Thomas et avec ca ergänzt...
'************************************************************************************************
'* Vertikal zentriertes Modifier le champ de Built: 01.03.2011 *
'* optionnel à gauche, à droite ou bien mittig ausgerichtet (ggf. seulement payons erlaubt) *
'* pour einer Présentation de Thomas Freier *
'* erweitert par Stephan Sonneborn *
'************************************************************************************************
DEF GETSYSCOLOR(1) !"User32","GetSysColor"
'+----------------------------------------------------------------------------------------------+
DECLARE Font&, Edit&, THeight%
DECLARE LastDlgID&
'+----------------------------------------------------------------------------------------------+
'************************************************************************************************
'* Einzel-IDs pour Dialogelemete generieren *
'************************************************************************************************
PROC NewID
DECLARE ID&
'+----------------------------------------------------------------------------------------------+
LastDlgID& = LastDlgID& + 1
ID& = LastDlgID&
'+----------------------------------------------------------------------------------------------+
RETOUR ID&
'+----------------------------------------------------------------------------------------------+
ENDPROC
'************************************************************************************************
'************************************************************************************************
'* Vertikal zentriertes Modifier le champ de *
'************************************************************************************************
PROC CreateEditVert
PARAMETERS hParent&, Text$, x1%, y1%, dx%, dy%, TSize%, Alignment%, Number%
'hParent : Handle des Elterfensters
'Text$ : Vorgabetext
'x1%, y1% : linke obere coin des "Editfeldes"
'dx%, dy% : Taille des "Editfeldes"
'TSize% : Texthöhe im Modifier le champ de
'Alignment%: 0 => à gauche, 1 => mittig, 2 => à droite ausgerichtet
' Number% : <> 0 => seulement Zahleneingabe erlaubt
DECLARE hStatic&, hEdit&
DECLARE EHeight%, Style&
'+----------------------------------------------------------------------------------------------+
EHeight% = TSize% + 6
Style& = $50000080 + Alignment%
Cas Number%: Style& = Style& + $2000
hStatic& = CONTROL("Static",» ,$54001106 ,x1%,y1%,dx%,dy%,hParent&,NEWID(),0)
hEdit& = CONTROL("Edit" ,Text$, Style&, 0, 0, 0, 0,hStatic&,NewID(),0)
SETWINDOWPOS hEdit& = 0, ((dy%-TSize%)/2) - dx%, EHeight%; 0
'+----------------------------------------------------------------------------------------------+
RETOUR hEdit&
'+----------------------------------------------------------------------------------------------+
ENDPROC
'************************************************************************************************
'************************************************************************************************
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
'+----------------------------------------------------------------------------------------------+
THeight% = 30
Font& = CREATEFONT (Arial,THeight%,0,0,0,0)
Edit& = CreateEditVert(%HWND, »,10,50,300,80,THeight%,1, 0)'Texteingabe
'Edit& = CreateEditVert(%HWND, »,10,50,300,80,THeight%,1, 1) 'Zahleneingabe
SETFONT Edit&, Font&
SETTEXT Edit&,"Bitte ici Text eingeben"
'+----------------------------------------------------------------------------------------------+
LOCATE 1,1
PRINT "Weiter avec F1"
'+----------------------------------------------------------------------------------------------+
WHILE 1
WAITINPUT
CASE %KEY = 5: BREAK
WEND
'+----------------------------------------------------------------------------------------------+
PRINT "Text im Modifier le champ de: ", GETTEXT$(Edit&)
PRINT "Ende avec Mausklick."
'+----------------------------------------------------------------------------------------------+
WAITINPUT
'+----------------------------------------------------------------------------------------------+
DELETEOBJECT Font&
FIN
'************************************************************************************************
|
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 01.03.2011 ▲ |
| |
| |  Thomas Freier | et encore un reduziertes Beispiel avec "Blinden Éditer-Feldern", le moi verwende um "Namensschilder" sur einem Bootsplatz(ici sans Hintergrundgrafik) anzulegen, trop éditer et trop Déplacer.
DEF GetSysColor(1) !"User32","GetSysColor"
Def APISetCursorPos(2) ! "User32","SetCursorPos"
Def WindowFromPoint(2)!"User32","WindowFromPoint"
Def GetCursorPos(1) !"User32","GetCursorPos"
Déclarer p#,h&
Faible p#,8
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Def GetTextExtentPoint32(4) !"GDI32","GetTextExtentPoint32A"
Def ReleaseDC(2) !"User32","ReleaseDC"
Def GetDC(1) !"User32","GetDC"
declare x%,y%
Proc GetTextExtent
Paramètres _t$,_w%
declare _size#,_TEXT#,_result&,_hdc&
dim _TEXT#,Len(_t $) + 1
dim _size#,8
String _TEXT#,0 = _t$
_hdc& = GetDC(GetActiveWindow())
GetTextExtentPoint32(_hdc&,_TEXT#,Len(_t $),_size#)
_result& = Long(# _size,4)
Cas _w% : _result& = Long(# _size,0)
ReleaseDC(GetActiveWindow(),_hdc&)
dispose _TEXT#
dispose _size#
return _result&
ENDPROC
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Def @ClientToScreen(2) !"User32","ClientToScreen"
Def @G2lx(0) @Long(C2sstrc #0)
Def @G2ly(0) @Long(C2sstrc #4)
Proc G2L
Paramètres Hdl&
Claire C2sstrc#
@ClientToScreen(%Hwnd,C2sstrc#)
x%=@G2lx()
y%=@G2ly()
Claire C2sstrc#
@ClientToScreen(Hdl&,C2sstrc#)
x%=@G2lx()-x%
y%=@G2ly()-y%
ENDPROC
Déclarer C2sstrc#
Faible C2sstrc#,8
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
SubClassProc
cas SubClassMessage(h&, $201): Poster un message(h&, $A1, $2, 0)
ENDPROC
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Fenêtre 1000,600
Titre de la fenêtre "Blindes Éditer-champ, pour Double-cliquez sur à gauche verschiebbar, pour Rechtsklick" + \
" editierbar - Linksklick im la fenêtre = prendre, Droit im la fenêtre = nouveau Edit"
UseFont Arial,16,0,0,0,0
CLS GETSYSCOLOR(15)
var LV_Font&=CreateFont(Arial,15,0,0,0,0)
SETDIALOGFONT LV_Font&
Déclarer b.obj&[],b.x%[],b.x1%[],b.y%[],b.y1%[], b.text$[],b.lage$[]
Déclarer b.xn%
Déclarer pic1&
b.xn%=1
b.x%[% B.xn]=400
b.y%[% B.xn]=320
b.text$[% B.xn]="K. Mustermann"
b.situation$[% B.xn]="S"
Boot_obj b.xn%
Sous-classe b.obj&[% B.xn],1
b.xn%=2
b.x%[% B.xn]=428
b.y%[% B.xn]=320
b.text$[% B.xn]="E. Wassermann"
b.situation$[% B.xn]="S"
Boot_obj b.xn%
Sous-classe b.obj&[% B.xn],1
b.xn%=3
b.x%[% B.xn]=200
b.y%[% B.xn]=200
b.text$[% B.xn]="K. Mustermann"
b.situation$[% B.xn]="W"
Boot_obj b.xn%
Sous-classe b.obj&[% B.xn],1
b.xn%=4
b.x%[% B.xn]=200
b.y%[% B.xn]=228
b.text$[% B.xn]="E. Wassermann"
b.situation$[% B.xn]="W"
Boot_obj b.xn%
Sous-classe b.obj&[% B.xn],1
b.xn%=4
Tandis que 1
WaitInput
Cas %clé=2:Pause
Whileloop b.xn%
G2L b.obj&[&loop]
b.x%[&loop]=x%
b.y%[&loop]=y%
Endwhile
GetCursorPos(p #)
h&=WindowFromPoint(Long(# p,0),Long(# p,4))
si %MouseKey=2' si pas déménagé volonté soll: %MouseKey=1
x%=1
Whileloop b.xn%' Nombre de Objekte
si Souris(% B.x[&loop],b.y%[&loop] - (% B.x[&loop]+b.x1%[&loop]),(% B.y[&loop]+b.y1%[&loop]))
ShowWindow(b.obj&[&loop],0)
Element_Edit &loop' EDIT-champ vorhandenes objet
Sous-classe b.obj&[&loop],1
x%=0
pause
endif
Wend
si x%=1
inc b.xn%
b.x%[% B.xn]=%MouseX
b.y%[% B.xn]=%MouseY
b.text$[% B.xn]=»
b.situation$[% B.xn]="W"
b.x1%[% B.xn]=120
Element_Edit b.xn%' EDIT-champ nouveau objet
Sous-classe b.obj&[% B.xn],1
endif
SetFocus(%HWND)
endif
Endwhile
DeleteObject LV_Font&
DeleteObject pic1&
Whileloop b.xn%
Sous-classe b.obj&[&loop],0
Endwhile
Dispose C2sstrc#
Dispose p#
Fin
Proc Boot_obj
Paramètres b.xi%
UseFont Arial,(16+2),0,0,0,0
GetTextExtent b.text$[% B.xi],1'Longueur du texte
b.x1%[% B.xi] = &(0)+0'Longueur
GetTextExtent b.text$[% B.xi],0
b.y1%[% B.xi] = &(0)+4'Hauteur
Si $ Trim(b.lage $[% B.xi]="S")'Longueur+Hauteur tauschen chez senkrecht
x%=b.y1%[% B.xi]
b.y1%[% B.xi]=b.x1%[% B.xi]
b.x1%[% B.xi]=x%
endif
MCLS b.x1%[% B.xi], b.y1%[% B.xi] ,RGB(255,255,255)
Début de peinture -1
USEP 0, 1, @RGB(192, 192, 192)
Rectangle 0,0-b.x1%[% B.xi], b.y1%[% B.xi]
Couleur du texte @RGB(0,0,0), -1
Si $ Trim(b.lage $[% B.xi]="W")
Set("Orientation", 0)
UseFont Arial,16,0,0,0,0
DrawText 2, 2, b.text$[% B.xi]
ElseIf $ Trim(b.lage $[% B.xi]="S")
Set("Orientation", 2700)
UseFont Arial,(16-1),0,0,0,0
DrawText b.x1%[% B.xi]-2, 2, b.text$[% B.xi]
Endif
EndPaint
Set("Orientation", 0)
pic1&=Créer(«PCSI»,0,"& MEMBMP" )
b.obj&[% B.xi]=Contrôle("Dialogue",»,$54001100,b.x%[% B.xi], b.y%[% B.xi], b.x1%[% B.xi], b.y1%[% B.xi],%hwnd,0,%HINSTANCE,$0)
Créer("Bitmap",b.obj&[% B.xi], pic1&,0, 0)
ENDPROC
Proc Element_Edit
Paramètres b.xi%
var edi.x%= b.x1%[% B.xi]
cas b.lage$[% B.xi]="S" : edi.x%= b.y1%[% B.xi]
var Element&= CreateEdit(%hwnd,b.text$[% B.xi],b.x%[% B.xi], b.y%[% B.xi],120 , 22)
SetFont Element&,LV_Font&
var Element1&=Créer("GroupBox",%hwnd,»,b.x%[% B.xi], (% B.y[% B.xi]-38),120,30)
CreateText(Element1&,»,2,10,116,18)
var hor&=Créer(Bouton Radio ",%hwnd,»,(% B.x[% B.xi]+4),(% B.y[% B.xi]-25),12,12)
var t1&=CreateText(Element1&,"0°",18,11,14,16)
var sen&=Créer(Bouton Radio ",%hwnd,»,(% B.x[% B.xi]+38),(% B.y[% B.xi]-25),12,12)
var t2&=CreateText(Element1&,"90°",56,11,22,16)
var t3&=Créer("Button",Element1&,"F",90,10,18,18)
@Créer("Tooltip",%hwnd,t3&,"Font wählen")
SetFont hor&,LV_Font&
SetFont t1&,LV_Font&
SetFont t2&,LV_Font&
SetFont t3&,LV_Font&
Si $ Trim(b.lage $[% B.xi]="W")
SetCheck hor&,1
d'autre
SetCheck sen&,1
EndIf
SendString(Element&,"+ ({FIN})")'Text Marque et Cursor à l' Ende
Tandis que 1
WaitInput
Si GetFocus(%hwnd)
b.text$[% B.xi] = GetText $(Element&)
Si GetCheck(hor&)
b.situation$[% B.xi]="W"
D'autre
b.situation$[% B.xi]="S"
EndIf
BREAK
endif
Wend
DestroyWindow(Element&)
DestroyWindow(Element1&)
DestroyWindow(hor&)
DestroyWindow(sen&)
Boot_obj b.xi%' Texte de l'objet récente
ENDPROC
|
| | | | |
|
répondreOptions du sujet | 14.382 Views |
Themeninformationencet Thema hat 5 participant: |