|
You may want to look at Extended Cursors for .Net[^] as it has a whole bundle of features.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Thanks you!
Anyhow my problem was to make a cursor that like a zoomed version of the screen!! So it doesn't help!
But anyhow, all working by now!
|
|
|
|
|
I want to convert graphics such as rectangles, circles, etc. to truetype files. However, I can't write the geometry data for graphics to these truetype files.Is there have any code or tutorial to achieve this goal?
|
|
|
|
|
I am programming in C++. I have a lot of work that uses the GDI, GDI+ or the older canvas to display graphs and chart. I need to draw a 3D mesh surface using these tools. Is there any sample code using these draw tools?
|
|
|
|
|
Austin_Cpp wrote: Is there any sample code Quite probably, but you have to go and search for it.
|
|
|
|
|
I have searched quite a bit with no luck. Unfortunately GDI is not considered a good option for 3D programming and almost all the samples are in OpenGL or Direct3D. I really can't use OpenGL or Direct3D without major changes to my code. GDI+ almost feels obsolete with very little activity on code web sites.
|
|
|
|
|
hi, i am using c# and i have two color.
color p1, p2;
how do i compare if they are almost the same? as in like their color value with only very slight difference? should i compare the hue? with some threshold between the two.?
can anyone please advise.
|
|
|
|
|
I'm trying to import a terrain that I made in Blender by exporting it (from Blender) in .fbx format.
This model has only one modelmesh and Blender tells me in the top right hand corner that I have 16,384 verts which is correct since I divided my mesh into 128*128 equal parts.
I then imported my model into XNA using the Content pipeline and loaded it into a Model class.
I inserted a breakpoint on this line to "watch" the verticesIn.length property.
land.Meshes[0].MeshParts[0].VertexBuffer.GetData<VertexPositionNormalTexture>(verticesIn)
The verticesIn.length property was set to 54452, which is just over 3.3 times the number of vertices I'm meant to have as shown in Blender.
I'm using Blender v2.72 and XNA v4.0.
Any help will be greatly appreciated.
Kamran Kamal
|
|
|
|
|
I went through my model creation process again; saved and exported after each step and checked the number of vertices in XNA.
Everything appears fine until the deform modifier is applied in Blender.
As a work-around I decided to export my model after applying modifier. Importing the model into a new blender file, and then exporting the model. This worked!
Before doing this, I had tried exporting my model in .x format but this didn't make any difference.
I'm not sure if this problem exists with any modifier or just the deform modifer.
|
|
|
|
|
I'm doing quite a bit of graphics work that involves displaying material on a cartesian coordinate graph using GDI+ methods (DrawLine, DrawRectangle, etc) in the Paint routines of a PictureBox.
I'm always having to deal with scaling, rotation matrices and the other complications because the picturebox needs to have it's 'world' scaled rotated and translated before displaying normal Cartesian coords properly. Even with all this, it's always extra work to handle the fact that pens and some other graphics objects then draw their sizes transformed as well, and mouse events don't necessarily return points correctly.
Many years ago, I used TrueBasic and it had a drawing component that you could set up as simple as giving the width, height and everything transformed accordingly. I'm looking for a dotnet component that will give me a similiar object so I can stop having to customize the existing picturebox. Paid components are fine, but I have to be able to use GDI+ to draw in it or it must support something similiar. I do *not* want to use graphing/charting components that require the graphics objects/points to be stored in their own arrays or other unique systems. I want to do the drawing myself.
Any suggestions for a third party component?
|
|
|
|
|
please use System.Drawing namespace in your project.
where you find the Graphics class which will give you all option to Draw anything by using cartesian co-ordinate system.
for example..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace WaveformDemo
{
public partial class WaveDisplay : UserControl
{
[DefaultValue(10)]
int _XDivision; //Total X Division
[DefaultValue(10)]
int _YDivision;
[DefaultValue(10.0f)]//1 Volt per Division
float _voltsPerDivision;
[DefaultValue(10.0f)]//1 Sec per Division
float _timePerDivision;
[Browsable(true),DefaultValue(10)]
public int XDivisions
{
get
{
return _XDivision;
}
set
{
_XDivision = value;
}
}
[Browsable(true), DefaultValue(10)]
public int YDivisions
{
get
{
return _YDivision;
}
set
{
_YDivision = value;
}
}
[Browsable(true),DefaultValue(10.0f)]
public float VoltagePerDivision
{
get
{
return _voltsPerDivision;
}
set
{
_voltsPerDivision = value;
}
}
[Browsable(true), DefaultValue(10.0f)]
public float TimePerDivision
{
get
{
return _timePerDivision;
}
set
{
_timePerDivision = value;
}
}
public override Image BackgroundImage
{
get
{
return base.BackgroundImage;
}
set
{
base.BackgroundImage = value;
}
}
public override ImageLayout BackgroundImageLayout
{
get
{
return base.BackgroundImageLayout;
}
set
{
base.BackgroundImageLayout = value;
}
}
public WaveDisplay()
{
InitializeComponent();
_voltsPerDivision = 10.0f;
_timePerDivision = 10.0f;
_XDivision = 10;
_YDivision = 10;
_s = new Sample();
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
if (BackgroundImage != null)
{
g.DrawImage(BackgroundImage, ClientRectangle);
}
else
{
Brush b = null;
b = new SolidBrush(this.BackColor);
g.FillRectangle(b, this.ClientRectangle);
}
Pen pen = new Pen(ForeColor);
Rectangle r = new Rectangle(ClientRectangle.Left, ClientRectangle.Top, ClientRectangle.Width, ClientRectangle.Height);
r.Inflate(new Size((int)(-ClientRectangle.Width * 0.1f),(int) (-ClientRectangle.Height * 0.1f)));
double xPixelPerDiv = (double)r.Width / (double)_XDivision;
double yPixelPerDiv = (double)r.Height /(double)_YDivision;
double TimePerUnit = _timePerDivision/_XDivision;
double VoltsPerUnit = _voltsPerDivision/_YDivision;
string s1 = null;
for (int i = 0; i <= _XDivision; i++)
{
g.DrawLine(pen, new Point((int)(r.Left + xPixelPerDiv * i), r.Top),
new Point((int)(r.Left + xPixelPerDiv * i), r.Bottom));
s1 = (_timePerDivision * i).ToString();
g.DrawString(s1, Font, new SolidBrush(ForeColor), new PointF((int)(r.Left + xPixelPerDiv * i), r.Bottom + 10));
}
for (int i = 0; i <= _YDivision; i++)
{
g.DrawLine(pen, new Point((int)(r.Left), (int)(r.Bottom - i * yPixelPerDiv)),
new Point((int)(r.Right), (int)(r.Bottom - i * yPixelPerDiv)));
s1 = (_voltsPerDivision * i).ToString();
g.DrawString(s1, Font, new SolidBrush(ForeColor), new PointF(r.Left - 15, (int)(r.Bottom - yPixelPerDiv * i)));
}
_s.Render(g,r,XDivisions*TimePerDivision);
//base.OnPaint(e);
}
Sample _s;
}
}
|
|
|
|
|
Thanks, I'm aware that the math can be done manually. I was hoping for a third-party component so I could focus my efforts elsewhere and not have to focus on writing code for the existing drawing components.
|
|
|
|
|
I've been searching for an answer, but I can't seem to find what I'm looking for.
Basically, I have a TTF font with some custom glyphs. I have successfully "painted" them on my OpenGL canvas (C# using Tao). My question is: is it possible to rotate the glyph (from 0-360 degrees)?
I need to be able to rotate the glyph depending on the heading data received - this way, the glyph is facing the correct direction.
If this is not possible, do you have any suggested alternatives? I've considered importing the glyph as an image and converting it to a bitmap - but I'm not sure if this will work either.
|
|
|
|
|
Good day friends. I have window 7 ultimate as my OS, and DX 11 is installed. Now, I want to install DX 8 or 9 but finding it difficult to do it. It refused to install. How can I do it?
|
|
|
|
|
Otekpo Emmanuel wrote: It refused to install. Meaning what?
|
|
|
|
|
I learnt from an article I read that dx11 can't be used with vb in ease way. So, the available tutorials are limited to dx 5, 6, 7, 8 and 9. And my system has dx11 installed. So, I wanted to un-install dx11 and replace it with dx 8 or 9 but is not successful because dx 1r is higher than 8 and 9. How can I do the replacement?
|
|
|
|
|
You need to uninstall DX11 and make sure that all associated registry keys are removed. You may need to check with Microsoft for more information on this.
|
|
|
|
|
Otekpo Emmanuel wrote: I learnt from an article I read that dx11 can't be used with vb in ease way Do you have any problems now? If not you should not care about something you have read somewhere.
You can try to install the DX9 runtime from http://www.microsoft.com/en-us/download/details.aspx?id=8109[^] or the SDK from http://www.microsoft.com/en-us/download/details.aspx?id=6812[^]. This should be possible because only missing parts will be installed and DX11 contains DX9. In fact the DX version that will be used depends on the capabilities of your graphics card. If your graphics card does not support DX10/11, DX9 will be used.
The runtime is used by most games and may be already installed if you have installed some games on your system. The SDK is only required if you want to use DX for your own programs (it includes the runtime).
From the above runtime download link:
Quote: The DirectX runtime cannot be uninstalled
So you should try to use your version first. If you really need a development system with an older DX version, you must setup one using an old Windows version.
|
|
|
|
|
I am following a request to write C++ code for a label that contains several text elements in one single line, varying by font, size, color.... Ok, that can be done easily in GDI+ by measuring each element's width and then execute a DrawString for each of the text elements starting at its calculated position.
So far, I failed miserably.
The horizontal text positions did not appear to be correct. I reverted now to very simple text measuring tests which confused me even more.
Test 1: Use of MeasureString
With the same font, the width of the string "MM" does not match the double with of the string "M". This cannot be explained with eventual rounding problems.
Test2: Use of MeasureCharacterRanges
Used the same font as for the first test. The width of "MM" is now exactly double of the width of "M". But: The width of the "M" ist lightyears away from the measurement result in the first test.
Here's the code I have used for the two tests:
void ApplWindow_TextDrawTest(HDC hDC)
{
Gdiplus::Graphics *G = new Gdiplus::Graphics(hDC);
G->SetTextRenderingHint(TextRenderingHint::TextRenderingHintClearTypeGridFit);
Gdiplus::StringFormat MyFormat;
MyFormat.SetAlignment(Gdiplus::StringAlignment::StringAlignmentNear);
MyFormat.SetFormatFlags(Gdiplus::StringFormatFlags::StringFormatFlagsNoWrap);
Gdiplus::Font TextFont(L"Calibri", 36, Gdiplus::FontStyle::FontStyleBold, Gdiplus::Unit::UnitPoint);
const wchar_t *Text1M = L"M";
Gdiplus::PointF TextOrigin1M(0, 0);
Gdiplus::RectF TextBounds1M;
const wchar_t *Text2M = L"MM";
Gdiplus::PointF TextOrigin2M(0, 50);
Gdiplus::RectF TextBounds2M;
G->MeasureString(Text1M, (INT)wcslen(Text1M), &TextFont, TextOrigin1M, &MyFormat, &TextBounds1M);
G->MeasureString(Text2M, (INT)wcslen(Text2M), &TextFont, TextOrigin2M, &MyFormat, &TextBounds2M);
Gdiplus::Status RCode;
Gdiplus::RectF LayoutRect(0, 0, 1000, 100);
Gdiplus::Region RegionsList[3];
Gdiplus::CharacterRange CRanges[3];
CRanges[0].First = 0; CRanges[0].Length = 1;
CRanges[1].First = 1; CRanges[1].Length = 1;
CRanges[2].First = 0; CRanges[2].Length = 2;
MyFormat.SetMeasurableCharacterRanges(3, CRanges);
G->MeasureCharacterRanges(Text2M, (INT)wcslen(Text2M), &TextFont, LayoutRect, &MyFormat, 3, RegionsList);
RCode = RegionsList[0].GetBounds(&TextBounds1M, G); RCode = RegionsList[1].GetBounds(&TextBounds1M, G); RCode = RegionsList[2].GetBounds(&TextBounds2M, G);
delete G;
}
Drawing of text with GDI+ gives me very nice results, that's why GDI+ is my first choice here. Does anybody have an idea how I can measure my texts correctly?
Thanks in advance.
|
|
|
|
|
Update
I have added one more test which is using standard GDI, and I have changed the GDI+ font to units of pixels. Unfortunately, this third test shows results which do not match the previous results at all.
Does anybody have an idea why I get so different results?
Since I had not only added a third test but also changed the code of the first tests I am appending the full example here; the results I found have been added as comments:
void ApplWindow_TextDrawTest(HDC hDC)
{
Gdiplus::Graphics *G = new Gdiplus::Graphics(hDC);
G->SetTextRenderingHint(TextRenderingHint::TextRenderingHintClearTypeGridFit);
Gdiplus::StringFormat MyFormat;
MyFormat.SetAlignment(Gdiplus::StringAlignment::StringAlignmentNear);
MyFormat.SetFormatFlags(Gdiplus::StringFormatFlags::StringFormatFlagsNoWrap);
Gdiplus::Font TextFont(L"Calibri", 36, Gdiplus::FontStyle::FontStyleBold, Gdiplus::Unit::UnitPixel);
const wchar_t *Text1M = L"M";
Gdiplus::PointF TextOrigin1M(0, 0);
Gdiplus::RectF TextBounds1M;
const wchar_t *Text2M = L"MM";
Gdiplus::PointF TextOrigin2M(0, 50);
Gdiplus::RectF TextBounds2M;
G->MeasureString(Text1M, (INT)wcslen(Text1M), &TextFont, TextOrigin1M, &MyFormat, &TextBounds1M);
G->MeasureString(Text2M, (INT)wcslen(Text2M), &TextFont, TextOrigin2M, &MyFormat, &TextBounds2M);
Gdiplus::Status RCode;
Gdiplus::RectF LayoutRect(0, 0, 1000, 100);
Gdiplus::Region RegionsList[3];
Gdiplus::CharacterRange CRanges[3];
CRanges[0].First = 0; CRanges[0].Length = 1;
CRanges[1].First = 1; CRanges[1].Length = 1;
CRanges[2].First = 0; CRanges[2].Length = 2;
MyFormat.SetMeasurableCharacterRanges(3, CRanges);
G->MeasureCharacterRanges(Text2M, (INT)wcslen(Text2M), &TextFont, LayoutRect, &MyFormat, 3, RegionsList);
RCode = RegionsList[0].GetBounds(&TextBounds1M, G); RCode = RegionsList[1].GetBounds(&TextBounds1M, G); RCode = RegionsList[2].GetBounds(&TextBounds2M, G);
int MapModeResult = SetMapMode(hDC, MM_TEXT); HFONT TextFont3 = CreateFont(36, 0, 0, 0, FW_BOLD, false, false, false, ANSI_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH | FF_DONTCARE, L"Calibri");
HGDIOBJ PrevFont = SelectObject(hDC, TextFont3);
ABCFLOAT ABCCharData;
BOOL RFlg = GetCharABCWidthsFloat(hDC, (UINT)'M', (UINT)'M', &ABCCharData);
delete G;
}
|
|
|
|
|
You should try -36 as font size in your test#3, this matches the font size chosen in the other tests.
Try better
|
|
|
|
|
I think I found the answer to my question:
GDI and GDI+ do both not resolve by fractions of pixels. That is mainly why my measurement result and the rendered output do not match in all situations.
I have now received an advice from a friend to take a closer look into the features of DirectWrite. Indeed, this engine appears to be the solution for my demands.
|
|
|
|
|
Hello ,
I am looking for an image editor control to integrate with my asp.net website project.I have tried Telerik "RadImageEditor" but it does not fulfill my needs like.
1-Control Canvas size.
2-Save image with Provided DPI
3-After Saving can edit the Saved image (like in photoshop where objects are seperate and can be edited any time after) if this is not possible then it should have selection option so that i can select any part of image and can edit it.
can u pls suggest me some controls that can itegrate with asp.net website project.
|
|
|
|
|
I can suggest one thing - STOP POSTING IN MULTIPLE FORUMS !!!
pick the best forum that you think fits, and post there, ONCE
|
|
|
|
|
I once heard that one of the advantages of PNG (over jpg eg.) is that when used on a webpage the image comes through in "blocks" making the site more responsive, while jpg had to be loaded in "one go".
Did I dream this or is this really so?
(I could only find things like transparancy, better for logo's etc... where jpg is better for real photos)
thanks.
|
|
|
|
|