|
74
|
Programación / .NET (C#, VB.NET, ASP) / Re: Duda cambiar tamaño de letra y mantener el estilo,familia
|
en: 19 Marzo 2013, 17:57 pm
|
He hecho creo yo que una pequeña chapucilla, no se si habría alguna forma mejor de hacerlo ya que me da la sensación que repito demasiado código. Esta parte iría en el Private Sub ListBox1_SelectedIndexChanged... If CheckBox1.Checked = True Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style Or FontStyle.Bold) End If If CheckBox2.Checked = True Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style Or FontStyle.Underline) End If If CheckBox3.Checked = True Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style Or FontStyle.Italic) 'cambia a negerita el cuadro de texto End If
|
|
|
75
|
Programación / .NET (C#, VB.NET, ASP) / Duda cambiar tamaño de letra y mantener el estilo,familia
|
en: 19 Marzo 2013, 17:33 pm
|
Muy buenas. Estaba haciendo una práctica y resulta que no logro ver como mantener el estilo subrayado, negrita, o cursiva al cambiar el tamaño de letra, puesto que al parecer se reinician los valores. Creo (pienso) que el new de listboxchanged esta creando lo que es un estilo nuevo y no me lo esta manteniendo. Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Text = "HOLA" TextBox1.TextAlign = HorizontalAlignment.Center End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged TextBox1.Font = New Font(TextBox1.Font.Style, ListBox1.SelectedItem) 'CheckBox1.Checked = False 'CheckBox2.Checked = False 'CheckBox3.Checked = False End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged 'DESDE TEXTBOX1.FONT ACTUA COMO EL TEXTBOX1.TEXT = TEXTBOX1.TEXT DICIENDO TEXTBOX1.FONT = AL ESTILO QUE CONTENGA + EL NUEVO NEGRITA If CheckBox1.Checked = False Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style And Not FontStyle.Bold) If CheckBox1.Checked = True Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style Or FontStyle.Bold) End Sub Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged If CheckBox2.Checked = False Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style And Not FontStyle.Underline) 'quita el estilo de negrita del texto If CheckBox2.Checked = True Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style Or FontStyle.Underline) End Sub Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged If CheckBox3.Checked = False Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style And Not FontStyle.Italic) If CheckBox3.Checked = True Then TextBox1.Font = New Font(TextBox1.Font, TextBox1.Font.Style Or FontStyle.Italic) 'cambia a negerita el cuadro de texto End Sub End Class
|
|
|
78
|
Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets !! (Posteen aquí sus snippets)
|
en: 18 Marzo 2013, 12:33 pm
|
Checkar si un número está entre un rango de números. PD: Si conocen un método mejor porfavor postéenlo #Region " Number Is In Range Function " ' [ Number Is In Range Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(NumberIsInRange(50, 0, 100)) ' If NumberIsInRange(5, 1, 10) then... Private Function NumberIsInRange(ByVal Number As Integer, ByVal MIN As Integer, ByVal MAX As Integer) As Boolean Select Case Number Case MIN To MAX : Return True Case Else : Return False End Select End Function #End Region
A mi se me ocurre otra manera pero no tengo ni idea de cual es más rápida. Function numero(ByVal MIN As Integer, ByVal MAX As Integer) As Boolean Dim N As Integer N = InputBox("Escribe un nº cualquiera", "hola", 0) If N >= MIN And N <= MAX Then MsgBox("EL NUMERO SE ENCUENTRA ENTRE " & MIN & " Y " & MAX) Else MsgBox("EL NUMERO NO SE ENCUENTRA ENTRE LOS VALORES") End If End Function
|
|
|
79
|
Programación / Programación Visual Basic / Re: no le entiendo del todo el and, or , not y xor
|
en: 17 Marzo 2013, 20:34 pm
|
Un truquito: Sabiendo que true = 1 y false = 0 y que los AND se suelen corresponder por multiplicaciones y los Or por Sumas. entonces según esto....
1 And 1 = es como decir 1 * 1 = 1 y 1 hemos dicho que era true 1 Or 1 = es como decir 1+1 pero como solo se usan 1 y 0 se queda en 1 false And true = es como decir 0*1 = 0 es decir false
Así sucesivamente con todos.
|
|
|
80
|
Informática / Software / Re: ¿Algún programa que apague mi ordenador?
|
en: 17 Marzo 2013, 13:39 pm
|
O lo que se me ocurre y creo que es lo mejor hacer un shell pequeño donde preguntase que quiere, si apagar, reiniciar o cancelar, luego con un select case opcion = apagar por ejemplo 1.- Apagar en 1h... 2.- Apagar en 2h... ....
|
|
|
|
|
|
|