Click here to Skip to main content
15,918,471 members
Home / Discussions / C#
   

C#

 
GeneralRe: [newbie] function Pin
jon-8028-Jan-09 5:59
professionaljon-8028-Jan-09 5:59 
AnswerRe: [newbie] function to return MAX + 1 from primary key Pin
Wendelius28-Jan-09 4:33
mentorWendelius28-Jan-09 4:33 
AnswerRe: [newbie] function to return MAX + 1 from primary key Pin
riced28-Jan-09 5:10
riced28-Jan-09 5:10 
QuestionRatio Textbox Validation Pin
honeyashu28-Jan-09 3:37
honeyashu28-Jan-09 3:37 
AnswerRe: Ratio Textbox Validation [modified] Pin
DaveyM6928-Jan-09 3:56
professionalDaveyM6928-Jan-09 3:56 
GeneralRe: Ratio Textbox Validation Pin
honeyashu28-Jan-09 20:31
honeyashu28-Jan-09 20:31 
GeneralRe: Ratio Textbox Validation Pin
DaveyM6929-Jan-09 0:11
professionalDaveyM6929-Jan-09 0:11 
QuestionJPEG Compression in C# Pin
SimpleData28-Jan-09 3:26
SimpleData28-Jan-09 3:26 
Hi My application (Gaming AntiCheat Application) takes screenshots and uploads it to a server. But the image size is too big. I want to lower the image size by reducing the quality of the picture. But I don't know how to do it. I have searched CodeProject and Google but I couldn't see a satisfacting answer.

If you need the screenshot code that I am using, here it is:

// İleride gerekli olabileceği için önceden tanımlanıyor.
                int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
                int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;

                // Yazının arkasına dortgen çiziliyor
                Rectangle bounds = Screen.GetBounds(Point.Empty);

                // Ekran görüntüsü çekiliyor
                using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
                {
                    using (Graphics g = Graphics.FromImage(bitmap))
                    {
                        g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
                    }

                    // bitmap grafik imaj olarka tanımlanıyor
                    Graphics graphicImage = Graphics.FromImage(bitmap);

                    //Grafik yumuşatma aktifleştiriliyor
                    graphicImage.SmoothingMode = SmoothingMode.AntiAlias;

                    //Yazı burada ve şekil de
                    Rectangle r = new Rectangle(150, 10, 130, 35);

                    // arkaya beyaz dörtgen
                    graphicImage.DrawRectangle(new Pen(Color.White, 100), r);

                    string datetime = DateTime.Now.ToString().Replace(':', '.');
                    string datetime2 = datetime.Replace(' ', '.');
                    string cozunurluk= screenWidth + " x " + screenHeight;

                    // username string
                    graphicImage.DrawString(depo.username, new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(110, 10));
                    // tarih saat
                    graphicImage.DrawString(DateTime.Now.ToString(), new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(110, 35));
                    // ekran çözünürlüğü
                    graphicImage.DrawString(cozunurluk, new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(110, 60));

                    // Logo çizimi
                    // logo öncelikle kaynaklardan okunuyor
                    Bitmap baskilogo = kaynaklar.baskilogo;

                    // logo yazılıyor
                    graphicImage.DrawImage(baskilogo, 321, 0, 236, 96);

                    //Yeni resmin ismi
                    string localresimadi = (depo.userid + "." + datetime2 + ".hl2" + ".bac");

                    // kaydediliyor
                    bitmap.Save(localresimadi, ImageFormat.Jpeg);
                    depo.resimlist = depo.resimlist + ";" + localresimadi;

                    depo.ekrangoruntusuadedi++;
                    txtSSnr.Text = depo.ekrangoruntusuadedi.ToString();

                    //Temizlik
                    graphicImage.Dispose();
                    bitmap.Dispose();


                    try
                    {
                        StreamReader oku = new StreamReader("upl.bac");
                        depo.uplbacsatir = rot13.use( oku.ReadLine() );
                        oku.Close();
                        oku.Dispose();
                    }
                    catch (FileNotFoundException)
                    {
                        depo.uplbacsatir = null;
                    }

                    StreamWriter yaz = new StreamWriter("upl.bac");
                    yaz.Write( rot13.use(depo.uplbacsatir) + rot13.use(localresimadi + ";"));
                    yaz.Close();
                    yaz.Dispose();
                }


Thanks.
AnswerRe: JPEG Compression in C# Pin
User 665828-Jan-09 3:30
User 665828-Jan-09 3:30 
AnswerRe: JPEG Compression in C# Pin
SimpleData28-Jan-09 3:39
SimpleData28-Jan-09 3:39 
AnswerRe: JPEG Compression in C# Pin
Ennis Ray Lynch, Jr.28-Jan-09 5:26
Ennis Ray Lynch, Jr.28-Jan-09 5:26 
GeneralRe: JPEG Compression in C# Pin
SimpleData28-Jan-09 5:29
SimpleData28-Jan-09 5:29 
GeneralRe: JPEG Compression in C# Pin
Ennis Ray Lynch, Jr.28-Jan-09 5:42
Ennis Ray Lynch, Jr.28-Jan-09 5:42 
GeneralRe: JPEG Compression in C# Pin
SimpleData28-Jan-09 6:02
SimpleData28-Jan-09 6:02 
GeneralRe: JPEG Compression in C# Pin
Mark Churchill28-Jan-09 12:11
Mark Churchill28-Jan-09 12:11 
QuestionC# Clipboard - Works, but is one step behind Pin
Olav Alexander Mjelde28-Jan-09 3:22
Olav Alexander Mjelde28-Jan-09 3:22 
AnswerRe: C# Clipboard - Works, but is one step behind Pin
User 665828-Jan-09 3:25
User 665828-Jan-09 3:25 
QuestionAny way to convert/compress JPG to TIFF CCITT Fax4? Pin
Matjaz-xyz28-Jan-09 3:19
Matjaz-xyz28-Jan-09 3:19 
AnswerRe: Any way to convert/compress JPG to TIFF CCITT Fax4? Pin
Mark Churchill28-Jan-09 12:40
Mark Churchill28-Jan-09 12:40 
GeneralRe: Any way to convert/compress JPG to TIFF CCITT Fax4? Pin
Matjaz-xyz28-Jan-09 22:30
Matjaz-xyz28-Jan-09 22:30 
GeneralRe: Any way to convert/compress JPG to TIFF CCITT Fax4? Pin
Mark Churchill29-Jan-09 3:40
Mark Churchill29-Jan-09 3:40 
QuestionDevice Drivers Pin
queries36528-Jan-09 3:15
queries36528-Jan-09 3:15 
QuestionReading xml that contains reference to xml’s Pin
Ronenb28-Jan-09 3:08
Ronenb28-Jan-09 3:08 
QuestionStruct vs array performance Pin
Lutosław28-Jan-09 2:25
Lutosław28-Jan-09 2:25 
AnswerRe: Struct vs array performance Pin
SeMartens28-Jan-09 2:44
SeMartens28-Jan-09 2:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.