نمایش نتایج 1 تا 5 از 5

نام تاپیک: خطا در استفاده از Function

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #1
    کاربر دائمی آواتار پرستو پارسایی
    تاریخ عضویت
    آبان 1392
    محل زندگی
    تهران
    پست
    458

    خطا در استفاده از Function

    با سلام من در یک پروژه از این 3 Function استفاده میکنم و کاملا بی عیب کار میکنه ولی در ویژوال استودیو در قسمت Error List با ارور های در عکس روبرو میشم لطفا در صورت اطلاع راهنمایی بفرمایید.


    در خط دوم این فانکشن زیر Exit Function خط سبز هست

     Private Function DrawPic(ByVal ZoomX As Single, ByVal ZoomY As Single) As Boolean 
    If IsNothing(srcBitmap) Then Exit Function


    If srcHDC.Equals(IntPtr.Zero) Then
    srcHDC = CreateCompatibleDC(IntPtr.Zero)
    HBitmapSrc = srcBitmap.GetHbitmap()
    SelectObject(srcHDC, HBitmapSrc)
    End If


    If desHDC.Equals(IntPtr.Zero) Then
    If IsNothing(Gr) Then
    Gr = Host.CreateGraphics
    End If
    desHDC = Gr.GetHdc()
    SetStretchBltMode(desHDC, 3)
    End If






    Xout = False
    Yout = False


    If Host.Width > srcBitmap.Width * Zfactor Then
    Mrec.X = 0
    Mrec.Width = srcBitmap.Width
    Brec.X = (Host.Width - srcBitmap.Width * Zfactor) / 2
    Brec.Width = srcBitmap.Width * Zfactor


    BitBlt(desHDC, 0, 0, Brec.X, Host.Height, srcHDC, 0, 0, TernaryRasterOperations.BLACKNESS)
    BitBlt(desHDC, Brec.Right, 0, Brec.X, Host.Height, srcHDC, 0, 0, TernaryRasterOperations.BLACKNESS)
    Else
    Mrec.X = Mrec.X + ((Host.Width / oldZfactor - Host.Width / Zfactor) / ((Host.Width + 0.001) / ZoomX))
    Mrec.Width = Host.Width / Zfactor
    Brec.X = 0
    Brec.Width = Host.Width
    End If


    If Host.Height > srcBitmap.Height * Zfactor Then
    Mrec.Y = 0
    Mrec.Height = srcBitmap.Height
    Brec.Y = (Host.Height - srcBitmap.Height * Zfactor) / 2
    Brec.Height = srcBitmap.Height * Zfactor


    BitBlt(desHDC, 0, 0, Host.Width, Brec.Y, srcHDC, 0, 0, TernaryRasterOperations.BLACKNESS)
    BitBlt(desHDC, 0, Brec.Bottom, Host.Width, Brec.Y, srcHDC, 0, 0, TernaryRasterOperations.BLACKNESS)
    Else
    Mrec.Y = Mrec.Y + ((Host.Height / oldZfactor - Host.Height / Zfactor) / ((Host.Height + 0.001) / ZoomY))
    Mrec.Height = Host.Height / Zfactor
    Brec.Y = 0
    Brec.Height = Host.Height
    End If


    oldZfactor = Zfactor
    '-----------------------------------


    If Mrec.Right > srcBitmap.Width Then
    Xout = True
    Mrec.X = (srcBitmap.Width - Mrec.Width)
    End If


    If Mrec.X < 0 Then
    Xout = True
    Mrec.X = 0
    End If


    If Mrec.Bottom > srcBitmap.Height Then
    Yout = True
    Mrec.Y = (srcBitmap.Height - Mrec.Height)
    End If


    If Mrec.Y < 0 Then
    Yout = True
    Mrec.Y = 0
    End If


    StretchBlt(desHDC, Brec.X, Brec.Y, Brec.Width, Brec.Height, _
    srcHDC, Mrec.X, Mrec.Y, Mrec.Width, Mrec.Height, _
    TernaryRasterOperations.SRCCOPY)


    Gr.ReleaseHdc(desHDC)
    desHDC = Nothing
    End Function



    در این کد در آخرین خط زیر End Function خط سبز هست

     Public Function Dispose()
    If Not IsNothing(srcBitmap) Then
    srcBitmap.Dispose()
    srcBitmap = Nothing
    End If


    If Not srcHDC.Equals(IntPtr.Zero) Then
    DeleteDC(srcHDC)
    srcHDC = Nothing
    End If


    If Not IsNothing(Gr) Then
    Gr.Dispose()
    Gr = Nothing
    End If


    GC.Collect()
    End Function



    در این کد در آخر خط در Returnl.Handle.ToInt64 زیر l خط سبز داره
     Public Function lang_changer_selectable(ByVal lang As String) As Int64 'load the main form's lamguage        Dim l As InputLanguage
    Dim ll As InputLanguageCollection
    Dim a As String
    Try
    ll = InputLanguage.InstalledInputLanguages
    For Each l In ll
    a = Microsoft.VisualBasic.Left(l.LayoutName, 1)


    Select Case lang
    Case "EN"
    If a = "E" Or a = "e" Or a = "u" Or a = "U" Then
    Application.CurrentInputLanguage = l
    Exit For
    End If
    Case "FA"
    If a = "F" Or a = "f" Or a = "P" Or a = "p" Then
    Application.CurrentInputLanguage = l
    Exit For
    End If
    Case "67699721" 'us
    If l.Handle.ToString = lang Then
    Application.CurrentInputLanguage = l
    Exit For
    End If
    Case "69796905" 'fa
    If l.Handle.ToString = lang Then
    Application.CurrentInputLanguage = l
    Exit For
    End If
    End Select
    Next
    FileClose(1)
    Catch ex As Exception
    End Try
    Return l.Handle.ToInt64
    End Function



    سپاسگزارم
    عکس های ضمیمه عکس های ضمیمه
    آخرین ویرایش به وسیله پرستو پارسایی : سه شنبه 25 شهریور 1399 در 13:01 عصر

تاپیک های مشابه

  1. سوال: کار نکردن function و return false هنگام فراخواندن function با OnSubmit
    نوشته شده توسط shayan.nabavi در بخش طراحی وب (Web Design)
    پاسخ: 0
    آخرین پست: جمعه 18 تیر 1395, 02:55 صبح
  2. استفاده از sp درون function
    نوشته شده توسط ehsanlionel در بخش T-SQL
    پاسخ: 1
    آخرین پست: سه شنبه 01 اسفند 1391, 16:41 عصر
  3. حرفه ای: با PHP چطوری میشه یه همچین چیزی ساخت؟ <class:function function=methods>
    نوشته شده توسط paayab در بخش PHP
    پاسخ: 7
    آخرین پست: سه شنبه 18 بهمن 1390, 17:29 عصر
  4. نحوه استفاده از function
    نوشته شده توسط amirtofighi در بخش مباحث عمومی دلفی و پاسکال
    پاسخ: 6
    آخرین پست: دوشنبه 12 بهمن 1388, 16:21 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •