|
See Here[^] and Here[^]maybe it is some helpful to you
|
|
|
|
|
hi all,
i have drawn a ellipse in the View using CDC::Ellipse(...),
but when i double click the mouse i dont want to see the ellipse what i have drawn in the mouse previously.
please give me a solution.
Uday
|
|
|
|
|
|
hi whitsky,
you have told to use invalidate, which will paint the entire window, but here once i have double click with the mouse i will genereate a Circle where i clicked and it must erase the first circle where i created.
sinario :
---------
first i created a Circle and double click any where in the screen
then at the double click a same circle what i have generated first it must created and the first created circle must disappear.
please help me out.
Uday kiran
|
|
|
|
|
CDC* pDC = GetDC();
dc->BeginPath()
dc->Ellipse(0,0,100,50);
See MSDN for more details.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
hi sarath,
you have told to use invalidate, which will paint the entire window, but here once i have double click with the mouse i will genereate a Circle where i clicked and it must erase the first circle where i created.
sinario :
---------
first i created a Circle and double click any where in the screen
then at the double click a same circle what i have generated first it must created and the first created circle must disappear.
please help me out.
Uday kiran
Uday kiran
|
|
|
|
|
Add member member variables
protected:
int m_nXPos;
int m_nYPos;
Initialize them to some default values in ctor say 25 and 50
in OnPaint Function
dc.Ellipse(m_nXPos - 50,m_nYPos -25,m_nXPos + 50,m_nYPos +25);
make sure that this call after appears only after CDialog::OnPaint();
In double click handler do the following...
void CSampleDialogDlg::OnLButtonDblClk(UINT nFlags, CPoint point)
{
m_nXPos = 50;
m_nYPos = 25;
if( point.x > 50)
m_nXPos = point.x;
if( point.y > 25)
m_nYPos = point.y;
InvalidateRect();
CDialog::OnLButtonDblClk(nFlags, point);
}
Hope this works...
for avoiding flickering you may have to use double buffering technique.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Hi, friend.
I think using Invalidate() in the mouse double click event can solve the problem. I will check and convey you.
Sachin M Narangale
VC++ can make everything...if we mould it properly!
MCA
9860019526
|
|
|
|
|
I said to uday kiran janaswamy this function but it seems its not good for his program
|
|
|
|
|
Hi all friends .
Is any technology for developing graphics program (GUI programming) faster than DirectDraw ?
Thank in advance .
|
|
|
|
|
You asked this question yesterday
|
|
|
|
|
|
toxcct wrote: repost[^]
give him GOOGLE DEATH!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
what do you mean by GUI technology...
There are different type of framework implementations like DirectX(3D), GDI,GDI+, OpenGL(3D).
For implementing GUI or design a UI normally you can use GDI or GDI+. it's fast enough.
AFAIK GDI+ and DirectX are based on COM which is language independent.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Hello all,
Yesterday I've taken all the day to search for a solution to this problem but couldn't find one. Hopefully one of you can hint me in the right direction.
What I'm trying to do is the following.
A selectable text like you can find it in the file properties of windows explorer. Additional this control should be able to draw different fonts/colors after each whitespace.
I tried to realize this with a CEdit derived class in which I used OnPaint to draw the colored text.
The Problem is that whenever the selection is changed either by Mouse or Keyboard the CEdit seems to use alternative drawing routines and therefore overwrite my colored text.
So I tried ON_CONTROL_REFLECT for the messages EM_SETSEL and EN_SELCHANGE. I need to handle this message directly in the control not in the parent class. I also tried the other reflection handlers because I wasn't sure if ON_CONTROL_REFLECT is the right one here. Unfortunately there is no real documentation about CEdit messages in MSDN. I also searched alot in google groups and on the developer sites like this and codeguru but didn't find any hint.
So can anyone help me and tell me how I can react on a changed selection in the CEdit or if this is possible at all? The control would be finished if I could handle the changed selection because I would be able to draw only the non-selected parts of the control. But if I don't find a way to handle this I'd have to take a whole new approach to the problem and use a different control.
Thx for any help,
whiteman
|
|
|
|
|
|
I have a file in which I write some names. lets say: Fiat, Ford, BMW. How can I open the file and read the entries one by one. eg: if only want to read Fiat and Ford then read only Fiat and Ford.
|
|
|
|
|
if ur writing this name in seperate lines, u can use
CStdioFile::ReadString()..
nave
|
|
|
|
|
Thanks a lot it works using ReadString(). But how can I edit the file and replace Fiat with Mercedes, let's say?
|
|
|
|
|
tanarnelinistit wrote: how can I edit the file and replace Fiat with Mercedes
this is a little bit difficult. here Mercedes have more characters than Fiat. U cannot insert character in a file in any place other that EOF.
But replacing Fiat with a word of same character is possible. Move the file pointer to the begining of the word using CFile::Seek() function. then use CFile::Write() to replace it.
nave
|
|
|
|
|
Read each of the lines from the "old" file into the "new" file up to the line that needs to be changed. Write the line into the "new" file. Read the remaining lines from the "old" file into the "new" file. Close both files. Delete the "old" file. Rename the "new" file. Make sense?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How are you trying to open a FILE?
Using FILE * - fread(),fgetc(),fscanf().
CFile::Read().
CStdioFile::ReadString()- these classes have methods to read from the file.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
In additional you can use
<br />
CFile m_file(m_Filename,CFile::modeRead);<br />
CArchive m(&m_file,CArchive::load);<br />
m.ReadString(str);<br />
....<br />
|
|
|
|
|
wish me a good luck and I will need help.
salem ,c wiem.
|
|
|
|