Dim fonts As New InstalledFontCollection Dim font_f() As FontFamily = fonts.Families() For Each ft As FontFamily In font_f If ft.IsStyleAvailable(FontStyle.Regular) Then ComboBox1.Items.Add(ft.Name) End If Next
Dim fonts As New InstalledFontCollection Dim font_f() As FontFamily = fonts.Families() For Each ft As FontFamily In font_f If ft.IsStyleAvailable(FontStyle.Regular) Then ComboBox1.Items.Add(ft.Name) End If Next
Dim ComboFonts As System.Drawing.Font ComboFonts = RichTextBox1.SelectionFont RichTextBox1.SelectionFont = New System.Drawing.Font(ComboBox1.Text, RichTextBox1.SelectionFont.Size, RichTextBox1.SelectionFont.Style)
Dim ComboFonts As System.Drawing.Font ComboFonts = RichTextBox1.SelectionFont RichTextBox1.SelectionFont = New System.Drawing.Font(ComboBox1.Text, Convert.ToInt32(ComboBox2.Text), RichTextBox1.SelectionFont.Style)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim mafont = New Font(ComboBox1.Text, RichTextBox1.SelectionFont.Size, GraphicsUnit.Pixel) Dim mafontf As FontFamily = mafont.FontFamily If mafontf.IsStyleAvailable(FontStyle.Regular) Then RichTextBox1.SelectionFont = New Font(mafont, FontStyle.Regular) End If End Sub
Dim fonts As New InstalledFontCollection Dim font_f() As FontFamily = fonts.Families() For Each ft As FontFamily In font_f ComboBox1.Items.Add(ft.Name) Next
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim fonts As New InstalledFontCollection Dim font_f() As FontFamily = fonts.Families() For Each ft As FontFamily In font_f ComboBox1.Items.Add(ft.Name) Next End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim mafont = New Font(ComboBox1.Text, RichTextBox1.SelectionFont.Size, GraphicsUnit.Pixel) Dim mafontf As FontFamily = mafont.FontFamily If mafontf.IsStyleAvailable(FontStyle.Regular) Then RichTextBox1.SelectionFont = New Font(mafont, FontStyle.Regular) End If End Sub
L'exception System.ArgumentException n'a pas été gérée Message=La police 'Vivaldi' ne prend pas en charge le style 'Regular'. Source=System.Drawing StackTrace: à System.Drawing.Font.CreateNativeFont() à System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) à System.Drawing.Font.Initialize(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) à System.Drawing.Font..ctor(String familyName, Single emSize, GraphicsUnit unit) à WordGL.Form1.ComboBox1_SelectedIndexChanged(Object sender, EventArgs e) dans G:\WordGL\WordGL\Form1.vb:ligne 983 à System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e) à System.Windows.Forms.ComboBox.WmReflectCommand(Message& m) à System.Windows.Forms.ComboBox.WndProc(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) à System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) à System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam) à System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m) à System.Windows.Forms.Control.WmCommand(Message& m) à System.Windows.Forms.Control.WndProc(Message& m) à System.Windows.Forms.ScrollableControl.WndProc(Message& m) à System.Windows.Forms.Form.WndProc(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) à System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) à System.Windows.Forms.NativeWindow.DefWndProc(Message& m) à System.Windows.Forms.Control.DefWndProc(Message& m) à System.Windows.Forms.Control.WmCommand(Message& m) à System.Windows.Forms.Control.WndProc(Message& m) à System.Windows.Forms.ComboBox.WndProc(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) à System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) à System.Windows.Forms.NativeWindow.DefWndProc(Message& m) à System.Windows.Forms.ComboBox.DefChildWndProc(Message& m) à System.Windows.Forms.ComboBox.ChildWndProc(Message& m) à System.Windows.Forms.ComboBox.ComboBoxChildNativeWindow.WndProc(Message& m) à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) à WordGL.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81 à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) à System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args) à System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) à System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) à System.Activator.CreateInstance(ActivationContext activationContext) à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() à System.Threading.ThreadHelper.ThreadStart_Context(Object state) à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) à System.Threading.ThreadHelper.ThreadStart() InnerException: