how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors
how creat a square picture with two colors how creat a square picture with two colors
how creat a square picture with two colors
Go Back  Xtreme Visual Basic Talk > > > how creat a square picture with two colors


Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2012, 09:57 AM
jason78944545 jason78944545 is offline
Centurion
 
Join Date: Feb 2008
Posts: 111
Default how creat a square picture with two colors


hi
i looking for a way to creat a picture like this:
http://acp.com.pt/color.png

how can i do that?
thanks for your help
Reply With Quote
  #2  
Old 10-25-2012, 10:38 AM
DrPunk's Avatar
DrPunkhow creat a square picture with two colors DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

Umm, no idea what you are drawing to, but presuming you have a canvas to draw on then you'd first fill that canvas with one colour (FillRectangle), then you can use FillPolygon with 3 corners of the canvas to create the "triangle".

i.e. given a picturebox...
Code:
 Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
       
    e.graphics.FillRectangle(Brushes.Blue, PictureBox1.ClientRectangle)

    Dim points(2) As Point
    points(0) = New Point(0, PictureBox1.ClientRectangle.Height) ' left bottom
    points(1) = New Point(PictureBox1.ClientRectangle.Width, 0) ' right top
    points(2) = New Point(PictureBox1.ClientRectangle.Width, PictureBox1.ClientRectangle.Height) ' right bottom

    e.graphics.FillPolygon(Brushes.Red, points)
End Sub
frm.jpg
__________________
There are no computers in heaven!

Last edited by DrPunk; 10-25-2012 at 10:50 AM.
Reply With Quote
  #3  
Old 10-25-2012, 05:26 PM
hDC_0how creat a square picture with two colors hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default HTML Canvas drawing

Quote:
Originally Posted by DrPunk
no idea what you are drawing to, but presuming you have a canvas to draw on then you'd first fill that canvas with one colour (FillRectangle), then you can use FillPolygon with 3 corners of the canvas to create the "triangle".
Since this is a web programming forum question, maybe the canvas you're looking to use is an HTML5 canvas and maybe the language is javascript?

If so then here's a jsFiddle page with some working code:
http://jsfiddle.net/hDC_0/sjLsd/

Note: You can adjust the "50" value downward to get it as small as you want.
HTML code:
Code:
<canvas id="c" />
JavaScript Code:
Code:
var c2 = document.getElementById('c').getContext('2d');
c2.fillStyle = '#0f0';
c2.beginPath();
c2.moveTo(0, 0);
c2.lineTo(50, 0);
c2.lineTo(50, 50);
c2.lineTo(0, 50);
c2.closePath();
c2.fill();
var c3 = document.getElementById('c').getContext('2d');
c3.fillStyle = '#f00';
c3.beginPath();
c3.moveTo(50, 0);
c3.lineTo(50, 50);
c3.lineTo(0, 50);
c3.closePath();
c3.fill();
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors how creat a square picture with two colors
how creat a square picture with two colors
how creat a square picture with two colors
 
how creat a square picture with two colors
how creat a square picture with two colors
 
-->