A comprehensive collection of RTL (Right-to-Left) enabled MessageBox implementations for .NET applications with built-in Persian/Arabic language support and automatic font installation capabilities.
This solution provides RTL-aware MessageBox replacements for both WPF and Windows Forms applications, specifically designed for Persian, Arabic, and other RTL languages. The libraries feature automatic Persian button text translation, proper RTL layout, and integrated font installation for optimal typography.
The solution includes the Barnamenevis.Net.Tools library, which currently focuses on font installation utilities but is designed to be expanded with additional Persian/Arabic development tools in future releases.
Project | Description | Target Frameworks |
---|---|---|
Barnamenevis.Net.RtlMessageBox.Wpf | Pure WPF implementation with themed UI | .NET 6.0, 7.0, 8.0, 9.0 (Windows) |
Barnamenevis.Net.RtlMessageBox.WindowsForms | Win32 MessageBox wrapper with RTL support | .NET 6.0, 7.0, 8.0, 9.0 (Windows) |
Barnamenevis.Net.Tools | Comprehensive toolkit for Persian development Currently: Font installation utilities Future: Text processing, RTL helpers, Persian calendar, and more |
.NET 6.0, 7.0, 8.0, 9.0 |
Project | Description | Features |
---|---|---|
Barnamenevis.Net.RtlMessageBox.Wpf.Demo | WPF demo with font auto-installation | Themed UI, Custom title bars |
Barnamenevis.Net.RtlMessageBox.WindowsForms.Demo | Windows Forms demo application | Designer-based UI, Standard controls |
- Automatic Persian Button Text: OK→تایید, Cancel→انصراف, Yes→بله, No→خیر
- Proper RTL Layout: Right-to-left text flow and UI alignment
- Custom Font Integration: Automatic installation and usage of Persian fonts
- Drop-in Replacement: Compatible with standard MessageBox API
- Themed MessageBox: Modern, customizable appearance
- Custom Title Bars: Optional client-area title bars with preferred fonts
- System Sound Integration: Appropriate sounds for warnings and errors
- Focus Management: Proper keyboard navigation and focus indicators
- Automatic Font Installation: Per-user font installation (no admin rights required)
- Multiple Format Support: TTF, OTF, WOFF, WOFF2, EOT
- Runtime Font Detection: Automatically uses installed Persian fonts
- Font Persistence: Fonts remain available after application closes
- Persian Text Processing: Utilities for Persian text manipulation
- RTL Layout Helpers: Custom control development assistance
- Persian Date/Calendar: Shamsi calendar utilities
- Keyboard Layout Management: Persian keyboard handling
- Persian Number Formatting: Number-to-text conversion
- Cultural Localization: Persian/Arabic localization helpers
using Barnamenevis.Net.RtlMessageBox.Wpf;
// Simple usage
var result = RtlMessageBox.Show("سلام دنیا!", "پیغام");
// With custom options
var result = RtlMessageBox.Show(
"آیا مطمئن هستید؟",
"تأیید",
MessageBoxButton.YesNo,
MessageBoxImage.Question);
using Barnamenevis.Net.RtlMessageBox.WindowsForms;
// Configure font (optional)
RtlMessageBox.PreferredFontName = "Vazirmatn FD";
RtlMessageBox.ApplyCustomFont = true;
// Simple usage
var result = RtlMessageBox.Show("سلام دنیا!", "پیغام");
using Barnamenevis.Net.Tools;
// Install fonts from application's Fonts directory
int installedCount = FontInstaller.InstallApplicationFonts();
Console.WriteLine($"نصب شد {installedCount} فونت جدید");
// Install fonts from custom directory
int installedCount = FontInstaller.InstallFontsFromDirectory(@"C:\MyFonts");
Pure WPF implementation featuring:
- Themed MessageBox with modern appearance
- Optional custom title bars using preferred fonts
- Built-in system sound integration
- Proper RTL layout and Persian button text
- Focus management and keyboard navigation
Win32 MessageBox wrapper featuring:
- Hook-based button text translation
- Custom font application to all dialog elements
- RTL reading and right-align options
- Compatible with all standard MessageBox overloads
- Automatic focus management
Barnamenevis.Net.Tools - Persian/Arabic Development Toolkit
Current Features (v1.0):
- FontInstaller: Per-user font installation (no admin privileges required)
- Support for multiple font formats (TTF, OTF, WOFF, WOFF2, EOT)
- Automatic font detection and duplicate prevention
- Registry management for font persistence
- Silent operation with error handling
Planned Features (Future Versions):
- Persian text processing utilities
- RTL layout helpers for custom controls
- Persian Date/Calendar utilities
- Keyboard layout management tools
- Persian number formatting utilities
- Cultural localization helpers
The Barnamenevis.Net.Tools library is designed to become a comprehensive toolkit for Persian and Arabic .NET application development. We welcome contributions and feature suggestions!
- .NET 6.0, 7.0, 8.0, or 9.0
- Windows 10/11 (Windows-specific font installation APIs)
- WPF/Windows Forms target frameworks as appropriate
git clone https://github.com/delphiassistant/Barnamenevis.Net.Tools.git
cd Barnamenevis.Net.Tools
dotnet build
# WPF Demo
dotnet run --project Barnamenevis.Net.RtlMessageBox.Wpf.Demo
# Windows Forms Demo
dotnet run --project Barnamenevis.Net.RtlMessageBox.WindowsForms.Demo
Reference the appropriate project and start using the RTL-enabled MessageBox:
For WPF Projects:
<ProjectReference Include="path\to\Barnamenevis.Net.RtlMessageBox.Wpf\Barnamenevis.Net.RtlMessageBox.Wpf.csproj" />
For Windows Forms Projects:
<ProjectReference Include="path\to\Barnamenevis.Net.RtlMessageBox.WindowsForms\Barnamenevis.Net.RtlMessageBox.WindowsForms.csproj" />
For Persian/Arabic Development Tools:
<ProjectReference Include="path\to\Barnamenevis.Net.Tools\Barnamenevis.Net.Tools.csproj" />
- Download Persian Fonts (recommended: Vazirmatn)
- Place fonts in
Fonts
directory of demo applications - Configure project to copy fonts:
<ItemGroup> <None Include="Fonts\**\*.*"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup>
Each project includes comprehensive documentation:
- WPF MessageBox Documentation - Complete WPF implementation guide
- Windows Forms MessageBox Documentation - Win32 wrapper implementation guide
- Barnamenevis.Net.Tools Documentation - Persian/Arabic development toolkit guide
- WPF Demo Documentation - WPF demo application guide
- Windows Forms Demo Documentation - Windows Forms demo guide
Contributions are welcome! Please feel free to submit pull requests, report issues, or suggest improvements.
Special Interest Areas:
- Additional utilities for Barnamenevis.Net.Tools library
- Persian/Arabic text processing algorithms
- RTL layout helpers and custom controls
- Persian calendar and date utilities
- Localization and cultural adaptation tools
This project is open source. Please refer to the license file for details.
- Vazirmatn Font Family - Recommended Persian font
- Persian Typography Guidelines - Best practices for Persian text
- .NET Globalization Documentation - Internationalization resources