Jump to content
Sign in to follow this  
wolf9228

Func _ChooseFontColorRICHTEXTObj

Recommended Posts

wolf9228

;Include constants
#include <GUIConstants.au3>
;Include Misc
#include <Misc.au3>
dim $Form1 = GUICreate("AForm1", 508, 429, 161, 81)
dim $oRP = ObjCreate("RICHTEXT.RichtextCtrl.1")
dim $ParentWin_Pos = WinGetPos($Form1, "")
;Save the position of the parent window
GUISetBkColor(0x9DB9EB)
dim $Edit1 = GUICtrlCreateObj($oRP, 8, 8, 489, 361)
GUICtrlSetPos($Edit1,8,8,489,351)
dim $Button1 = GUICtrlCreateButton("FORMAT", 176, 384, 161, 33, 0)
GUISetState ();Show GUI
With $oRP; Object tag pool
.OLEObjects ()
.OLEDrag ()
.SelAlignment = 1
.OLEDropMode = 1
.OLEDragMode=0
.MultiLine()
.ScrollBars ()
.SelStart = 1
.SelFontName = "Arial"
.SelFontSize = 30
.BackColor=16777215
; GUICtrlSetData
.text = "AEdit1"
EndWith
While 1
    $nMsg = GUIGetMsg()
       Select
    
        Case $nMsg = $Button1
ChooseFontColorRICHTEXTObj()
            
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit

    EndSelect
WEnd

Func ChooseFontColorRICHTEXTObj()
dim $GUIWidth = 324
dim $GUIHeight = 184
dim $ChildWin = GUICreate("Child GUI", $GUIWidth, $GUIHeight, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $Form1)
GUISetBkColor(0xFFFFFF)
dim $GroupBox3 = GUICtrlCreateGroup("", 8, 8, 305, 137)
GUICtrlSetBkColor(-1, 0xFFFFFF)
dim $Button39 = GUICtrlCreateButton("Font", 16, 24, 113, 25, 0)
dim $Button40 = GUICtrlCreateButton("background", 16, 64, 113, 25)
dim $Radio1 = GUICtrlCreateRadio("Right", 224, 24, 81, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
dim $Radio2 = GUICtrlCreateRadio("Center", 224, 48, 81, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
dim $Radio3 = GUICtrlCreateRadio("Left", 224, 72, 81, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
dim $Button41 = GUICtrlCreateButton("CANCEL", 16, 152, 65, 25)
dim $Button42 = GUICtrlCreateButton("OK", 240, 152, 65, 25)
GUICtrlSetState($Radio1, $GUI_CHECKED)
dim $chkfont = 0
dim $chcolor = 0
dim $chckpox = 0
dim $Radiochk = 1
GUISetState(@SW_SHOW)
GUISwitch($ChildWin)
While 1
dim $msg = GUIGetMsg(1)
   Select
Case $msg[0] = $GUI_EVENT_CLOSE
GUIDelete()
GUISwitch($Form1)
Return $Form1

Case $msg[0] = $Button39 or $msg[0] = $Button40
if $msg[0] = $Button39 then
dim $a_font = _ChooseFont("Arial", 8)
if (@error) Then
Else
dim $chkfont = 1
ENDif
ENDif

if $msg[0] = $Button40 then
dim $color = _ChooseColor (0)
if (@error) Then
Else
dim $chcolor = 1
endif
endif

Case $msg[0] = $Radio1 or $msg[0] = $Radio2 or $msg[0] = $Radio3
if BitAND (GUICtrlRead($Radio1),  $GUI_CHECKED) Then
GUICtrlSetState($Radio2, $GUI_UNCHECKED)
GUICtrlSetState($Radio3, $GUI_UNCHECKED)
dim $Radiochk = 1
elseif BitAND (GUICtrlRead($Radio2),  $GUI_CHECKED) then
GUICtrlSetState($Radio1, $GUI_UNCHECKED)
GUICtrlSetState($Radio3, $GUI_UNCHECKED)
dim $Radiochk = 2
elseif BitAND (GUICtrlRead($Radio3),  $GUI_CHECKED) then
GUICtrlSetState($Radio1, $GUI_UNCHECKED)
GUICtrlSetState($Radio2, $GUI_UNCHECKED)
dim $Radiochk = 3
Endif

Case $msg[0] = $Button41 or $msg[0] = $Button42

if $msg[0] = $Button42 then
GUIDelete()
GUISwitch($Form1)
if $chkfont = 1 then

if $a_font[1] = 14 then 
$oRP.SelUnderLine=true
$oRP.SelItalic = true
$oRP.SelStrikeThru= true
Endif

if $a_font[1] = 10 then 
$oRP.SelItalic = true
$oRP.SelStrikeThru= true
Endif

if $a_font[1] = 12 then 
$oRP.SelUnderLine=true
$oRP.SelStrikeThru= true
Endif

if $a_font[1] = 4 then
$oRP.SelUnderLine=true
Endif

if $a_font[1] = 8 then
$oRP.SelStrikeThru= true
endif

if $a_font[1] = 2 then
$oRP.SelItalic = true
endif

if $a_font[4] = 400 then
$oRP.SelBold = true
endif
$oRP.SelFontName=$a_font[2]
$oRP.SelFontSize=$a_font[3]
$oRP.SelColor=$a_font[5]
endif
if $chcolor = 1 Then $oRP.BackColor=$color
if $Radiochk = 1 then $oRP.SelAlignment=1
if $Radiochk = 2 then $oRP.SelAlignment=2
if $Radiochk = 3 then $oRP.SelAlignment=0
Return $Form1
Else
GUIDelete()
GUISwitch($Form1)
Return $Form1
ENDif
EndSelect
WEnd
EndFunc


صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites
MHz

Welcome to the forum,

What is it that you need support for? Some information would be good.

:rolleyes:

Share this post


Link to post
Share on other sites
wolf9228

Welcome to the forum,

What is it that you need support for? Some information would be good.

:rolleyes:

Thank u wonderful welcome


صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites
wolf9228

Look at BetaPad. It uses a small GUI that allows the user to pick a colour. Try it out.

Wonderful Program

I Try it :rolleyes:


صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×