ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

En2Fr


        private void textBox1_TextChanged(object sender, EventArgs e)
        {


            textBox2.Text = textBox1.Text.Trim().ToLower()
                .Replace("a", "ا").Replace("b", "ب").Replace("c", "ک").Replace("d", "د")
                .Replace("e", "ا").Replace("f", "ف").Replace("g", "گ").Replace("h", "ه")
                .Replace("i", "ی").Replace("j", "ج").Replace("k", "ک").Replace("l", "ل")
                .Replace("m", "م").Replace("n", "ن").Replace("o", "و").Replace("p", "پ")
                .Replace("q", "ک").Replace("r", "ر").Replace("s", "س").Replace("t", "ت")
                .Replace("u", "ا").Replace("v", "و").Replace("w", "و").Replace("x", "")
                .Replace("y", "ی").Replace("z", "ز");
               
        }

Transparent Layer On Image

using System.Drawing.Drawing2D;

privatestaticImage fill_layer(PictureBox Pic_Box,Image img,Color Layer_color,int Percent)
{
//از img به عنوان بک آپ استفاده می شود
//percent درصد شفافیت است
Pic_Box.Image = img;
Bitmap bmp_img = newBitmap(Pic_Box.Image);
Graphics ghp = Graphics.FromImage(bmp_img);
LinearGradientBrush LineaBrush;
LineaBrush = newLinearGradientBrush(newRectangle(0, 0, bmp_img.Width, bmp_img.Height), Color.FromArgb(Percent, Layer_color), Color.FromArgb(Percent, Layer_color), LinearGradientMode.BackwardDiagonal);
ghp.FillRectangle(LineaBrush, newRectangle(0, 0, bmp_img.Width, bmp_img.Height));
return (Image)bmp_img;
}

pictureBox1.Image = fill_layer(pictureBox1,pictureBox2.Image, Color,Value);

Transparent layer

private void button2_Click(object sender, EventArgs e)
        {
            Random r = new Random();
            Bitmap b = new Bitmap(Width, Height);
            Graphics g = Graphics.FromImage(b);
            SolidBrush br = new SolidBrush(Color.FromArgb(150, r.Next(255),
                r.Next(255), r.Next(255)));
            g.FillRectangle(br,0,0,Width,Height);
            pictureBox1.Image = b;
        }

Transparent Control - %

control.BackColor = Color.FromArgb(trancparency, control.BackColor);

Transparent Control

control.BackColor = Color.Transparent;