Autor Tema: ucImage llamar a pagina de propiedades en tiempo de Ejecucion  (Leído 5306 veces)

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

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« en: Octubre 13, 2014, 02:25:42 pm »
Hola en tiempo de diseño el ucimagen de cobein se puede utilizar sin problema, ahora hay una manera de llamar a este ya estando en ejecución el programa.

screen


http://snag.gy/JsK57.jpg
CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo

Albertomi

  • Gigabyte
  • ****
  • Mensajes: 281
  • Reputación: +153/-0
    • Ver Perfil
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #1 en: Octubre 13, 2014, 02:46:45 pm »
Estimado ENTER
 
Usa el siguiente código para cargar desde un archivo
Código: [Seleccionar]
Dim blnRetVal As Boolean
 
blnRetVal = ucImageOriginal.LoadImageFromFile("C:\Pictures\veryhot_post.gif")

Saludos, desde algún lugar de Lima-Perú
Saludos, desde algún lugar de Lima-Perú

YAcosta

  • Moderador Global
  • Exabyte
  • *****
  • Mensajes: 2853
  • Reputación: +160/-38
  • Daddy de Qüentas y QüeryFull
    • Ver Perfil
    • Personal
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #2 en: Octubre 13, 2014, 02:49:00 pm »
¿Te refieres a cargar otra imagen?
Si es de un archivo local:

ucFoto.LoadImageFromFile "C:\TuImagen.png"

A eso te refieres doc?

EDITO: El amigo Albertomi contesto y veo que es diferente su respuesta... entonces no entendi jajaj, ya aclararas a que te referias.  Saludos
Me encuentras en YAcosta.com

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #3 en: Octubre 13, 2014, 03:27:44 pm »
No lo que yo quiero hacer es llamar a este


http://snag.gy/lgpg8.jpg

Pero en tiempo de ejecucion
CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo

YAcosta

  • Moderador Global
  • Exabyte
  • *****
  • Mensajes: 2853
  • Reputación: +160/-38
  • Daddy de Qüentas y QüeryFull
    • Ver Perfil
    • Personal
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #4 en: Octubre 13, 2014, 03:48:57 pm »
Precisamente a ese?? creo que es interno. ¿porque no mejor te creas la interfaz? (usando por ejemplo el file y dir o algo asi), le das al usuario la opcion de buscar el archivo, muestras el previo y cuando acepte lo asignas donde debas asignarlo
Me encuentras en YAcosta.com

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #5 en: Octubre 13, 2014, 04:02:12 pm »
Si eso mismo estaba pensando pense que se podia solo por eso pregunte.

Pero lo solucione modificando el codigo que trae esa pagina de propiedades, es para evitar usar el OCx del commanddialog.
CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo

YAcosta

  • Moderador Global
  • Exabyte
  • *****
  • Mensajes: 2853
  • Reputación: +160/-38
  • Daddy de Qüentas y QüeryFull
    • Ver Perfil
    • Personal
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #6 en: Octubre 13, 2014, 04:21:45 pm »
a chevere... y como la hiciste?? que modificaste?
Me encuentras en YAcosta.com

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #7 en: Octubre 13, 2014, 04:50:39 pm »
Lo hice asi:

Esto en un Modulo

Código: (VB) [Seleccionar]
Option Explicit

Public Const FILTER_PICTURES As String = "Pictures|*.bmp;*.gif;*.jpg;*.jpeg;*.png;*.dib;*.rle;*.jpe;*.jfif;*.emf;*.wmf;*.tif;*.tiff;*.ico;*.cur"

Public Const MAX_PATH = 260
Public Const MAX_FILE = 260

Public Enum EOpenFiles
    OFN_READONLY = &H1
    OFN_OVERWRITEPROMPT = &H2
    OFN_HIDEREADONLY = &H4
    OFN_NOCHANGEDIR = &H8
    OFN_SHOWHELP = &H10
    OFN_ENABLEHOOK = &H20
    OFN_ENABLETEMPLATE = &H40
    OFN_ENABLETEMPLATEHANDLE = &H80
    OFN_NOVALIDATE = &H100
    OFN_ALLOWMULTISELECT = &H200
    OFN_EXTENSIONDIFFERENT = &H400
    OFN_PATHMUSTEXIST = &H800
    OFN_FILEMUSTEXIST = &H1000
    OFN_CREATEPROMPT = &H2000
    OFN_SHAREAWARE = &H4000
    OFN_NOREADONLYRETURN = &H8000&
    OFN_NOTESTFILECREATE = &H10000
    OFN_NONETWORKBUTTON = &H20000
    OFN_NOLONGNAMES = &H40000
    OFN_EXPLORER = &H80000
    OFN_NODEREFERENCELINKS = &H100000
    OFN_LONGNAMES = &H200000
End Enum

Private Type OPENFILENAMEs
    lStructSize As Long          ' Filled with UDT size
    hWndOwner As Long            ' Tied to Owner
    hInstance As Long            ' Ignored (used only by templates)
    lpstrFilter As String        ' Tied to Filter
    lpstrCustomFilter As String  ' Ignored (exercise for reader)
    nMaxCustFilter As Long       ' Ignored (exercise for reader)
    nFilterIndex As Long         ' Tied to FilterIndex
    lpstrFile As String          ' Tied to FileName
    nMaxFile As Long             ' Handled internally
    lpstrFileTitle As String     ' Tied to FileTitle
    nMaxFileTitle As Long        ' Handled internally
    lpstrInitialDir As String    ' Tied to InitDir
    lpstrTitle As String         ' Tied to DlgTitle
    flags As Long                ' Tied to Flags
    nFileOffset As Integer       ' Ignored (exercise for reader)
    nFileExtension As Integer    ' Ignored (exercise for reader)
    lpstrDefExt As String        ' Tied to DefaultExt
    lCustData As Long            ' Ignored (needed for hooks)
    lpfnHook As Long             ' Ignored (good luck with hooks)
    lpTemplateName As Long       ' Ignored (good luck with templates)
End Type

Public Declare Function GetFileTitle Lib "COMDLG32" Alias "GetFileTitleA" (ByVal szFile As String, ByVal szTitle As String, ByVal cbBuf As Long) As Long
Public Declare Function GetOpenFileName Lib "COMDLG32" Alias "GetOpenFileNameA" (file As OPENFILENAMEs) As Long
Public Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long

Public m_sFile As String

Public Function VBGetOpenFileName(Filename As String, Optional FileTitle As String, Optional FileMustExist As Boolean = True, Optional MultiSelect As Boolean = False, Optional ReadOnly As Boolean = False, Optional HideReadOnly As Boolean = False, Optional Filter As String = "All (*.*)| *.*", Optional FilterIndex As Long = 1, Optional InitDir As String, Optional DlgTitle As String, Optional DefaultExt As String, Optional Owner As Long = -1, Optional flags As Long = 0) As Boolean

    Dim opfile As OPENFILENAMEs, S As String, afFlags As Long
 
    With opfile
        .lStructSize = Len(opfile)
       
        .flags = (-FileMustExist * OFN_FILEMUSTEXIST) Or _
           (-MultiSelect * OFN_ALLOWMULTISELECT) Or _
           (-ReadOnly * OFN_READONLY) Or _
           (-HideReadOnly * OFN_HIDEREADONLY) Or _
           (flags And CLng(Not (OFN_ENABLEHOOK Or _
           OFN_ENABLETEMPLATE)))
           
        If Owner <> -1 Then .hWndOwner = Owner
        .lpstrInitialDir = InitDir
        .lpstrDefExt = DefaultExt
        .lpstrTitle = DlgTitle
   
        ' To make Windows-style filter, replace | and : with nulls
        Dim ch As String, i As Integer
        For i = 1 To Len(Filter)
            ch = Mid$(Filter, i, 1)
            If ch = "|" Or ch = ":" Then
                S = S & vbNullChar
            Else
                S = S & ch
            End If
        Next
       
        S = S & vbNullChar & vbNullChar
        .lpstrFilter = S
        .nFilterIndex = FilterIndex

        ' Pad file and file title buffers to maximum path
        S = Filename & String$(MAX_PATH - Len(Filename), 0)
        .lpstrFile = S
        .nMaxFile = MAX_PATH
        S = FileTitle & String$(MAX_FILE - Len(FileTitle), 0)
        .lpstrFileTitle = S
        .nMaxFileTitle = MAX_FILE
        ' All other fields set to zero
   
        If GetOpenFileName(opfile) = 1 Then
            ' Success
            VBGetOpenFileName = True
            Filename = StrZToStr(.lpstrFile)
            FileTitle = StrZToStr(.lpstrFileTitle)
            flags = .flags
            ' Return the filter index
            FilterIndex = .nFilterIndex
            ' Look up the filter the user selected and return that
            Filter = FilterLookup(.lpstrFilter, FilterIndex)
            If (.flags And OFN_READONLY) Then ReadOnly = True
        End If
    End With
End Function

Public Function StrZToStr(S As String) As String
    StrZToStr = Left$(S, lstrlen(S))
End Function

Public Function FilterLookup(ByVal sFilters As String, ByVal iCur As Long) As String
   
    Dim iStart As Long, iEnd As Long, S As String
    iStart = 1
   
    If sFilters = "" Then Exit Function
   
    Do
       
        iEnd = InStr(iStart, sFilters, vbNullChar)
       
        If iEnd = 0 Then Exit Function
        iEnd = InStr(iEnd + 1, sFilters, vbNullChar)
       
        If iEnd Then
            S = Mid$(sFilters, iStart, iEnd - iStart)
        Else
            S = Mid$(sFilters, iStart)
        End If
       
        iStart = iEnd + 1
       
        If iCur = 1 Then
            FilterLookup = S
            Exit Function
        End If
       
        iCur = iCur - 1
       
    Loop While iCur
   
End Function

Public Sub TraerFotoDir(ByVal xPicture As ucImage)
   
    Dim sFile       As String
    Dim svName()    As String

    If VBGetOpenFileName(sFile, Filter:=FILTER_PICTURES) Then
        m_sFile = sFile
        xPicture.LoadImageFromFile m_sFile
    End If

End Sub


Esto en un Boton.

Código: (VB) [Seleccionar]
Private Sub Command1_Click()
    Call TraerFotoDir(picFoto1)
End Sub



Asi no tengo que agregar el control CommanDialog en mi proyecto.
CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo

YAcosta

  • Moderador Global
  • Exabyte
  • *****
  • Mensajes: 2853
  • Reputación: +160/-38
  • Daddy de Qüentas y QüeryFull
    • Ver Perfil
    • Personal
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #8 en: Octubre 13, 2014, 06:19:24 pm »
Genial, se agradece.
Me encuentras en YAcosta.com

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #9 en: Octubre 16, 2014, 12:20:09 am »
Enter, esta bien lo que hiciste, pero digo esto para aclarar, no deberia haber problemas con el  OCx del commanddialog en una pagina de propiedades, esto es porque la pag de prop solo se ejecutan en tiempo de diseño y no en ejecución, por lo tanto interpreto que si el programador tiene el vb6 instalado tambien tiene el ocx del commanddialog.

Saludos.

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
Re:ucImage llamar a pagina de propiedades en tiempo de Ejecucion
« Respuesta #10 en: Octubre 16, 2014, 10:32:54 am »
No no yo no tengo problemas con el OCx del commanddialog, lo que quiero es evitar no mas usar ese OCx, por que cuando se lleva el sistema a otra pc a veces no tiene commdlg32.ocx y hay que estar registrando manualmente es solo para evitar eso amigo.
CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo