Top

C# - Force .NET applications to require Administrator's privilege.

C#
CSHARP
.NET
FRAMEWORK
WINDOWS
DEVELOPMENT
SNIPPET
GUI

This process is as easy as it comes and totally defies a famous quote.

Easier said than done!

I use Visual Studio Ultimate 2013 therefore, this small snippet is the follow up I did after adding this feature in one of my personal project. Forcing administrative privilege requirement on an application built using .NET frameworks sounds quite difficult or do the lengthy way, Right Click > Run as Administrator.

In order to achieve this, you should modify the default manifest file which the Visual Studio generates during the compile process.

  1. Right Click on your Project (in Visual Studio).
  2. Add or (Press Ctrl + Shift + A)
  3. New Item.
  4. Application Manifest File (Leave the name as it is, app.manifest)
  5. Uncomment the line or copy and paste it outside the comment.

Your app.manifest default layout should be like this

<asmv1:assembly manifestversion="1.0"
	xmlns="urn:schemas-microsoft-com:asm.v1"
	xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
	xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<assemblyidentity version="1.0.0.0" name="MyApplication.app/">
		<compatibility
			xmlns="urn:schemas-microsoft-com:compatibility.v1">
			<application></application>
		</compatibility>
	</assemblyidentity>
</asmv1:assembly>
Read More

Allowing file Drag and Drops in C#.

C#
CSHARP
.NET
FRAMEWORK
WINDOWS
DEVELOPMENT
SNIPPET
GUI

Today, during my personal coding session, I stumbled upon an annoying repetitive thing called browsing for files from the program I was developing. I am sure, I could have just provided a path to the file and not bother with browsing for the file.

Nonetheless, that coding session went well, ignored the annoyance and continued with coding. This morning, as I am typing this blog post, I decided to have a file Drag and Drop feature, might save a little time, but who knows if it will really save any amount of time.

I’ll keep it simple and show you the steps to enable Drag and Drop in your form.

Depending on your form component, choose the component you wish to enable Drag and Drop. It can be any component, I believe! You can also enable Drag and Drop in the whole form as well.

Image

Open your code window and in the Form constructur below InitializeComponent(); add this below it.

this.AllowDrop = true;
this.DragEnter += Main_DragEnter;
this.DragDrop += Main_DragDrop;

Add these methods below the constructor or ..

Read More

Rainbow border with linear-gradient in (S)CSS.

SCHEME
COLOR
DESIGN
CSS
SCSS
STYLE
CODE
SNIPPET

As seen in couple websites, I wanted to implement and add rainbow border. Here’s how to do it.

Image

Demo from JSFiddle is provided below -

In your regular HTML file, normally body or header.

<body>
  <h1>Prashant Says hello! - <a href="https://www.prashant.me/development/2016/01/03/rainbow-border-with-linear-gradient-in-s-css.html">prashant.me</a></h1>
</body>

I use SCSS pre-processor therefore here’s the code which can easily be converted to regular CSS.

Read More

Adding a cool Preloading animation on your website.

SETUP
JQUERY
JAVASCRIPT
PRELOAD
IMAGE
CSS
HTML
WEBSITE
FRONTEND
DESIGN
STYLE

I am sure you have already stumbled upon plenty of websites with full blank screen with a cool animation in the center for you to watch while the page loads which I recently found out is known as Preloader. Here I am writing one of the shortest tutorials I’ve ever written in this blog.

I shall be honest to you, I tried to create my own animation through Adobe Photoshop but failed miserably therefore I searched around in the net for ready-made cool animations and found plenty of them. I used the 3D Cube thing which I liked, looks funky and cool but there are plenty of animated images *.gif you can find online.

Read More