Hi. Im new to direct x, i only need simple functionality for my project. it will just be a load of cubes in an n*n*n grid where each block can be colorized and have its transparency altered. Im haveing a problem setting transparency which is to me more important that color. Hear is my test application. I create a cube but in the "device.DrawUserPrimitives(PrimitiveType.TriangleList,(vir.Length/3)-6,vir);" i only show half the sides so that i can test transparency.
I have looked hard and long to find the solution but with no joy. If anyone can help i would be a very happy man. the color is applied in the initVertecies() method and the scene is in draw() Method. Thankyou.

Code:
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;

using Microsoft.DirectX.PrivateImplementationDetails;

namespace DirectX_9_Test
{

	public partial class ViewPort : UserControl
	{
		private Point_3 CamPos=new Point_3();
		Collection<Point_3> p3VerteciesList;
		public bool isDeviceReady=false;
		public Microsoft.DirectX.Direct3D.Device device;
		CustomVertex.PositionColored[] vir;
		public ViewPort()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			InitDirectX();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		private void InitDirectX()
		{
			PresentParameters presentParams=new PresentParameters();
			presentParams.Windowed=true;
			presentParams.SwapEffect=SwapEffect.Discard;
			device=new Microsoft.DirectX.Direct3D.Device(0,Microsoft.DirectX.Direct3D.DeviceType.Hardware,this,CreateFlags.HardwareVertexProcessing,presentParams);
			device.RenderState.SourceBlend = Blend.SourceAlpha;
			device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
		}
		
		public void initCamra()
		{
			device.Transform.Projection=Matrix.PerspectiveFovLH((float)(Math.PI/4),(float)(Width/Height),1f,500f);
			device.Transform.View=Matrix.LookAtLH(new Vector3((float)CamPos.x,(float)CamPos.y,(float)CamPos.z),new Vector3(),new Vector3(0f,1f,0f));
			device.RenderState.Lighting=false;
			device.RenderState.CullMode=Cull.None;
		}
		private void initVertecies()
		{
			p3VerteciesList=Block.StandardBlock();
			vir=new CustomVertex.PositionColored[p3VerteciesList.Count];
			int n=0;
			foreach(Point_3 p in p3VerteciesList)
			{
				vir[n].Position=new  Vector3((float)p.x*50,(float)p.y*50,(float)p.z*50);
				vir[n].Color=(new ColorValue(255,2,0,255/2).ToArgb());
				n++;
			}
		}
		private void Draw()
		{
			device.VertexFormat=CustomVertex.PositionColored.Format;
			device.DrawUserPrimitives(PrimitiveType.TriangleList,(vir.Length/3)-6,vir);
			
		}
		protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
		{
			initVertecies();
			initCamra();
			device.Clear(ClearFlags.Target,Color.White,1.0f,0);
			device.BeginScene();
			Draw();
			device.EndScene();
			device.Present();
		}
		
		public void ViewPortKeyPress(object sender, KeyPressEventArgs e)
		{
			char c=e.KeyChar;
			switch(c)
			{
				case ' ':
					CamPos.y++;
					this.Invalidate();
					break;
				case 'x':
					CamPos.y--;
					this.Invalidate();
					break;
				case 'w':
					CamPos.z++;
					this.Invalidate();
					break;
				case 's':
					CamPos.z--;
					this.Invalidate();
					break;
				case 'a':
					CamPos.x++;
					this.Invalidate();
					break;
					
				case 'd':
					CamPos.x--;
					this.Invalidate();
					break;
			}
			
		}
	}
	
	public class Block
	{
		public static Collection<Point_3> StandardBlock()
		{Point_3 a,b,c,d,e,f,g,h;
			a=new Point_3(-0.5f,0.5f,-0.5f);
			b=new Point_3(0.5f,0.5f,-0.5f);
			c=new Point_3(0.5f,0.5f,0.5f);
			d=new Point_3(-0.5f,0.5f,0.5f);
			e=new Point_3(0.5f,-0.5f,-0.5f);
			f=new Point_3(-0.5f,-0.5f,-0.5f);
			g=new Point_3(0.5f,-0.5f,0.5f);
			h=new Point_3(-0.5f,-0.5f,0.5f);
			Collection<Point_3> block=new Collection<Point_3>();
			block.Add(d);block.Add(g);block.Add(h);
			block.Add(d);block.Add(c);block.Add(g);
			block.Add(c);block.Add(e);block.Add(g);
			block.Add(c);block.Add(b);block.Add(e);
			block.Add(b);block.Add(f);block.Add(e);
			block.Add(b);block.Add(a);block.Add(f);
			block.Add(a);block.Add(h);block.Add(f);
			block.Add(a);block.Add(d);block.Add(h);
			block.Add(a);block.Add(c);block.Add(d);
			block.Add(a);block.Add(b);block.Add(c);
			block.Add(h);block.Add(e);block.Add(f);
			block.Add(h);block.Add(g);block.Add(e);
			return block;
		}
	}
	
	public class Point_3
	{
		public double x=0,y=0,z=0;
		public Point_3()
		{
			
		}
		public Point_3(double x,double y,double z)
		{
			this.x=x;this.y=y;this.z=z;
		}
	}
}