Skip to content

Instantly share code, notes, and snippets.

@abbas-oveissi
Last active February 28, 2020 14:44
Show Gist options
  • Save abbas-oveissi/4987020 to your computer and use it in GitHub Desktop.
Save abbas-oveissi/4987020 to your computer and use it in GitHub Desktop.
sample C# code for socket
void drawSelection(Canvas canvas, int startChar, int endChar, int line) {
Rect rect = getTextRect(line);
float startX = layout.getPrimaryHorizontal(startChar );
float endX = 0;
int maxPosLine = layout.getLineEnd(line);
if (endChar >= maxPosLine)
endX= rect.right;
else
endX= layout.getPrimaryHorizontal(endChar );
Rect drawRect = new Rect((int)startX,rect.top,(int)endX,rect.bottom);
canvas.drawRect(drawRect, paint);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment