Pintar dentro o en borde de un control TEdit
Publicado: Dom Feb 13, 2011 2:24 am
Hola a todos
Intento hacer una marca en los edit obligatorios con parte de la rutina de
Jose Ramon publicada aqui
pero me sale un efecto raro al cambiar de ventana,pestaña,ect...
Estaria bien consegir un efecto de triangulo en una esquina, pero me
conformo con las lineas del borde
alguien me puede ayudar
#pragma BEGINDUMP
#include "windows.h"
#include "xailer.h"
#include "colors.ch"
#include <commctrl.h>
HB_FUNC_STATIC( TEDIT_WMNCPAINT )
{
PHB_ITEM Self = hb_stackSelfItem();
HWND hWnd = GetHandleOf( Self );
if( XA_ObjGetL( Self, "lObligado" ) )
{
HDC hdc = GetWindowDC( hWnd );
RECT rect;
HPEN hbr = CreatePen( PS_SOLID, 1, clRed );
HPEN hOldPen = SelectObject( hdc, (HPEN) hbr );
GetWindowRect( hWnd, &rect );
rect.right -= rect.left; // Ancho
rect.bottom -= rect.top; // Alto
rect.left = 0;
rect.top = 0;
// arriba // izquierda
MoveToEx( hdc, 0, rect.bottom -= rect.top+1, NULL );
// horizontal // vertical
LineTo( hdc, rect.right -= rect.left+1, rect.bottom -=
rect.top );
LineTo( hdc, rect.right -= rect.left, rect.top);
//MoveToEx( hdc, 0, 0 , NULL );
SelectObject( hdc, (HPEN) hOldPen );
DeleteObject( hbr );
}
else
PrevWindowProc( hWnd, WM_NCPAINT, hb_parnl( 1 ), 0 );
hb_retnl( 0 );
}
Attached files ATT01133.txt (197 B)Â
Intento hacer una marca en los edit obligatorios con parte de la rutina de
Jose Ramon publicada aqui
pero me sale un efecto raro al cambiar de ventana,pestaña,ect...
Estaria bien consegir un efecto de triangulo en una esquina, pero me
conformo con las lineas del borde
alguien me puede ayudar
#pragma BEGINDUMP
#include "windows.h"
#include "xailer.h"
#include "colors.ch"
#include <commctrl.h>
HB_FUNC_STATIC( TEDIT_WMNCPAINT )
{
PHB_ITEM Self = hb_stackSelfItem();
HWND hWnd = GetHandleOf( Self );
if( XA_ObjGetL( Self, "lObligado" ) )
{
HDC hdc = GetWindowDC( hWnd );
RECT rect;
HPEN hbr = CreatePen( PS_SOLID, 1, clRed );
HPEN hOldPen = SelectObject( hdc, (HPEN) hbr );
GetWindowRect( hWnd, &rect );
rect.right -= rect.left; // Ancho
rect.bottom -= rect.top; // Alto
rect.left = 0;
rect.top = 0;
// arriba // izquierda
MoveToEx( hdc, 0, rect.bottom -= rect.top+1, NULL );
// horizontal // vertical
LineTo( hdc, rect.right -= rect.left+1, rect.bottom -=
rect.top );
LineTo( hdc, rect.right -= rect.left, rect.top);
//MoveToEx( hdc, 0, 0 , NULL );
SelectObject( hdc, (HPEN) hOldPen );
DeleteObject( hbr );
}
else
PrevWindowProc( hWnd, WM_NCPAINT, hb_parnl( 1 ), 0 );
hb_retnl( 0 );
}
Attached files ATT01133.txt (197 B)Â