zekasan Posted April 30, 2015 Report Share Posted April 30, 2015 Bom dia, é um assunto abordado várias vezes, achei este código em C# para alterar as cores do group-box, é possível usarmos no Five com xHarbour? Alguém poderia 'traduzir' ? * borderColor = Cor da borda * textColor = Cor do texto do título do groupbox * radius = Define a curvatura da borda public class myGroupBox:GroupBox { private Color borderColor; private float radius; private Color textColor; public Color BorderColor { get { return this.borderColor; } set { this.borderColor = value; } } public float Radius { get { return this.radius; } set { this.radius = value; } } public Color TextColor { get { return this.textColor; } set { this.textColor = value; } } public myGroupBox() { this.borderColor = Color.Black; this.textColor = Color.Black; this.radius = 8; } protected override void OnPaint(PaintEventArgs e) { GraphicsPath gp = new GraphicsPath(); gp.AddArc(e.ClipRectangle.X + e.ClipRectangle.Width - 2 - (radius * 2), e.ClipRectangle.Y + 8, radius * 2, radius * 2, 270, 90); gp.AddArc(e.ClipRectangle.X + e.ClipRectangle.Width - 2 - (radius * 2), e.ClipRectangle.Y + e.ClipRectangle.Height - 2 - (radius * 2), radius * 2, radius * 2, 0, 90); gp.AddArc(e.ClipRectangle.X, e.ClipRectangle.Y + e.ClipRectangle.Height - 2 - (radius * 2), radius * 2, radius * 2, 90, 90); gp.AddArc(e.ClipRectangle.X, e.ClipRectangle.Y + 8, radius * 2, radius * 2, 180, 90); gp.CloseFigure(); e.Graphics.DrawPath(new Pen(borderColor), gp); Size tSize = TextRenderer.MeasureText(this.Text, this.Font); Rectangle textRect = e.ClipRectangle; textRect.X += 15; textRect.Width = tSize.Width; textRect.Height = tSize.Height; e.Graphics.FillRectangle(new SolidBrush(this.BackColor), textRect); e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(textColor), textRect); } } } Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 30, 2015 Report Share Posted April 30, 2015 Olá, qual é a necessidade disto? Eu ponho cor no GROUP assim e funciona normal: REDEFINE GROUP oGroup ID 501 OF oDlgXml FONT oFnt TRANSPARENT COLOR CLR_HRED abs. aferra 1 Quote Link to comment Share on other sites More sharing options...
zekasan Posted April 30, 2015 Author Report Share Posted April 30, 2015 Kabiaba, a função não muda apenas a cor do título, ela muda a cor do título, da moldura e faz o arredondamento da moldura tb... Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 30, 2015 Report Share Posted April 30, 2015 Mostre uma imagem, quem sabe o Liñares não se interessa. abs. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 4, 2015 Report Share Posted May 4, 2015 Perguntei ao Liñares, vamos ver o que ele responde. http://pt.stackoverflow.com/questions/28710/como-mudar-a-cor-da-borda-de-um-groupbox http://forums.fivetechsupport.com/viewtopic.php?f=6&t=30644 Sinceramente, eu prefiro TRANSPARENT. Abs. Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted May 4, 2015 Report Share Posted May 4, 2015 Ola, tem a classe TGSAY, que é free e vc muda a cor do jeito que quizer, e tb deixa as moldura com arredondamento se assim preferir, utilizo aqui e funciona perfeito. Obs: se fizer uma busca aqui no forum ou no inter, vc ira achar o ink para downloads Abs Luiz Fernando Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 4, 2015 Report Share Posted May 4, 2015 https://app.box.com/shared/lck9effuyn Aqui: https://app.box.com/shared/lck9effuyn/2/6315754 abs. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 4, 2015 Report Share Posted May 4, 2015 Empresoft, sua versão tem, c:\fwh\samples\gdiplus3.prg ?? Estão dizendo no inter que este .prg faz isso. abs Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted May 4, 2015 Report Share Posted May 4, 2015 Kapiaba não tem, aqui estou usando a versão 1104, e esta classe tgsay uso somente na minha tela de PDV. Abs Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 4, 2015 Report Share Posted May 4, 2015 A minha versão só tem: c:\fwh\samples\gdiplus2.prg ?? FWH13.06, creio q a mardita só veio na FWH13.07 ou superior. abs Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 4, 2015 Report Share Posted May 4, 2015 Luiz, ve se compila ai e se entende. http://forums.fivetechsupport.com/viewtopic.php?f=6&t=30644 Aqui é phoda, nóis pedyyyy, vem!! kkkkkkkkkkkkkkkkkkkkkkkk abs. Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted May 4, 2015 Report Share Posted May 4, 2015 Kapiaba pintar o conteudo de um box ja faço a muito tempo com recursos do proprio fivewin, é que o zekasan dize que queria arredondamento das bordas com o codigo abaixo preencho meu group(usando degrade ou não), na epoca quem postou o codigo abaixo foi o toya function PintaFch( aoBox, oDlg , nCor1, nCor2 ) local aRect:={} local x:=0 DEFINE BITMAP oBmp RESOURCE"LOGOMINI" aRect:=GetClientRect( oDlg:hWnd ) for x=1 to len( aoBox ) if x=2 .or. x=4 aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=6 aRect[03]-=2 Gradient( oDlg:hDC, aRect, nRgb(238,158,158),nRgb(240,55,55), .t. ) elseif x=5 aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=0 aRect[03]-=2 Gradient( oDlg:hDC, aRect, nCor1, nCor2, .t. ) elseif x=1 .or. x=3 aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=6 aRect[03]-=2 Gradient( oDlg:hDC, aRect,nRgb(169,236,169),nRgb(19,159,19), .t. ) else aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=6 aRect[03]-=2 Gradient( oDlg:hDC, aRect, nCor1, nCor2, .t. ) endif next ABPaint( oDlg:hDC, 945, 07, oBmp:hBitmap, 220 ) return nil Abs Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 5, 2015 Report Share Posted May 5, 2015 Kapiaba pintar o conteudo de um box ja faço a muito tempo com recursos do proprio fivewin, é que o zekasan dize que queria arredondamento das bordas com o codigo abaixo preencho meu group(usando degrade ou não), na epoca quem postou o codigo abaixo foi o toya function PintaFch( aoBox, oDlg , nCor1, nCor2 ) local aRect:={} local x:=0 DEFINE BITMAP oBmp RESOURCE"LOGOMINI" aRect:=GetClientRect( oDlg:hWnd ) for x=1 to len( aoBox ) if x=2 .or. x=4 aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=6 aRect[03]-=2 Gradient( oDlg:hDC, aRect, nRgb(238,158,158),nRgb(240,55,55), .t. ) elseif x=5 aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=0 aRect[03]-=2 Gradient( oDlg:hDC, aRect, nCor1, nCor2, .t. ) elseif x=1 .or. x=3 aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=6 aRect[03]-=2 Gradient( oDlg:hDC, aRect,nRgb(169,236,169),nRgb(19,159,19), .t. ) else aRect:=GetCoors( aoBox[x]:hWnd ) aRect[01]+=6 aRect[03]-=2 Gradient( oDlg:hDC, aRect, nCor1, nCor2, .t. ) endif next ABPaint( oDlg:hDC, 945, 07, oBmp:hBitmap, 220 ) return nil Abs Luiz, mostre como é a chamada no programa a esta função, e RESOURCE "LOGOMINI" qual é tamanho desta *.BMP? abs. Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted May 5, 2015 Report Share Posted May 5, 2015 Kapiaba segue o código abaixo, a imagem é uma figura que converti para aphabmp, acho que nas versão novas do fivewin ele já suporta figura PNG Obs: como o tópico falava de group eu coloquei o exemplo acima, mais na verdade peguei isto nos meus backup antigo, pq hoje substitui isto pela classe TTITLE do fivewin que faz o mesmo efeito. DEFINE BITMAP oFch2 RESOURCE"LOGOMINI" redefine group aBox[1] id 4004 of oFch TRANSPARENT redefine group aBox[2] id 4005 of oFch TRANSPARENT redefine group aBox[3] id 4003 of oFch TRANSPARENT redefine group aBox[4] id 4006 of oFch TRANSPARENT redefine group aBox[5] id 4001 of oFch TRANSPARENT redefine group aBox[6] id 4012 of oFch TRANSPARENT redefine group aBox[7] id 4013 of oFch TRANSPARENT redefine group aBox[8] id 4017 of oFch TRANSPARENT redefine group aBox[9] id 4018 of oFch TRANSPARENT oFch:bpainted:={ ||; PintaFch( aBox, oFch, LIGHTCYAN, DARKCYAN ,oFch1,oFch2)} evertonlb 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 5, 2015 Report Share Posted May 5, 2015 Legal, visual fica da hora... // FiveWin Class TTitle C:\FWH\SAMPLES\TESTTITL.PRG #include "fivewin.ch" #include "ttitle.ch" Function main() local oWnd local oTitle1, oTitle2, oTitle3, oTitle4, oTitle5 local oBrush1, oBrush2, oBrush3, oBrush4 LOCAL oFont1, oFont2, oFont3 DEFINE BRUSH oBrush1 FILE "..\bitmaps\backgrnd\paper.bmp" DEFINE BRUSH oBrush2 FILE "..\bitmaps\backgrnd\iron.bmp" DEFINE BRUSH oBrush3 STYLE "NULL" DEFINE BRUSH oBrush4 FILE "..\bitmaps\backgrnd\wood.bmp" DEFINE WINDOW oWnd TITLE "TTitle Class Test" BRUSH oBrush1 DEFINE FONT oFont1 NAME "Blackoak Std" size 30, 60 DEFINE FONT oFont2 NAME "Times New Roman" size 10, 30 DEFINE FONT oFont3 NAME "Blackoak Std" size 30, 60 NESCAPEMENT 900 // Title 1 Horizontal ( top ) @ 015,150 TITLE oTitle1 size 460, 60 of oWnd SHADOW TOPRIGHT oTitle1:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } } oTitle1:nShadowIntensity = 70 @ 10, 10 TITLETEXT OF oTitle1 TEXT "FIVEWIN 9.07" FONT oFont1 BRUSH oBrush1 // Title 2 Vertical( Left ) @ 50, 80 TITLE oTitle2 size 60, 460 of oWnd SHADOW topleft SHADOWSIZE 5 @ 450, 10 TITLETEXT OF oTitle2 TEXT "FIVEWIN 9.07" FONT oFont3 PEN GetStockObject( 8 ) //Title 3 Horizontal ( Center ) @ 250, 150 TITLE oTitle3 size 460, 60 of oWnd SHADOW topleft BASE TRANSPARENT NOBORDER @ 2, 20 TITLETEXT OF oTitle3 TEXT "FIVEWIN 9.07" FONT oFont1 brush oBrush4 3D SHADOW TOPLEFT //Title 4 Vertical ( Right ) @ 50, 630 TITLE oTitle4 size 60, 460 of oWnd SHADOW TOPRIGHT @ 5, 10 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\32X32\keys.bmp" SIZE 30, 30 REFLEX TRANSPARENT @ 65, 10 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\AlphaBmp\explorer.BMP" SIZE 30, 30 REFLEX ANIMA @ 125, 10 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\32X32\keys.bmp" SIZE 30, 30 REFLEX TRANSPARENT @ 185, 5 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\AlphaBmp\movie.BMP" SIZE 50, 60 ANIMA LEVEL 100 @ 245, 5 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\AlphaBmp\movie.bmp" SIZE 50, 60 ANIMA LEVEL 255 @ 305, 10 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\AlphaBmp\explorer.BMP" SIZE 30, 30 REFLEX ANIMA @ 365, 10 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\32X32\keys.bmp" SIZE 30, 30 REFLEX TRANSPARENT @ 425, 10 TITLEIMG OF oTitle4 BITMAP "..\bitmaps\AlphaBmp\explorer.BMP" SIZE 30, 30 REFLEX ANIMA //Title 5 Horizontal( Down ) @ 480, 150 TITLE oTitle5 size 460, 60 of oWnd SHADOW BOTTOMLEFT SHADOWSIZE 2 @ 5, 10 TITLEIMG OF oTitle5 BITMAP "../bitmaps\32X32\keys.bmp" SIZE 30, 30 REFLEX TRANSPARENT ANIMA @ 20, 60 TITLETEXT OF oTitle5 TEXT "<== Move over me" COLOR CLR_BLACK @ 14, 220 TITLETEXT OF oTitle5 TEXT "FIVEWIN 9.07" COLOR CLR_BLACK FONT oFont2 3d @ 5, 400 TITLEIMG OF oTitle5 BITMAP "../bitmaps\fivetech.bmp" SIZE 30, 30 REFLEX oTitle5:nShadowIntensity = 70 activate window oWnd maximized oBrush4:end() oBrush3:end() oBrush2:End() oBrush1:End() oFont1:End() oFont2:End() oFont3:End() return nil /* viu ai estou usando a classe nativa [11:24:33] Luiz Fernando Fuzatti: ttitle REDEFINE TITLE oTitle7 ID 4005 OF oFch1 SHADOW NOSHADOW oTitle7:lBorder:=.F. oTitle7:aGrdBack = { { 1, nRgb(238,158,158),nRgb(240,55,55)} } @ 07,005 TITLETEXT OF oTitle7 TEXT "R$ VENCIDO" font Arial14B [11:25:07] Luiz Fernando Fuzatti: inicio do prg #include "ttitle.ch" ID 4005 é um group criado do pelles [11:26:17] Luiz Fernando Fuzatti: REDEFINE TITLE oTitle ID 4001 OF oFch SHADOW NOSHADOW oTitle:lBorder:=.F. @ 10,004 TITLETEXT OF oTitle TEXT 'FICHA DE CLIENTE "Informações de Venda"' font Arial18B @ 05,940 TITLEIMG OF oTitle BITMAP "LOGOMINI" SIZE 60,40 ANIMA LEVEL 220 [11:26:43] Luiz Fernando Fuzatti: LOGOMINI esta dentro do arquivo resource REDEFINE TITLE oTitle ID 4001 OF oFch1 SHADOW NOSHADOW oTitle:lBorder:=.F. @ 10,004 TITLETEXT OF oTitle TEXT 'Ficha Financeira de Cliente' font Arial22B color nRgb(255,255,255) @ 05,940 TITLEIMG OF oTitle BITMAP "LOGOMINI" SIZE 60,40 ANIMA LEVEL 220 */ evertonlb 1 Quote Link to comment Share on other sites More sharing options...
evertonlb Posted May 5, 2015 Report Share Posted May 5, 2015 O Kapiaba, porque não coloca uma imagem pra gente ver como que fica? Att. Everton kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 5, 2015 Report Share Posted May 5, 2015 agora não dá, estou comendo o meu xandelyyy.......... kkkkkkkkkk, basta seguir as dicas do Luiz. Quote Link to comment Share on other sites More sharing options...
Geraldo (gbsilva) Posted May 8, 2015 Report Share Posted May 8, 2015 Pessoal deixa eu aproveitar o tópico, cor no Group tudo bem, mas e a fonte em tempo de execução. Tentei colocar uma fonte maior e não deu certo, aparece as duas o texto que esta na dialog e o texto sobreposto pelo novo tamanho da fonte. se coloco nFont fica normal se tento sFont que é maior fica as duas mensagens. Abaixo como tentei: DEFINE FONT nFont NAME "Ms Sans Serif" SIZE 0,-10 DEFINE FONT sFont NAME "Time New Roman" SIZE 0,16 BOLD REDEFINE GROUP oGroup ID 4002 OF oDlg PROMPT "Novo Titulo do Group" FONT sFont TRANSPARENT COLOR CLR_HRED Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 8, 2015 Report Share Posted May 8, 2015 SET FONT OF oDlg TO oFont Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.