Use "if" condition:
if (condition)
result = t;
else
result = f;
if (obj != null)
result = obj;
else
result = something;
Use "?:" operator
result = condition ? t : f;
Use "??" operator
result = obj ?? something;
Feb 21, 2012
Feb 20, 2012
[How to] Memory Allocate
If we want to dynamic allocate N bytes of memory.
And then, reallocate it to X bytes. After all, release it.
In the case of C/C++:
char* bp = malloc(sizeof(char) * N);
bp = realloc(bp, sizeof(char) * X);
free(bp);
And then, reallocate it to X bytes. After all, release it.
In the case of C/C++:
char* bp = malloc(sizeof(char) * N);
bp = realloc(bp, sizeof(char) * X);
free(bp);
Tag:
How to
Feb 9, 2012
[How to] Color of A Point on The Screen
using System.Drawing;
using System.Drawing.Drawing2D;
Bitmap bitmap = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(bitmap);
Give a point that you want
g.CopyFromScreen(this.Location, new Point(0, 0), new Size(1, 1));
This is what you needed
Color result = bitmap.GetPixel(0, 0);
using System.Drawing.Drawing2D;
Bitmap bitmap = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(bitmap);
Give a point that you want
g.CopyFromScreen(this.Location, new Point(0, 0), new Size(1, 1));
This is what you needed
Color result = bitmap.GetPixel(0, 0);
Tag:
How to
Subscribe to:
Comments (Atom)