Click here to Skip to main content
15,890,845 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Working with 3D models created in Blender Pin
Pete O'Hanlon12-Mar-09 0:27
mvePete O'Hanlon12-Mar-09 0:27 
QuestionWPF: How to make resizing custom datagrid column? [modified] Pin
MichalDawn11-Mar-09 22:58
MichalDawn11-Mar-09 22:58 
AnswerRe: WPF: How to make resizing custom datagrid column? Pin
ABitSmart11-Mar-09 23:40
ABitSmart11-Mar-09 23:40 
GeneralRe: WPF: How to make resizing custom datagrid column? Pin
MichalDawn11-Mar-09 23:51
MichalDawn11-Mar-09 23:51 
GeneralRe: WPF: How to make resizing custom datagrid column? Pin
ABitSmart11-Mar-09 23:53
ABitSmart11-Mar-09 23:53 
GeneralRe: WPF: How to make resizing custom datagrid column? [modified] Pin
MichalDawn12-Mar-09 0:02
MichalDawn12-Mar-09 0:02 
QuestionHow to render pixels of a bitmap correctly? Pin
Andy@11-Mar-09 5:03
Andy@11-Mar-09 5:03 
AnswerRe: How to render pixels of a bitmap correctly? Pin
Insincere Dave11-Mar-09 16:14
Insincere Dave11-Mar-09 16:14 
This problem occurs due to WPFs resolution independence and most noticible with images like your example. An overview is at http://msdn.microsoft.com/en-us/library/aa970908.aspx and if you search with terms like "wpf pixel snapping" you'll find a lot of blog posts about the subject.

In the end I got your example working with a rather crude method.
public MyControl()
{
	InitializeComponent();
	RenderOptions.SetBitmapScalingMode(this,BitmapScalingMode.NearestNeighbor);
	_pixelOffBmp = CreatePixelBmp(PIXEL_OFF_BRUSH);
	_matrixBmp = CreateMatrixBmp();
	SaveBmp(_matrixBmp);
	LayoutUpdated += (s, e) => InvalidateVisual();
}

protected override void OnRender(DrawingContext drawingContext)
{
	// base.OnRender(drawingContext);

	var pos = this.PointFromScreen(this.PointToScreen(new Point(0, 0)));
	double x = pos.X - Math.Floor(pos.X);
	double y = pos.Y - Math.Floor(pos.Y);
	drawingContext.DrawImage(_matrixBmp, new Rect(1-x,1-y, _matrixBmp.Width, _matrixBmp.Height));
}


If you just want a repeating pattern ImageBrush might be what your after.
You may want to rethink your approach if you want to get the best out of WPF. For example each LED could be an individual control laid out inside a UniformGrid and have its appearance change using data binding. This sudoku tutorial might give you some ideas although I don't know what your control is going to display, I was thinking along the lines of a graph/audio spectrum.
GeneralRe: How to render pixels of a bitmap correctly? Pin
Andy@12-Mar-09 2:59
Andy@12-Mar-09 2:59 
GeneralRe: How to render pixels of a bitmap correctly? Pin
Insincere Dave12-Mar-09 6:56
Insincere Dave12-Mar-09 6:56 
GeneralRe: How to render pixels of a bitmap correctly? Pin
Andy@17-Mar-09 4:20
Andy@17-Mar-09 4:20 
QuestionBind an attached property Pin
Pauwels Bart11-Mar-09 3:55
Pauwels Bart11-Mar-09 3:55 
AnswerRe: Bind an attached property Pin
ABitSmart11-Mar-09 16:57
ABitSmart11-Mar-09 16:57 
QuestionRe: Bind an attached property Pin
Pauwels Bart11-Mar-09 19:45
Pauwels Bart11-Mar-09 19:45 
AnswerRe: Bind an attached property Pin
ABitSmart11-Mar-09 21:00
ABitSmart11-Mar-09 21:00 
QuestionRe: Bind an attached property Pin
Pauwels Bart11-Mar-09 22:33
Pauwels Bart11-Mar-09 22:33 
AnswerRe: Bind an attached property Pin
ABitSmart11-Mar-09 23:13
ABitSmart11-Mar-09 23:13 
GeneralRe: Bind an attached property Pin
Pauwels Bart12-Mar-09 0:54
Pauwels Bart12-Mar-09 0:54 
QuestionCan a WPF browser app be hosted on a server and accessed multiply by other users Pin
DimitarS10-Mar-09 21:56
DimitarS10-Mar-09 21:56 
AnswerRe: Can a WPF browser app be hosted on a server and accessed multiply by other users Pin
Pete O'Hanlon10-Mar-09 22:34
mvePete O'Hanlon10-Mar-09 22:34 
GeneralRe: Can a WPF browser app be hosted on a server and accessed multiply by other users Pin
DimitarS10-Mar-09 22:36
DimitarS10-Mar-09 22:36 
QuestionDecoupling WCF client proxy Pin
Mark J. Miller10-Mar-09 14:02
Mark J. Miller10-Mar-09 14:02 
QuestionTreeView vertical scrollbar bug Pin
Steve The Plant10-Mar-09 10:26
Steve The Plant10-Mar-09 10:26 
AnswerRe: TreeView vertical scrollbar bug Pin
ABitSmart10-Mar-09 17:23
ABitSmart10-Mar-09 17:23 
GeneralRe: TreeView vertical scrollbar bug Pin
Steve The Plant11-Mar-09 12:45
Steve The Plant11-Mar-09 12:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.