Jump to content
Sign in to follow this  
scila1996

How to create a window similar to paragraph text

Recommended Posts

scila1996

I have a text file

Example

I Am a NGTRUNG
Hai Noi University of Science Technology
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
dddddddddddddddddddddddddddddddddddddddddd
any any any . Wait .......................
24
Step one: I want the program to read this file 
 
Step two: Read the last line, I'll put that last line of content font size 
 
8, 10, 12, 14, 16, 18, 24 
 
Step three: Create a window and set an "Lable" to accommodate the full contents of a file on 
 
 
example,
 
 
post-84392-0-74016900-1409599894_thumb.p
 
Thank you :)

Share this post


Link to post
Share on other sites
Muzaiyan

is this piece of code seems useful

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <File.au3>

Global $GUI, $msg, $GUI_WIDTH = 700, $GUI_HEIGHT = 500, $Edit_Control
Global $file = "New Text Document.txt"
Global $data = "", $font_size
Global $GUI = GUICreate("", $GUI_WIDTH, $GUI_HEIGHT, -1, -1, $WS_SYSMENU)
$font_size = FileReadLine($file, _FileCountLines($file))
GUICtrlCreateEdit($data, 0, 0, $GUI_WIDTH, $GUI_HEIGHT)
GUICtrlSetFont(-1, $font_size)

For $i = 1 To $font_size
    GUICtrlSetData(-1, FileReadLine($file, $i) & @CRLF, 1)
Next
GUISetState()
While True
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
  • Like 1

Share this post


Link to post
Share on other sites
scila1996

my intention is to create a GUI window with sufficient size to contain all the data in a text file

- Read text files on 
 
  - Read the last line ---> specify the size of the display 
 
Create a window to contain the entire contents of the file with the specified font size in the last line

Share this post


Link to post
Share on other sites
Muzaiyan

replace "New Text Document.txt" with your file name in the above script

Share this post


Link to post
Share on other sites
MikahS

I'm not sure if this pertains to the entire GUI window created with

GUICreate()
but I'm thinking Melba's UDF for stringsize could be very helpful: >link

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Muzaiyan

good always search on the forum before posting a question

if you want to use default width, height and style just use GuiCreate("")

Share this post


Link to post
Share on other sites
MikahS

The whole point of this post was for a way to make a dynamic height and width for OP, Muzaiyan.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

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  

×