Autor Tema: How to move the ClsButtonNC button?  (Leído 4329 veces)

0 Usuarios y 1 Visitante están viendo este tema.

swerd

  • Bit
  • Mensajes: 5
  • Reputación: +0/-0
    • Ver Perfil
How to move the ClsButtonNC button?
« en: Diciembre 26, 2012, 11:07:29 am »
Hello and Feliz Navidad,

I found the ClsButtonNC, I like it.

I would like to use a button looks like regular Window button, e.g. Minimize, picture is no problem.
The problem I have is, I like place this new button left to the button Minimize.
Hove I can move the ClsButtonNC button to this place?

Best Regards

swerd

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:How to move the ClsButtonNC button?
« Respuesta #1 en: Diciembre 27, 2012, 11:52:15 pm »
Hi Swerd , welcome to the forum.

see this
Código: [Seleccionar]
    Set cButtonNC1 = New ClsButtonNC
   
    With cButtonNC1
        .CreateButton Me.hWnd, "Hide"
        .LoadImageFromFile (App.Path & "\Flecha.png")
       
        .Right = -110
        .Top = 0
        .MoveMode = TopRight
    End With

the measures began to eye, but surely there is a way to calculate the size of Bontes close, minimize, maximize

swerd

  • Bit
  • Mensajes: 5
  • Reputación: +0/-0
    • Ver Perfil
Re:How to move the ClsButtonNC button?
« Respuesta #2 en: Diciembre 28, 2012, 04:17:03 pm »
Hello Leandro,

tnx for the answer.
In my tests I used  .MoveMode = TopRight and the button was on the right side.
Then I used the minus value to move to the left, but the button stayed on the right.
At the moment I do not remember where I placed the minus value.

In the next week I will be back home, then I will try your advice.

But before this I've got one question more.

In Form_Resize(),
there is also
cButtonNC1.Left = BorderWidth

Shall I change it to cButtonNC1.Right?
Shall I replace the BorderWidth  by the same value   -110?

Best Regards

swerd

swerd

  • Bit
  • Mensajes: 5
  • Reputación: +0/-0
    • Ver Perfil
Re:How to move the ClsButtonNC button?
« Respuesta #3 en: Enero 03, 2013, 04:07:32 pm »
Happy New Year.

It works, thanks.

The problem was, I changed .MoveMode to TopRight, but did not change .Left to .Right, and then I tried with values in Form_Resize.
This worked with  .Left, (button was moved), but not with .Right.
Now it works, the button is related to the right side and can be moved.

But the original problem was (is), on a XP the project name Proyecto1 will be displayed in title line, but on W7 not, there in no project name.
I thought this happens because the ClsButtonNC is related to the left side, and if I will relate it to the right, then left side will stay free and  Proyecto1 will be displayed.
I was wrong, Proyecto1 will be not displayed too.

Probably it is not possible.
If you have an idea how to view the project name on W7, I will be glad to have your advise.

Thanks again
swerd

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:How to move the ClsButtonNC button?
« Respuesta #4 en: Enero 04, 2013, 06:21:35 am »
Hi, I can hardly understand him, could put a screenshot

swerd

  • Bit
  • Mensajes: 5
  • Reputación: +0/-0
    • Ver Perfil
Re:How to move the ClsButtonNC button?
« Respuesta #5 en: Enero 04, 2013, 06:27:09 pm »
You are right, pictures can better explain.

1. On XP with the ClsButtonNC.cls active the text “Form1” is visible

XP-ClsButtonNC-on.png


2. On W7 with the ClsButtonNC.cls not active the text “Form1” is visible

W7-ClsButtonNC-off.png



3. On W7 with the ClsButtonNC.cls active the text “Form1” is not visible

W7-ClsButtonNC-on.png


The question is, how to display the text “Form1” on W7 with activated ClsButtonNC.cls?

swerd


LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:How to move the ClsButtonNC button?
« Respuesta #6 en: Enero 05, 2013, 06:25:01 am »
aaaa easy

remove this code

Código: [Seleccionar]
    If WindowVersion > 5 Then 'Window Vista or Seven
        'En windows Vista o Seven quita el icono, el caption,el SysMenu, y la Ayuda
        Dim uWTAO As WTA_OPTIONS
   
        With uWTAO
            .dwFlags = WTNCA.VALIDBITS
            .dwMask = WTNCA.VALIDBITS
        End With
       
        SetWindowThemeAttribute Me.hWnd, WTA_NONCLIENT, uWTAO, LenB(uWTAO)
    End If

swerd

  • Bit
  • Mensajes: 5
  • Reputación: +0/-0
    • Ver Perfil
Re:How to move the ClsButtonNC button?
« Respuesta #7 en: Enero 05, 2013, 05:02:11 pm »
Oh, it's very easy, now I see this too, and it works too.

Tnx Leandro for the info.

swerd