Modify

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#720 closed Bug (No Bug)

more GUICtrlCreateGraphic()/GUICtrlSetGraphic($GUI_GR_LINE) - repainting problem

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.2.12.1 Severity: None
Keywords: Cc:

Description

According to this post:
http://www.autoitscript.com/forum/index.php?showtopic=85334

There is BUG in repainting when you use more than one GUICtrlCreateGraphic in one GUI each with one GUICtrlSetGraphic($GUI_GR_LINE).

I have example to draw inner rectangle in GUI and when you cover it by other application then after switching back is drawn one diagonal line.
The line probably goes between the ends of the last two lines drawn.

Example:

#include <GuiConstantsEx.au3>
#include <StaticConstants.au3>
#include <misc.au3>

$space = 60

$gui = GUICreate("",@DesktopWidth,@DesktopHeight-64)
GUISetState(@SW_SHOW)

$pos = WinGetClientSize($gui)
$width =  $pos[0] - 2*$space
$height = $pos[1] - 2*$space

$1 = GUICtrlCreateGraphic($space,$space,$width,1)
GUICtrlSetGraphic($1,$GUI_GR_LINE, $width, 0)
GUICtrlSetColor($1, 0x000000)

$2 = GUICtrlCreateGraphic($space,$height+$space,$width,1)
GUICtrlSetGraphic($2,$GUI_GR_LINE, $width, 0)
GUICtrlSetColor($2, 0xF000F)

$3 = GUICtrlCreateGraphic($space,$space,1,$height)
GUICtrlSetGraphic($3,$GUI_GR_LINE, 1, $height)
GUICtrlSetColor($3, 0xF000F)

$4 = GUICtrlCreateGraphic($width+$space,$space,1,$height)
GUICtrlSetGraphic($4,$GUI_GR_LINE, 1, $height)
GUICtrlSetColor($4, 0x000000)

While (not (_IsPressed("1b")))
    $msg = GUIGetMsg()
WEnd

Attachments (0)

Change History (5)

comment:1 by Zedna, 17 years ago

Previous post is from me: Zedna (not anonymous)

comment:2 by J-Paul Mesnage, 17 years ago

First of all to draw a line you need to define a starting point with $GUI_GR_MOVE.
Second as you create the graphics dynamically you need to use $GUI_GR_REFRESH after creation.

Third is for me as the $GUI_GR_COLOR seems to introduce some discrepancy not sure what I need to do.

comment:3 by Valik, 17 years ago

Resolution: No Bug
Status: newclosed

This code works for me and basically implements what JP says into a function. There are no weird drawing artifacts with this code:

#include <GuiConstantsEx.au3>

$space = 60

$gui = GUICreate("",@DesktopWidth,@DesktopHeight-64)
GUISetState(@SW_SHOW)

$pos = WinGetClientSize($gui)
$width =  $pos[0] - 2*$space
$height = $pos[1] - 2*$space

$1 = GUICtrlCreateGraphic($space,$space,$width,1)
_DrawLine($1, $width, 0, 0x000000)

$2 = GUICtrlCreateGraphic($space,$height+$space,$width,1)
_DrawLine($2, $width, 0, 0xF000F)

$3 = GUICtrlCreateGraphic($space,$space,1,$height)
_DrawLine($3, 0, $height, 0xF000F)

$4 = GUICtrlCreateGraphic($width+$space,$space,1,$height)
_DrawLine($4, 0, $height, 0x000000)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func _DrawLine($nControl, $x, $y, $nColor)
	GUICtrlSetGraphic($nControl, $GUI_GR_MOVE, 0, 0)
	GUICtrlSetGraphic($nControl, $GUI_GR_LINE, $x, $y)
	GUICtrlSetColor($nControl, $nColor)
	GUICtrlSetGraphic($nControl, $GUI_GR_REFRESH)
EndFunc

JP, I don't see any issues with the code I have posted. I corrected an issue where the vertical lines were not being drawn straight (using an x-coordinate of 1 instead of 0). Other than that, I can't see anything wrong with my corrected example.

At any rate, I'm going to close this ticket. There's no bug in what the ticket describes so if you have found something else make a new ticket and/or just fix it.

comment:4 by J-Paul Mesnage, 17 years ago

use 0x00FF00 for $2 and $3 you will see that the color is not OK.
I agree is not related with the ticket

comment:5 by Zedna, 17 years ago

Yes.
Source of aditional diagonal line was missing

GUICtrlSetGraphic($nControl, $GUI_GR_MOVE, 0, 0)

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.