:::: MENU ::::
Monthly Archives: December 2015

Click bubble effect winform button c-sharp

clickBubble

I never worked in WPF before but recently i worked on it and delivered a successful product by using  Material Design and MahaApps  which are great WPF open source UI libraries. These libraries contains great UI controls here is a snapshot.

MashUp

if you see on above image when mouse clicks on a control (button) it shows you a transparent circle which grows up and disappear gradually. So I just tried to replicate this bubble effect in WinForm desktop UI controls.
In order to get this functionality first of all we need to subscribe the Control Paint Event so we can paint transparent ellipse on it.

We need to identify the Point as origin of the ellipse where user clicked on it so I would subscribe Control Click Event. When user click on it we record the click point as origin and  start painting  ellipse repeatedly and gradually by increasing the radius of ellipse.

Timer is used to draw ellipse repeatedly to look like an animation.
here is the Timer Tick Event which invalidate the control , Every control has invalidate function which can be used to invoke Paint event of that control on demand.

These above three events plays important role so explained you in detail. Now i will encapsulate this functionality into a  Component so we can re use it.

Now we have created a component with Name ClickEffect successfully. Once we build it we see it in VS tool Box like this

ClickEffect

Now we will drop this newly created component on a form and bind Button control with this component by setting t its property like below

Clickeffect2

and finally you will get this result.  You can download the complete solution from here

clickBubble

Please follow and like us:

Run Time Crop Images with asp.net mvc generic handler

some time  we ask end-user to upload the image and user can upload any size of image while image dimension does not fit our requirement i.e height and width does not have suite able aspect ratio so solution is to resize image forcefully or ask user to crop the image by himself. there are number of Client side image-cropping solution but here i would discuss server side approach in order to crop the image which can be combined with any client side Cropping solution.

generic handler in asp.net are best to return dynamic content like images and files. here i would create a generic handler using mvc 5 (any Mvc version can be used even web form asp.net with little modification ) in order to Crop images Run time. our generic handler will take image path and its dimension like height width to crop it and return cropped image to browser.
Here is the Code of Generic Handler

 


now we need to define a route in mvc RouteConfig Class so we can access the generic handler


Make sure runAllManagedModulesForAllRequests=true in you web.cofing file

and finally we should place images on our Images Directory which resides at root Directory

http://localhost/images

final out put will be look like this

Image without Crop

stream flowing through forest

Cropped Image

here we trigger generic handler by following below URL Pattern in order to crop the imag

 http:/localhost/cropImages/x-y-h-w-image.jpg

where point(x,y) are left ,top positions to start cropping and point(h,w) are
height and width of cropped images.
we will get the below result by following this URL

http://localhost/cropImages/150-150-400-400-nature.jpg
150-150-400-400-nature

http://localhost/cropImages/150-150-400-400-nature.jpg

You can download the complete solution RunTime-Image-Cropper

Please follow and like us:

Mixing two mp3 or wav files using NAudio and Lame

NAudio is an open source .NET library which contains a lot of useful audio related classes.
but now here i will use it to mix the mp3 or wave files so that they can be played parallel
with different sound volume like an ordinary sound composer or mixer.

this function encode the wave stream into mp3 stream and returns back

Please follow and like us:

generate-an-image-from-an-embedded-web-browser-control-c-sharp

There is a number of services which can generate image from a given URL or web page.
But sometimes we do not want to use third party services. So i just found a way to achieve this
by C# .net web browser control.

Please follow and like us:

Virtual Try-On for Eye Glasses using JQuery HTML and CSS3

Last time i was asked to implement a functionality for an Eye glasses store like visionexpress.com.
So i came up with this solutions which is the subset of complete functionality.
and now i am going to share with you.
here is the code.

here is out put


Increase size
decrease size
rotate clockwise
rotate anti clockwise

Please follow and like us: