|
but I only want to draw some line into picture control ,so it is no bitmap resource , I want to draw a line each 1 second (total is 60min),could you help me solve this problem?
|
|
|
|
|
but I only want to draw some line into picture control ,so it is no bitmap resource , I want to draw a line each 1 second (total is 60min),could you help me solve this problem?
Hansen
|
|
|
|
|
test using of CDC class.
CDC* pDC;<br />
pDC = GetDC();
and other members of CDC Class (MoveTo(), LineTo())
and final call invalidate() function for redraw controls.
Zo.Naderi-Iran
|
|
|
|
|
It's pervfect,i think use this way to draw line , it's no problem , but in the fact ,at the same time, I want to get point value in line by mouse .so I have to modify pixel .can you help me? very very thanks.
Hansen
|
|
|
|
|
I don't understand your problem exactly.
may write your code?
Zo.Naderi-Iran
|
|
|
|
|
my soft mainly function is communication and exchange parameters between PC and microprocessor . when PC get temperature value form microprocessor , It need display (one by one,each drop connect with line),and at the same time , I can catch some drop value form interface by mouse , if I don't reset the pixcel of picture control , it is very difficult to get a drop's situation by mouse ,so it can't get the drop value .
I draw line like as follows, if I only need draw line , I think this way is no problem, but I need catch one drop . so i don't know how to do .
CWnd* pWnd = GetDlgItem(IDC_COORD); //picture control ID
pWnd->GetWindowRect(&rect);
float mtd;
CString m_str;
int m_X,m_Y;
//==============interface display-------------------------
extern int CString_to_Int(CString *m_str,int *m_value);
CString_to_Int(&m_strX,&m_X);
CString_to_Int(&m_strY,&m_Y);
m_X=m_X-rect.left-30;
m_Y=m_Y;//-rect.top;
//=================================================================
pWnd->GetClientRect(&rect);
// create brush pencil object
pDC->SetBkMode(TRANSPARENT)
pDC->Rectangle(&rect);
m_left = rect.left+30 ;
m_top = rect.top+60 ;
m_right = rect.right-10 ; // right distance
m_bottom = rect.bottom-20 ; //画图区(刻度线)离低边框的距离
int m_IntervalPan = (m_right - m_left)/11; //共分n-1大格
m_Y=m_bottom-m_Y-47;
//m_X=m_X *m_IntervalPan/(m_Interval);//m_X*3600/(m_right-m_left);
if (m_IntervalPan < 1 ) m_IntervalPan =1;
// 创建画笔对象
//---------------Black---------------------------------------
CPen* pPenBlack = new CPen;
// Black画笔
pPenBlack->CreatePen(PS_SOLID,1,RGB(0,0,0)); //
//-------------Gray-------------------------------------------
CPen* pPenGray = new CPen;
pPenGray->CreatePen(PS_DOT,1,RGB(200,200,200)); //
//---------------PenMouse---------------------------------------------
CPen* pPenMouse = new CPen;
pPenMouse->CreatePen(PS_DOT,1,RGB(192,192,192)); //
//-------------Red-------------------------------------------
CPen* pPenRed = new CPen;
// 红色画笔
pPenRed->CreatePen(PS_SOLID,1,RGB(255,0,0));
//--------------------------------------------------------
// 创建画笔对象
CPen* pPenBlue = new CPen;
// 蓝色画笔
pPenBlue->CreatePen(PS_SOLID,1,RGB(0,0, 255));
//----------------------------------------------------------
// 创建画笔对象
CPen* pPenGreen = new CPen;
// 绿色画笔
pPenGreen->CreatePen(PS_SOLID,1,RGB(0,255,0));
//----------------------------------------------------------
// 选中当前Black画笔,并保存以前的画笔
CGdiObject* pOldPen = pDC->SelectObject(pPenBlack);
// 绘制坐标轴
pDC->MoveTo(m_left,m_top);
// 垂直轴
pDC->LineTo(m_left,m_bottom);
// 水平轴
pDC->LineTo(m_right,m_bottom);
// 写X轴刻度值
for (i = 0; i <=m_Xwidth; i += 600)
{
if(i==m_Xwidth)
{
str.Format(_T("%d 时间(分)"),(i/60));
}
else
{
str.Format(_T("%d"),(i/60));
}
pDC->TextOut(m_left+(i-40-m_Low)*m_IntervalPan/m_Interval,m_bottom+3,str);
}
// 写Y轴刻度值
for (i = 1000; i <=m_Yhigh; i += 1000)
{
str.Format(_T("%d"),(i/100));
pDC->TextOut((m_left+5),(m_bottom-i * (m_bottom - m_top) /m_Xwidth-7),str);
}
str=_T("位移(毫米)");
pDC->TextOut((m_left+5),(m_top),str);
//---------------------------------------------------------------------
// 绘制X轴刻度
for (i = 60; i <=m_Xwidth; i += 60)
{
if((i%600)==0)
{
// 10的倍数
pDC->MoveTo(m_left+(i-m_Low)*m_IntervalPan/m_Interval , m_bottom);
pDC->LineTo(m_left+(i-m_Low)*m_IntervalPan/m_Interval , m_bottom+6); //x轴的向下的长刻度
}
else
{
// 10的倍数
pDC->MoveTo(m_left+(i-m_Low) *m_IntervalPan/m_Interval, m_bottom);
pDC->LineTo(m_left+(i-m_Low) *m_IntervalPan/m_Interval , m_bottom+2); //x轴的向下的短刻度
}
}
.........
Hansen
|
|
|
|
|
Im not sure is this[^] helpful for you?
|
|
|
|
|
Thank you, I think it is no use . but I still want to say you :Thank you very much to help me .
Hansen
|
|
|
|
|
Im not sure did you need to GetPixel and SetPixel
|
|
|
|
|
Hi, I'm trying to completely suppress a window of another process, i.e. the main window doesn't display, doesn't appear at taskbar for even one second.
Imagine you are playing 3D game in full screen, suddenly a window appears and minimizes your game screen, and you die in the game...
I've tried using SetWindowsHookEx to install a hook for each WH_CALLWNDPROC and WH_CBT, then SetWindowLong to subclass the target window to modify every single call to WM_SHOWWINDOW, WM_SETFOCUS, WM_ACTIVATE, WM_ACTIVATEAPP, WM_WINDOWPOSCHANGING, etc. In addition, I also call LockSetForegroundWindow(LSFW_LOCK) and PostMessage(hWnd, WM_CLOSE, 0, 0) whenever possible.
In the subclass WindowProc, for every WM_WINDOWPOSCHANGING message, I modify the lParam, change the flags to SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_ NOOWNERZORDER|SWP_NOREPOSITION|SWP_NOSENDCHANGING|SWP_NOSIZE|SWP_NOZORDER
For every WM_SHOWWINDOW and WM_ACTIVATEAPP message, I modify the wParam to FALSE.
So far, the window will appear for a brief split second then disappear. This is still not good enough for me because of that split second, it minimizes the active game screen.
Does anybody know what other message, or flag that I show be trying? Is what I'm trying to do possible at all?
Thanks much!
|
|
|
|
|
Seriously? You have no control over the app that pops up this window???
|
|
|
|
|
Hi!
what is the problem for calling the CreateHardlink function?
i call this function in my project but it has "undeclared identifier" error.
i define _WIN32_WINNT in .h and .cpp files, but it has this error, yet.
#define _WIN32_WINNT 0X0500<br />
what do i do?
Zo.Naderi-Iran
|
|
|
|
|
I using CreateHardlink with #define _WIN32_WINNT 0X0500 and its compling without problem?where you declare #define
|
|
|
|
|
"#define _WIN32_WINNT 0X0500" is above ".cpp" file, what i call this function into it.
Zo.Naderi-Iran
|
|
|
|
|
If you insert it to StdAfx.h what happens?
|
|
|
|
|
valla sharmanda . man ham hamin moshkelo daram va natonestam halesh konam !
|
|
|
|
|
Hi!
i solve this problem:
in project properties, C/C++ option --> Command Line --> in "Additional options", you write: /D_WIN32_WINNT=0x0500
good luck (Ooo yesterday)
Zo.Naderi-Iran
|
|
|
|
|
See this :---> http://www.cygwin.com/ml/cygwin/2001-04/msg00779.html
|
|
|
|
|
Use this sample at :---> http://www.totalcmd.net/download.php?id=CreateHardLink
|
|
|
|
|
|
hi
i want write an application that work as a debuger.
i set a breakpointb in exe with "DebugeBreakProcess" function then i use "ContinueDebugEvent" function , But
it can not countinue execution the exe.
if you have information abut it please help me.
|
|
|
|
|
I think you can find your answer on www.Codeguru.com I think it has an article about exe files
|
|
|
|
|
Hello everybody!
I can't seem to find a reference on how the hell to do a simple operation like setting a control's "Enabled" to false... (ie, "gray" it out) In C# all you have to do is controlId.Enabled = false; , but MFC seems to handle things different... I'm being a complete n00b, but oh well... Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
For disable or enable you can use EnableWindow but if you want to work with controls you can declare variables for them.For example use of a Button you can declare CButton m_Button; and then m_Button.Functions Is this your question?
|
|
|
|
|
|