اذهب الي المحتوي
أوفيسنا

كود توسيط نمودج على جميع الشاشات


jamal2080

الردود الموصى بها

Dim frm As Form
Dim intScreenWidth As Integer
Dim intScreenHeight As Integer
Dim intFormWidth As Integer
Dim intFormHeight As Integer
Dim intLeft As Integer
Dim intTop As Integer

' احضار مرجع للنموذج الحالي
Set frm = Screen.ActiveForm

' الحصول على عرض الشاشة وارتفاعها
intScreenWidth = Screen.Width / Screen.twipsPerPixelX
intScreenHeight = Screen.Height / Screen.TwipsPerPixelY

' الحصول على عرض وارتفاع النموذج
intFormWidth = frm.Width / frm.ScaleX
intFormHeight = frm.Height / frm.ScaleY

' حساب الموضع الأفقي المتوسط
intLeft = (intScreenWidth - intFormWidth) / 2

' حساب الموضع الرأسي المتوسط
intTop = (intScreenHeight - intFormHeight) / 2

' تعيين الموضع الجديد للنموذج
frm.Move intLeft * frm.ScaleX, intTop * frm.ScaleY

 

تم تعديل بواسطه jamal2080
للون خظ
  • Like 1
رابط هذا التعليق
شارك

في 16‏/9‏/2023 at 15:32, jamal2080 said:
Dim frm As Form
Dim intScreenWidth As Integer
Dim intScreenHeight As Integer
Dim intFormWidth As Integer
Dim intFormHeight As Integer
Dim intLeft As Integer
Dim intTop As Integer

' احضار مرجع للنموذج الحالي
Set frm = Screen.ActiveForm

' الحصول على عرض الشاشة وارتفاعها
intScreenWidth = Screen.Width / Screen.twipsPerPixelX
intScreenHeight = Screen.Height / Screen.TwipsPerPixelY

' الحصول على عرض وارتفاع النموذج
intFormWidth = frm.Width / frm.ScaleX
intFormHeight = frm.Height / frm.ScaleY

' حساب الموضع الأفقي المتوسط
intLeft = (intScreenWidth - intFormWidth) / 2

' حساب الموضع الرأسي المتوسط
intTop = (intScreenHeight - intFormHeight) / 2

' تعيين الموضع الجديد للنموذج
frm.Move intLeft * frm.ScaleX, intTop * frm.ScaleY

من فضلك لو وقتك يسمح تعمل لنا مثال 

  • Like 1
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information