السلام عليكم و رحمة الله تعالى و بركاته
اخوتي في الله رمضانكم سعيد اسأل الله العلي القدير ان رفع به من درجاتكم في الجنة و ان يرزقكم فيه من حيث لا تحتسبون
طلب مني ان ابرمج برنامج VB.net ان يعمل على كتابة كلمة او جملة حسب رغبة المستخدم في سطح المكتب و بحثت كثيرا في الانترنت ووجدت شرحا لكن تم حدف الصور التي بها الكود . لذلك لجأت اليكم لمساعدتي
و جزاكم الله الف خير
<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
<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) ، أو في حالة أغلقت البرنامج سيتم مسح النص أيضاً .
****
***
**
*
23-07-13, 07:04 PM (آخر تعديل لهذه المشاركة : 24-07-13, 03:28 AM {2} بواسطة hussein.)
[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 uAction, int uParam, string lpvParam, int fuWinIni);
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 Integer, uParam As Integer, lpvParam As String, fuWinIni As Integer) As Integer End Function
Private Sub button1_Click(sender As Object, e As EventArgs) Handles 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", 50, FontStyle.Bold), Brushes.White, im.Width - textBox1.Text.Length * 30, 5) End Using
Dim FolderPath As String = "c://New Wallpapers" Dim imgPath As String = "c://New Wallpapers/img.jpg"
If Not System.IO.Directory.Exists(FolderPath) Then System.IO.Directory.CreateDirectory(FolderPath) End If
مساء الخير اخواني الكرام تفاعلكم معي لمساعدتي اخجلي جدا شكرا لكم جميعا
جزاكم الله عني الف خير و ان شاء الله سأقوم ببرمج مثال و اضعه هنا بناءا على الاكواد التي ساعدتموني بها
و كذا اضافات جديد عليه
شكرا لكم