Showing posts with label VB. Show all posts
Showing posts with label VB. Show all posts

Friday, December 19, 2014

WPF - Redrawing the whole control on resize - Coded in C# [C-Sharp]VB, C++ (Open Source)


Can't Afford A Bot? Buy SEO & Social Media Metrics For Cheap Starting at $1 Dollar



Redrawing The Whole Control On Resize[C#]

CODE WRITTEN BY: JASON "JAY STILLA" LEE

Written By Jason Jay Stilla Lee - Programmer / Musician 
Enjoy The Music While You Study This Code or Copy and Paste into .CS
Coded: C#  Text Editor: Visual Studios 2013  Project: Windows Forms - WPF Application
Tutorial # 6 How To Redraw The Whole Control on Resize.
Music By Yours Truly Jay Stilla: Album Jason Society
Press Play on a Song, Crack Your Fingers And Lets Get To Coding


When custom controls or Windows Forms controls like Panel are resized, only their newly exposed portions are redrawn. However, this behaviour sometimes does not provide the desired results (see fig. 1 below).
This example shows how to ensure redrawing of the whole control after resizing by setting the control's ResizeRedraw property.

Fig. 1. A partially redrawn control after resizing.

Redrawing the whole control on resize

The ResizeRedraw protected property defined in the Control class indicates, whether the control redraws itself when resized. To ensure redrawing of the whole control on resize set this property to true. This will usually be done in the constructor of a derived class.
[C#]
public MyControl()
{
InitializeComponent();
ResizeRedraw = true;
}
Alternatively, if you can not or don't want to create a derived class, set the property using reflection or simply call the Invalidate or Refresh method in the control's Resize event handler.
[C#]
using System.Reflection;

public static void SetResizeRedraw(Control control)
{
typeof(Control).InvokeMember("ResizeRedraw",
BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
null, control, new object[] { true });
}
[C#]
myControl.Resize += new EventHandler(myControl_Resize);

private void myControl_Resize(object sender, EventArgs e)
{
((Control)sender).Invalidate();
}

A sample control

The following is a code of a user control displaying an ellipse that stretches and shrinks when the control's size changes:
[C#]
public partial class MyControl : UserControl
{
public MyControl()
{
InitializeComponent();
ResizeRedraw = true;
}

protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
// draw a blue ellipse into the control area
e.Graphics.FillEllipse(new SolidBrush(Color.Blue), 2, 2,
ClientRectangle.Width - 4, ClientRectangle.Height - 4);
}
}
Whithout the ResizeRedraw statement, the control is redrawn only partially and the result looks like in figure 1 above. When the ResizeRedraw = true statement is included, the control is redrawn properly as shown in the following figure 2.

Fig. 2. A properly redrawn control after resizing.


Google Blogs. TopBots.BlogSpot.Com [Created By iMyriad CEO J Jay Stilla Lee" it is a Informative Social Media Marketing Bots News Blog & That List Free Downloads of Automated Bot Software Apps for Facebook, Twitter, Youtube, Google, Instagram & Social Media Websites Written By Jason "Jay Stilla" Lee Online. His Alias Mister Bots Is Software Creation Specialist whom Develops Marketing Bots and Software Scripts that are Given away at no cost weekly. He Also teaches SEO Secrets and Tools For Advertising" Blogger.Com -TopBots Website Blog Https://TopBots.BlogSpot.Com < Informative Software and internet Technology News Blog.. Web blogging on new 2015 Bots and 2014's Best Software Bots Automated and Scripted Combined.

Jay-Stilla Productions LLC - Limited Liability Corporation LLC

Thursday, December 18, 2014

(C# + VB) SEND EMAIL WITH ATTACHMENTS IN ASP.NET [ FULL SOURCE CODE] TUTORIAL WITH LIBRARIES INCLUDED ON TOPBOTS.BLOGSPOT.COM


Other Non Bot Options:
Can't Afford A Bot? Buy SEO & Social Media Metrics For Cheap Starting at $1 Dollar

 http://a.seoclerks.com/rss?


In this example i am going to describe how to send email with attachment in ASP.NET using fileUpload Control. I am saving the uploaded file into memory stream rather then saving it on server.And for this example i m using Gmail SMTP server to send mail, this code also works fine with any SMTP Server. For sending Email in ASP.NET , first of allwe need to add Syatem.Net.Mail namespace in code behind of aspx page.
C# Code Behindusing System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSend_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To.Add(txtTo.Text);
//mail.To.Add("amit_jain_online@yahoo.com");
mail.From = new MailAddress(txtFrom.Text);
mail.Subject = txtSubject.Text;
mail.Body = txtMessage.Text;
mail.IsBodyHtml = true;

//Attach file using FileUpload Control and put the file in memory stream
if (FileUpload1.HasFile)
{
mail.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
}
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Credentials = new System.Net.NetworkCredential
("YourGmailID@gmail.com", "YourGmailPassword");
//Or your Smtp Email ID and Password
smtp.EnableSsl = true;
smtp.Send(mail);

}
}
VB.NET Code Behind

Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Net.Mail

Public Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

End Sub
Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim mail As New MailMessage()
mail.[To].Add(txtTo.Text)
'mail.To.Add("amit_jain_online@yahoo.com");
mail.From = New MailAddress(txtFrom.Text)
mail.Subject = txtSubject.Text
mail.Body = txtMessage.Text
mail.IsBodyHtml = True

'Attach file using FileUpload Control and put the file in memory stream
If FileUpload1.HasFile Then
mail.Attachments.Add(New Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName))
End If
Dim smtp As New SmtpClient()
smtp.Host = "smtp.gmail.com"
'Or Your SMTP Server Address
smtp.Credentials = New System.Net.NetworkCredential("YourGmailID@gmail.com", "YourGmailPassword")
'Or your Smtp Email ID and Password
smtp.EnableSsl = True

smtp.Send(mail)
End Sub
End Class

http://www.plndr.com/?r=9909916&utm_source=invite&utm_medium=referral&utm_campaign=personalurl http://addmf.co/?BGKB7CH http://addmf.cc/?BGKB7CH http://a.seoclerks.com/linkin/252867 http://www.reverbnation.com/c./a4/10232852/3928250/Artist/3928250/Artist/link http://proxypremium.blogspot.com/2014/01/free-daily-proxy-list-txt-download.html Jay%20Stilla







Likes For Free,
Unlimited Likes Bot,
Unlimited Follow Bot,
Email Scrapping Friend Adding Mail Sending Automated Bot,
We Build Bots,
SEO Bot,
Backlinking Bot,
VMware Virtual Social Friend Follow Connect Farming Bot,
Buy iTunes Store Reviews ,
Buy iTunes Store Auto Review Bot,
Buy amazon Store Auto Review Bot,
Buy Google Play Store Auto Review Bot,
Buy Yelp Store Auto Review Bot,
Add Friends,
Friend Adder,
Post Blaster Bot,
Twitter Bot,
Tweet Bot,
Insta Bot Bots,
Robo Bot - Multi Clicker - Automated Macro System,
Free Social Media God Bot,
Facebook God Bot,
Twitter God Bot,,
Wholesale Social Media Follows , LIkes, Post,
Facebook , Twitter , Google , 
Free Proxy Bot,
Free Ip Masking Bot,
Free Apple iTunes Review Bot,
Automated Review Bot,
Fake Reviews Bot,
Fake Reviewer,
Proxy Switcher,
Plays Increaser,
Views Increaser,
Automatic Review, Posting Program,
iTunes Bot,
Multi Task Macro Scirpt Auto Posting Article Bot,
Free Downloads, Master Key Gen Bot, Universal Key Maker Bot,

Free Download The Hunger Games MockingJay : Part 1 Studio Copy Dvd Blu Ray Full HD Movie 2:56.00 1080p Xvid, Dolby 5.1,7.1 Surround Sound Optimized Torrent Download, Full Studio Release, Leaked Copy, Private Screening Copy, Directors Cut, Extra Scenes, High Quality, Ultra Blu Ray Free Movie Download No Cost 100 Seeders 3 Leechers Jennifer Lawrence  Includes Half of The Hunger Games :Rise Of Fire Platinum Edition Part 2 Cam HD Blu Ray True Color 720 p, 1080 p JBL Mastered Audio Interpolated Torrent Movie Download Ultra Blu Ray Bootable Movie Disc