تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
كود كتابة اسم او جملة على سطج المكتب
#1
السلام عليكم و رحمة الله تعالى و بركاته
اخوتي في الله رمضانكم سعيد اسأل الله العلي القدير ان رفع به من درجاتكم في الجنة و ان يرزقكم فيه من حيث لا تحتسبون

طلب مني ان ابرمج برنامج VB.net ان يعمل على كتابة كلمة او جملة حسب رغبة المستخدم في سطح المكتب و بحثت كثيرا

في الانترنت ووجدت شرحا لكن تم حدف الصور التي بها الكود . لذلك لجأت اليكم لمساعدتي
و جزاكم الله الف خير

هذا هو رابط الموضوع الذي وجدت


http://www.startimes.com/f.aspx?t=18171825
الرد }}}
تم الشكر بواسطة:
#2
السلام عليكم

تفضل اخي العزيز

كود :
Imports System.Drawing.Drawing2D
Imports System.Runtime.InteropServices

<DllImport("User32.dll")> _
        Private Shared Function GetDC(hwnd As IntPtr) As IntPtr
        End Function

        <DllImport("User32.dll")> _
        Private Shared Sub ReleaseDC(dc As IntPtr)

Private Sub Button1Click(sender As Object, e As EventArgs)
            Dim desktop As IntPtr = GetDC(IntPtr.Zero)
            Using g As Graphics = Graphics.FromHdc(desktop)
                g.DrawString("sajad", New Font("Arial", 12), Brushes.Blue, 0, 10)
            End Using
            ReleaseDC(desktop)
        End Sub

المثال منقول كان ب#C حولته الى VB
الرد }}}
تم الشكر بواسطة: ربيع
#3
السلام عليكم ورحمة الله وبركاته

نفس الكود السابق تعديل بسيط ليظهر النص في منتصف الشاشة :
كود :
Imports System.Drawing.Drawing2D
Imports System.Runtime.InteropServices


Public Class Form1


    <DllImport("User32.dll")> _
  Private Shared Function GetDC(ByVal hwnd As IntPtr) As IntPtr
    End Function


    <DllImport("User32.dll")> _
    Private Shared Sub ReleaseDC(ByVal dc As IntPtr)
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim desktop As IntPtr = GetDC(IntPtr.Zero)
        Using g As Graphics = Graphics.FromHdc(desktop)
            Dim SL As Drawing.Rectangle = Screen.PrimaryScreen.WorkingArea
            g.DrawString("اللهم صلي علي محمد وعلي آل محمد", New Font("Arial", 20, FontStyle.Bold), Brushes.White, SL.Width / 2 - 100, SL.Height / 2)
        End Using
        ReleaseDC(desktop)
    End Sub


End Class

ملحوظة : النص سيختفي من الشاشة بمجرد عمل تحديث للشاشة (F5) ، أو في حالة أغلقت البرنامج سيتم مسح النص أيضاً .
****
***
**
*
(وَقُل رَّبِّ زِدْنِي عِلْمًا)

الرد }}}
تم الشكر بواسطة: ربيع
#4
شكرا جزيلا على تعاونكم و جزاكم الله الف خير
الرد }}}
تم الشكر بواسطة:
#5
الكود يشتغل جيد . لكن هل من الممكن كود يجعل الكتابة لا تختفي
الرد }}}
تم الشكر بواسطة:
#6
kslawy كتب :السلام عليكم ورحمة الله وبركاته

نفس الكود السابق تعديل بسيط ليظهر النص في منتصف الشاشة :

شكراً لهذا أعجبني هذا
الرد }}}
تم الشكر بواسطة:
#7
ممكن اخذ صورة سطح المكتب الحالية والتعديل عليها واضافة النص

ثم استبدالها بالصورة المعدلة عبر دوال api او حتى الريجستري

وهكذا حتى لو عمل المستخدم refresh لن تنحذف الكتابة


ثواني اسوي مثال
الرد }}}
تم الشكر بواسطة:
#8
[ATTACH=CONFIG]3450[/ATTACH]


الكود كامل بالسي شارب

PHP كود :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace 
WindowsFormsApplication2
{
    public 
partial class Form1 Form
    
{
        const 
int SPI_SETDESKWALLPAPER 20;
        const 
int SPIF_UPDATEINIFILE 0x01;
        const 
int SPIF_SENDWININICHANGE 0x02;

        public 
Form1()
        {
            
InitializeComponent();
        }

        [
DllImport("user32.dll"CharSet CharSet.Auto)]
        static 
extern int SystemParametersInfo(int uActionint uParamstring lpvParamint fuWinIni);


        private 
void button1_Click(object senderEventArgs e)
        {
            if (
textBox1.Text.Trim() == "") { MessageBox.Show("write something"); return; }

            
Microsoft.Win32.RegistryKey key Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop",true);
            
string wallPaperPath = (string)key.GetValue("Wallpaper""");

            
Image im Image.FromFile(wallPaperPath);

            
using (Graphics gr Graphics.FromImage(im))
            {
                
gr.DrawString(textBox1.Text, new Font("Arial"50FontStyle.Bold), Brushes.Whiteim.Width textBox1.Text.Length 30 5);
            }



            
string FolderPath "c://New Wallpapers";
            
string imgPath "c://New Wallpapers/img.jpg";


            if (!
System.IO.Directory.Exists (FolderPath))
            {
                
System.IO.Directory.CreateDirectory(FolderPath);
            }

            
im.Save(imgPath);

            
key.SetValue("Wallpaper"imgPath);
            
key.SetValue("WallpaperStyle"2.ToString());
            
key.SetValue("TileWallpaper"0.ToString());

            
SystemParametersInfo(SPI_SETDESKWALLPAPER,
    
0,
    
imgPath,
    
SPIF_UPDATEINIFILE SPIF_SENDWININICHANGE);
        }
    }




فيجوال بيسك
PHP كود :
Imports System.Collections.Generic
Imports System
.ComponentModel
Imports System
.Data
Imports System
.Drawing
Imports System
.Linq
Imports System
.Text
Imports System
.Windows.Forms
Imports System
.Runtime.InteropServices

Namespace WindowsFormsApplication2
    
Public Partial Class Form1
        Inherits Form

        
Const SPI_SETDESKWALLPAPER As Integer 20
        
Const SPIF_UPDATEINIFILE As Integer = &H1
        
Const SPIF_SENDWININICHANGE As Integer = &H2

        
Public Sub New()
            
InitializeComponent()
        
End Sub

        
<DllImport("user32.dll"CharSet := CharSet.Auto)> _
        
Private Shared Function SystemParametersInfo(uAction As IntegeruParam As IntegerlpvParam As StringfuWinIni As Integer) As Integer
        End 
Function


        Private 
Sub button1_Click(sender As ObjectAs EventArgsHandles button1.click
            
If textBox1.Text.Trim() = "" Then
                MessageBox
.Show("write something")
                Return
            
End If

            
Dim key As Microsoft.Win32.RegistryKey Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Control Panel\Desktop"True)
            
Dim wallPaperPath As String DirectCast(key.GetValue("Wallpaper"""), String)

            
Dim im As Image Image.FromFile(wallPaperPath)

            
Using gr As Graphics Graphics.FromImage(im)
                
gr.DrawString(textBox1.Text, New Font("Arial"50FontStyle.Bold), Brushes.Whiteim.Width textBox1.Text.Length 305)
            
End Using



            Dim FolderPath 
As String "c://New Wallpapers"
            
Dim imgPath As String "c://New Wallpapers/img.jpg"


            
If Not System.IO.Directory.Exists(FolderPathThen
                System
.IO.Directory.CreateDirectory(FolderPath)
            
End If

            
im.Save(imgPath)

            
key.SetValue("Wallpaper"imgPath)
            
key.SetValue("WallpaperStyle"2.ToString())
            
key.SetValue("TileWallpaper"0.ToString())

            
SystemParametersInfo(SPI_SETDESKWALLPAPER0imgPathSPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
        
End Sub
    End 
Class
End Namespace 

النص راح يطلع في الزاوية اليمنى العليا للديسكتوب

الكود مكتوب باسي شارب
لذلك ممكن تكون هناك بعض الاخطاء في الترجمة


الملفات المرفقة صورة/صور
   
الرد }}}
تم الشكر بواسطة: ربيع
#9
مساء الخير اخواني الكرام تفاعلكم معي لمساعدتي اخجلي جدا شكرا لكم جميعا
جزاكم الله عني الف خير و ان شاء الله سأقوم ببرمج مثال و اضعه هنا بناءا على الاكواد التي ساعدتموني بها
و كذا اضافات جديد عليه
شكرا لكم
الرد }}}
تم الشكر بواسطة:
#10
بفصل مساعدة اخواني في هذا الموضوع قمت بانشاء برنامج يقوم بكتابة على سطح المكتب
شكرا لكم و جزاكم الله الف خير

البرنامج بسورس كود في المرفقات


الملفات المرفقة
.rar   Bureau.rar (الحجم : 64.12 ك ب / التحميلات : 47)
الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم