Sign in to follow this  
Followers 0
Phantomasss

My first GUI from pictures

11 posts in this topic

Hello, i create my first GUI from .gif images. There is a lot of problems, i hope you will help and we all will discuss...

Create GUI:

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

$gui = GUICreate("", 120, 60, -1, -1, BitOR($WS_POPUP, $WS_VISIBLE, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW)

GUISetState (@SW_SHOW, $gui)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Ok, done:

Posted Image

I created skin for my programm:

Posted Image

Now i add background:

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

$gui = GUICreate("", 120, 60, -1, -1, BitOR($WS_POPUP, $WS_VISIBLE, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW)


;Backgorund
GUICtrlCreatePic(@ScriptDir & "\background.gif", 0, 9, 120, 51)

GUISetState (@SW_SHOW, $gui)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Background added:

Posted Image

This is 1st problem:

Posted Image

That it? AutoIt bug? How to fix it? (Left in my project, Right in GUI).

Ok , next i add "title" for my programm:

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

$gui = GUICreate("", 120, 60, -1, -1, BitOR($WS_POPUP, $WS_VISIBLE, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW)

;Title Image
GUICtrlCreatePic(@ScriptDir & "\title.gif", 0, 0, 120, 9, -1, $GUI_WS_EX_PARENTDRAG)
;Backgorund
GUICtrlCreatePic(@ScriptDir & "\background.gif", 0, 9, 120, 51)

GUISetState (@SW_SHOW, $gui)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Result:

Posted Image

Not bad on the face of it. Here 2rd problem: 2 pixels transparent (.gif files not transparent):

In project:

Posted Image

In GUI:

Posted Image

How to fix it?

Next i want add button for close my GUI (Posted Image). Code:

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

$gui = GUICreate("", 120, 60, -1, -1, BitOR($WS_POPUP, $WS_VISIBLE, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW)

;Button 1
$close = GUICtrlCreatePic(@ScriptDir & "\button1.gif", 112, 2, 6, 6)
;Title Image
GUICtrlCreatePic(@ScriptDir & "\title.gif", 0, 0, 120, 9, -1, $GUI_WS_EX_PARENTDRAG)
;Backgorund
GUICtrlCreatePic(@ScriptDir & "\background.gif", 0, 9, 120, 51)

GUISetState (@SW_SHOW, $gui)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $close Then Exit
Wend

Result:

Posted Image

This 3rd problem (as well as 2).

In project:

Posted Image

In GUI:

http://img222.imageshack.us/img222/320/60228016.gif

And 4th problem here. It works with any window:

http://img98.imageshack.us/img98/442/70412073.gif

How to fix all problems?

Arichive with a project in attachment. Please help me... Thanks!

mygui.rar

Share this post


Link to post
Share on other sites



What is the end result meant to be with the GUI? I understand it is skinned but what else? Your problem confuses me... :)

Why use transparent .gif? Why not use JPG images? Why not use a whole PNG image and do it that way?

Share this post


Link to post
Share on other sites

What is the end result meant to be with the GUI? I understand it is skinned but what else?

I described all of problems:

Posted Image

Why use transparent .gif?

All used .gif images NOT transparent 100%. For them not 255 colors, but less than, possibly from it appears bug with transparency.

Why not use JPG images?

  • JPG images have artefacts.
  • .gif images have a less size.
.gif images well excellent for such GUI.

Why not use a whole PNG image and do it that way?

My GUI not use alpha-channel. .png not necessity this.

Thanks for fast reply...

Share this post


Link to post
Share on other sites

Works like a charm if you use .jpg :)

Share this post


Link to post
Share on other sites

You compel me to go away from problems but not decide them :).

Share this post


Link to post
Share on other sites

You compel me to go away from problems but not decide them :).

Sorry, i was not compelling you. Open an paint and try to save into Gif. You get a message as color loss....! wanna continue? I think that reduces the quality of the image. But since i tried different ways i felt its due to Gif.

Share this post


Link to post
Share on other sites

Sorry, i was not compelling you. Open an paint and try to save into Gif. You get a message as color loss....! wanna continue? I think that reduces the quality of the image. But since i tried different ways i felt its due to Gif.

Paint as a palette uses "System (Windows)" or alike. In this palette contained different colors:

Posted Image

In all them 256. AutoIt fine works with palettes in 256/256 colors, all ok.

At saving in .gif i use "Exact" palette (Photoshop). Due to it possible to save .gif image without losses (not more than 256 colors):

Posted Image

AutoIt badly works with incomplete (Posted Image) palettes (3/256 colors). It must be fixed...

If skin of my programm consisted of 256/256 colors, all would be ok.

Look here

http://www.autoitscript.com/forum/index.ph...st&p=679445

There is very similar problem.

Yes, my project does not move up from this bug.

Share this post


Link to post
Share on other sites

Hmm... i fixed it. It is necessary to fill empty colors (Posted Image) by other colors (ffffff to 000000), example:

Posted Image

It works! Bug with transparency of pixels is fixed...

And there is the last problem:

Posted Image

How to fix? Thanks...

Share this post


Link to post
Share on other sites

Phantomasss,

I freely admit not being too knowledgable in this area, but I believe you need to send a message to redraw your GUI. Try creating a $tagRECT structure for your button:

$tDraw = "int " & 112 & "; int " & 2 & "; int " & 118 & "; int " & 8

and adding this to your While...WEnd loop:

If Not WinActive($gui) Then _WinAPI_RedrawWindow($gui, $tDraw)

No doubt someone will come along with a better solution - but that worked for me.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  
Followers 0