wmaraci reklam
lidertakipci

C# Font Dialog Hakkında

17 Mesajlar 3.097 Okunma
advertseo
wmaraci reklam

PorFavorDama PorFavorDama WM Aracı Kullanıcı
  • Üyelik 20.01.2014
  • Yaş/Cinsiyet 28 / E
  • Meslek -
  • Konum Adana
  • Ad Soyad B** K**
  • Mesajlar 511
  • Beğeniler 152 / 44
  • Ticaret 0, (%0)

kacak41 adlı üyeden alıntı

şöyle söyliyeyim selected index changed fonksiyonunda
Properties.Settings.Default.index = Combobox.Selectedindex;
Properties.Settings.Default.Save();


dersiniz.


Diyalogunuz load olurkende aşağıdaki kod ile index i seçersiniz.
combox.selectedindex=Properties.Settings.Default.index;


hocam dialogtaki combobox ı nasıl belırtecegım onun komutunu anlamadım ona ulasamıyorum combobox ile ona erişemiyoorum , sizede zahmet verıyorum kusura bakmaayın
 

 

wmaraci
reklam

kacak41 kacak41 A Little Bit Silence Kullanıcı
  • Üyelik 02.01.2014
  • Yaş/Cinsiyet 31 / E
  • Meslek Öğrenci
  • Konum Kocaeli
  • Ad Soyad M** Ö**
  • Mesajlar 73
  • Beğeniler 10 / 22
  • Ticaret 0, (%0)
Eğer kodunuzu tam olarak gönderebilirseniz sanırım daha kolay yardımcı olabilrim dialog tan kastınız formmu yoksa dialogbox içinde combobox mu?
PorFavorDama

kişi bu mesajı beğendi.

Mesajlarımı alıntı yaparak cevaplarsanız daha çabuk cevap verebilirim.
kodplus.com

PorFavorDama PorFavorDama WM Aracı Kullanıcı
  • Üyelik 20.01.2014
  • Yaş/Cinsiyet 28 / E
  • Meslek -
  • Konum Adana
  • Ad Soyad B** K**
  • Mesajlar 511
  • Beğeniler 152 / 44
  • Ticaret 0, (%0)

kacak41 adlı üyeden alıntı

Eğer kodunuzu tam olarak gönderebilirseniz sanırım daha kolay yardımcı olabilrim dialog tan kastınız formmu yoksa dialogbox içinde combobox mu?


Kod burada hocam buyrun dialogtan kastım fontdialog u işte default olan c# ın kullandıgı ..

Düzenlemek istediğim yer button 2 click eventınde hocam

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Text;
using System.Text.RegularExpressions;
using Microsoft.Win32;
using ArkaplanRengiDeğiştirme.Properties;

namespace ArkaplanRengiDeğiştirme
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Font = Properties.Settings.Default.font_setting;
KnownColor renk = default(KnownColor);
for (renk = KnownColor.ActiveBorder; renk <= KnownColor.YellowGreen; renk++)
{
listBox2.Items.Add(renk);
}
listBox1.Items.Add("Kırmızı");
listBox1.Items.Add("Turuncu");
listBox1.Items.Add("Sarı");
listBox1.Items.Add("Yeşil");
listBox1.Items.Add("Mavi");
listBox1.Items.Add("Mor");
listBox1.Items.Add("Siyah");
listBox1.Items.Add("Gri");
listBox1.Items.Add("Kahverengi");



}

private void listBox1_MouseClick(object sender, MouseEventArgs e)
{
if (listBox1.SelectedIndex == 6)
label1.ForeColor = Color.White;
else
label1.ForeColor = Color.Black;
switch (listBox1.SelectedIndex)
{
case 0:
this.BackColor = Color.Red;
break;
case 1:
this.BackColor = Color.Orange;
break;
case 2:
this.BackColor = Color.Yellow;
break;
case 3:
this.BackColor = Color.Green;
break;
case 4:
this.BackColor = Color.Blue;
break;
case 5:
this.BackColor = Color.Purple;
break;
case 6:
this.BackColor = Color.Black;

break;
case 7:
this.BackColor = Color.Gray;
break;
case 8:
this.BackColor = Color.Brown;
break;
}
}

private void listBox2_MouseClick(object sender, MouseEventArgs e)
{
//fakat saydam rengi desteklemiyor.
this.BackColor = System.Drawing.ColorTranslator.FromHtml(listBox2.Text);

}

private void button1_Click(object sender, EventArgs e)
{
foreach (Control nesne in this.Controls)
{
if ((nesne) is ListBox)
{
nesne.BackColor = Color.Pink;
}
}
}

private void button2_Click(object sender, EventArgs e)
{

FontDialog a = new FontDialog();
a.ShowColor = true;
DialogResult result = a.ShowDialog();
a.Font = Properties.Settings.Default.fon_adi;
if(result == DialogResult.OK)
{
label1.Font = a.Font;
label1.ForeColor = a.Color;
}
Properties.Settings.Default.font_setting = new Font(a.Font.Name, Form1.DefaultFont.Size);
Properties.Settings.Default.fon_adi = a.Font.Name;
Properties.Settings.Default.Save();
label1.Anchor = (AnchorStyles.Left);
}
}
}
 

 

kacak41 kacak41 A Little Bit Silence Kullanıcı
  • Üyelik 02.01.2014
  • Yaş/Cinsiyet 31 / E
  • Meslek Öğrenci
  • Konum Kocaeli
  • Ad Soyad M** Ö**
  • Mesajlar 73
  • Beğeniler 10 / 22
  • Ticaret 0, (%0)
a.ShowDialog();

kodundan hemen önce:

a.Font = o anda kullanılan font;

bu şekilde yazarsanız istediğiniz gibi olacaktır.

a.Font = Properties.Settings.Default.font_settings;


private void button2_Click(object sender, EventArgs e)
{

FontDialog a = new FontDialog();
a.ShowColor = true;
a.Font = Properties.Settings.Default.font_setting ;
DialogResult result = a.ShowDialog();
if(result == DialogResult.OK)
{
label1.Font = a.Font;
label1.ForeColor = a.Color;
}
Properties.Settings.Default.font_setting = new Font(a.Font.Name, Form1.DefaultFont.Size);
Properties.Settings.Default.fon_adi = a.Font.Name;
Properties.Settings.Default.Save();
label1.Anchor = (AnchorStyles.Left);
}
PorFavorDama

kişi bu mesajı beğendi.

Mesajlarımı alıntı yaparak cevaplarsanız daha çabuk cevap verebilirim.
kodplus.com
wmaraci
wmaraci

PorFavorDama PorFavorDama WM Aracı Kullanıcı
  • Üyelik 20.01.2014
  • Yaş/Cinsiyet 28 / E
  • Meslek -
  • Konum Adana
  • Ad Soyad B** K**
  • Mesajlar 511
  • Beğeniler 152 / 44
  • Ticaret 0, (%0)

kacak41 adlı üyeden alıntı

a.ShowDialog();

kodundan hemen önce:

a.Font = o anda kullanılan font;

bu şekilde yazarsanız istediğiniz gibi olacaktır.

a.Font = Properties.Settings.Default.font_settings;


private void button2_Click(object sender, EventArgs e)
{

FontDialog a = new FontDialog();
a.ShowColor = true;
a.Font = Properties.Settings.Default.font_setting ;
DialogResult result = a.ShowDialog();
if(result == DialogResult.OK)
{
label1.Font = a.Font;
label1.ForeColor = a.Color;
}
Properties.Settings.Default.font_setting = new Font(a.Font.Name, Form1.DefaultFont.Size);
Properties.Settings.Default.fon_adi = a.Font.Name;
Properties.Settings.Default.Save();
label1.Anchor = (AnchorStyles.Left);
}


Teşekkür ederim hocam hemen deniyorum çok sağolun :)

Ek Olarak:

kacak41 adlı üyeden alıntı

a.ShowDialog();

kodundan hemen önce:

a.Font = o anda kullanılan font;

bu şekilde yazarsanız istediğiniz gibi olacaktır.

a.Font = Properties.Settings.Default.font_settings;


private void button2_Click(object sender, EventArgs e)
{

FontDialog a = new FontDialog();
a.ShowColor = true;
a.Font = Properties.Settings.Default.font_setting ;
DialogResult result = a.ShowDialog();
if(result == DialogResult.OK)
{
label1.Font = a.Font;
label1.ForeColor = a.Color;
}
Properties.Settings.Default.font_setting = new Font(a.Font.Name, Form1.DefaultFont.Size);
Properties.Settings.Default.fon_adi = a.Font.Name;
Properties.Settings.Default.Save();
label1.Anchor = (AnchorStyles.Left);
}


yok hocam olmuyor delı etti ya bı kaldıgı yerden baslamadı su aslında onemlı bır seyde degıl fakat taktımı takıyorum :D
 

 

kacak41 kacak41 A Little Bit Silence Kullanıcı
  • Üyelik 02.01.2014
  • Yaş/Cinsiyet 31 / E
  • Meslek Öğrenci
  • Konum Kocaeli
  • Ad Soyad M** Ö**
  • Mesajlar 73
  • Beğeniler 10 / 22
  • Ticaret 0, (%0)
https://www.dropbox.com/s/ucbjxnjx0xk5oc8/font.rar

hocam bu benim uygulamam bu uygulamada hiçbir sorun olamdan çalışıyor :S
PorFavorDama

kişi bu mesajı beğendi.

Mesajlarımı alıntı yaparak cevaplarsanız daha çabuk cevap verebilirim.
kodplus.com

PorFavorDama PorFavorDama WM Aracı Kullanıcı
  • Üyelik 20.01.2014
  • Yaş/Cinsiyet 28 / E
  • Meslek -
  • Konum Adana
  • Ad Soyad B** K**
  • Mesajlar 511
  • Beğeniler 152 / 44
  • Ticaret 0, (%0)

kacak41 adlı üyeden alıntı

https://www.dropbox.com/s/ucbjxnjx0xk5oc8/font.rar

hocam bu benim uygulamam bu uygulamada hiçbir sorun olamdan çalışıyor :S


Simdi hocam ben orada font ismini settinge atadım fakat sonradan tekrar settingsten fonta atamayı unutmuşum şimdi farkettım çok çok çok sağolun ilginiz için :)
kacak41

kişi bu mesajı beğendi.

wmaraci
Konuyu toplam 1 kişi okuyor. (0 kullanıcı ve 1 misafir)
Site Ayarları
  • Tema Seçeneği
  • Site Sesleri
  • Bildirimler
  • Özel Mesaj Al