Draw on the screen without a form

Method 1: Call the Windows API You need System.Drawing and System.Runtime.InteropServices. You may need to add project references to them. using System.Runtime.InteropServices; using System.Drawing; Add the methods to your class with P/Invoke [DllImport(“User32.dll”)] public static extern IntPtr GetDC(IntPtr hwnd); [DllImport(“User32.dll”)] public static extern void ReleaseDC(IntPtr hwnd, IntPtr dc); Get a Graphics object for the entire … Read more

Best way to draw a bar chart in LaTeX? [closed]

Package: bchart Manual Example code: \documentclass[varwidth=true, border=2pt]{standalone} \usepackage{bchart} \begin{document} \begin{bchart}[step=2,max=10] \bcbar{3.4} \smallskip \bcbar{5.6} \medskip \bcbar{7.2} \bigskip \bcbar{9.9} \end{bchart} \end{document} Result: Package: pgfplots Manual: Page 81 – 89 Example code: % Source: https://tex.stackexchange.com/a/8584/5645 \documentclass[varwidth=true, border=2pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ symbolic x coords={a small bar, a medium bar, a large bar}, xtick=data ] \addplot[ybar,fill=blue] coordinates { (a … Read more

Fast 2D graphics in WPF

I believe the sample code provided is pretty much as good as it gets, and is showcasing the limits of the framework. In my measurements I profiled an average cost of 15-25ms is attributed to render-overhead. In essence we speak here about just the modification of the centre (dependency-) property, which is quite expensive. I … Read more

How do I draw lines using XNA?

When working with XNA, everything (even 2d primitives) have to be expressed in a way that a 3d card can understand, which means that a line is just a set of vertices. MSDN has a pretty good walkthrough here: http://msdn.microsoft.com/en-us/library/bb196414.aspx#ID2EEF You’ll find that it takes more code to render a primitive line than it would … Read more

Convert bitmaps to one multipage TIFF image in .NET 2.0

Start with the first bitmap by putting it into an Image object Bitmap bitmap = (Bitmap)Image.FromFile(file); Save the bitmap to memory as tiff MemoryStream byteStream = new MemoryStream(); bitmap.Save(byteStream, ImageFormat.Tiff); Put Tiff into another Image object Image tiff = Image.FromStream(byteStream) Prepare encoders: var encoderInfo = ImageCodecInfo.GetImageEncoders().First(i => i.MimeType == “image/tiff”); EncoderParameters encoderParams = new EncoderParameters(2); … Read more

Is there already a canvas drawing directive for AngularJS out there?

Ok I did one and it is actually pretty easy: app.directive(“drawing”, function(){ return { restrict: “A”, link: function(scope, element){ var ctx = element[0].getContext(‘2d’); // variable that decides if something should be drawn on mousemove var drawing = false; // the last coordinates before the current move var lastX; var lastY; element.bind(‘mousedown’, function(event){ if(event.offsetX!==undefined){ lastX = … Read more

How can I parse out points and draw a route on a Google Map in Android?

An example URL you’re going to parse is… http://maps.googleapis.com/maps/api/directions/xml?origin=52.31,16.71&destination=51.27,6.75&sensor=false change origin [lat,long] and destination[lat, long] for your purpose — points fetching import java.io.StringReader; import java.util.ArrayList; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserFactory; import net.gynsoft.citydusseldorf.lib.HttpClient; import android.os.Handler; import com.google.android.maps.GeoPoint; public class MapRoute { private GeoPoint gpSrc = null; private GeoPoint gpDest = null; private ArrayList<GeoPoint> alRoute = new ArrayList<GeoPoint>(); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)