Friday 15 February 2013

How to Draw Text on an Image c#


Bitmap myBitmap = new Bitmap("C:\\myImage.jpg");
Graphics g = Graphics.FromImage(myBitmap);
StringFormat strFormat = new StringFormat();
strFormat.Alignment = StringAlignment.Center;
strFormat.LineAlignment = StringAlignment.Center;
g.DrawString("My\nText", new Font("Tahoma", 20), Brushes.White,
    new RectangleF(0, 0, 500, 500), strFormat);
myBitmap.Save("C:\\myImage1.jpg");


Highlight Asp.net Gridview Rows on MouseOver in jQuery


<script type="text/javascript">
$(document).ready(function() {
$('#gvrecords tr:has(td)').mouseover(function() {
$(this).addClass('highlightRow');
});
$('#gvrecords tr').mouseout(function() {
$(this).removeClass('highlightRow');
})
})
</script>

<style type="text/css">
.highlightRow
{
background-color:#FFCC00;
text-decoration:underline;
cursor:pointer;
}
</style>

$('#gvrecords tr:has(td)').mouseover(function() {
By using this we are identifying row tr with td and applying css style for gridview. Instead of this we can write the code like this
$('#gvrecords tr').mouseover(function() {
But above code will apply css style for gridview header also for that reason we written above code to identity and apply css style for row tr with td

Monday 11 February 2013

Blinking text using jQuery



<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Add blinking effect to text in jQuery</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
blinkeffect('#txtblnk');
})
function blinkeffect(selector) {
$(selector).fadeOut('slow'function() {
$(this).fadeIn('slow'function() {
blinkeffect(this);
});
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="txtblnk"> <p><strong><font color="red">Welcome to dotnetdatastuff.blogspot.in</font></strong></p> </div>
</form>
</body>
</html>

Random Color Generator in JavaScript



<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Generate Random Colors using javascript</title>
<script type="text/javascript">
// Run function for every second of timer
setInterval(rgbcolors, 1000);
function rgbcolors() {
// rgb string generation
var col = "rgb("
+ Math.floor(Math.random() * 255) + ","
+ Math.floor(Math.random() * 255) + ","
+ Math.floor(Math.random() * 255) + ")";
//change the text color with the new random color
document.getElementById("divstyle").style.color = col;
}
</script>
</head>s
<body>
<form id="form1" runat="server" >
<div id="divstyle" style="font:bold 24px verdana">http://dotnetdatastuff.blogspot.in/</div>
</form>
</body>
</html>

Monday 4 February 2013

jQuery Get Current Page URL

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Get Curent Page Url using jQuery in Asp.net</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function () {
var url = $(location).attr('href');
var title= $(this).attr('title');
$('#spn_title').html('<strong>' + title + '</strong>');
$('#spn_url').html('<strong>' + url + '</strong>');
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>Current page URL: <span id="spn_url"></span>.</p>
<p>Current page title: <span id="spn_title"></span>.</p>
</div>
</form>
</body>
</html>

Convert SVG to PNG using svg.dll

      <div id="divsvg">        <svg width="350" height="300"><defs></defs> ............