|
You can Google it to find samples.
|
|
|
|
|
|
There's a Paint for kids, called Tux Paint, which is open-source. The source is available for Unix / Linux, but going through that source would give you an idea.
|
|
|
|
|
I am trying to implement a CPropertySheet/CPropertyPage in my App. In the pages I use well tried and tested Owner Drawn List Boxes, derrived from CListBox. The Class I Derrived works well in a CDialog.
Put the thing in a CProperty Page, and it ASSERTS in CListBox.DrawItem(...) In Other Words, it called the MFC Base Class's DrawItem, instead of my Derived Class's DrawItem. It also does this before calling CMyPropertySheet::OnInitDialog() Or for that matter CMyPropertyPageq1::OnInitDialog(). Any Solutions or observations ?
Bram van Kampen
|
|
|
|
|
Did you properly subclass your controls?
JohnCz
MS C++ MVP
|
|
|
|
|
Hi @ All,
I´ve created an ActiveX with vs2008 in c++ with simple methods. Now I`m gonna try to usw this activeX in a C# form-application, but i can´t use the methods. I got an exception called: Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH));
I hope someone could help me, I also understand germany
Thanks!
The ActiveX:
...ctrl.cpp
BEGIN_DISPATCH_MAP(CIND890MTActiveScaleLibCtrl, COleControl)
DISP_FUNCTION_ID(CIND890MTActiveScaleLibCtrl, "Multiplikator", DISPID_MULTI, Multiplikator, VT_R8, VTS_PR8 VTS_PR8)
END_DISPATCH_MAP()
.......
double CIND890MTActiveScaleLibCtrl::Multiplikator(double zahlE, double zahlZ)
{
return zahlE + zahlZ;
}
..ctrl.h
class CIND890MTActiveScaleLibCtrl : public COleControl
{
static const int DISPID_MULTI = 1025555;
............
public:
double Multiplikator(double zahlE, double zahlZ);
}
..idl
library IND890MTActiveScaleLibLib
{
static const int DISPID_MULTI = 1025555;
[ uuid(862E674E-512D-4DCC-AE6F-AEED5F078E59),
helpstring("Dispatchschnittstelle für IND890MTActiveScaleLib Control")] dispinterface _DIND890MTActiveScaleLib
{
properties:
methods:
[id(DISPID_MULTI)] double Multiplikator(double zahlE, double zahlZ);
}
.......
[ uuid(8BEE0D1C-C726-4BD8-BEE0-4BD5E0027C9B),
helpstring("IND890MTActiveScaleLib Control"), control ]
coclass IND890MTActiveScaleLib
{
[default] dispinterface _DIND890MTActiveScaleLib;
[default, source] dispinterface _DIND890MTActiveScaleLibEvents;
};
}
The Form-Application:
Form1.cs:
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
AxIND890MTActiveScaleLibLib.AxIND890MTActiveScaleLib test;
public Form1()
{
InitializeComponent();
}
private void Speichern_Click(object sender, EventArgs e)
{
double erg = 0, zahl1 = 1234, zahl2 = 4321;
test.IsAccessible = true;
erg = test.Multiplikator(zahl1, zahl2);
}
}
}
Form1.Designer.cs
namespace WindowsFormsApplication1
{
partial class Form1
{
...............
private void InitializeComponent()
{
.......
this.test = new AxIND890MTActiveScaleLibLib.AxIND890MTActiveScaleLib();
((System.ComponentModel.ISupportInitialize)(this.test)).BeginInit();
..........
this.test.Enabled = true;
this.test.CreateControl();
this.test.Name = "test";
this.test.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("test.OcxState")));
this.test.TabIndex = 0;
...........
}
}
}
|
|
|
|
|
Hi,
I am using MS Flexgrid 6.0 in my MFC VC++ application. Trying to merge cells when the adjacent cells having same value.
Input:
------------------
Col1 Col2 Col3
------------------
ABC BBC CCD
BBV BBV DDC
CCD CCD RRD
And need the Outcome as;
------------------
Col1 Col2 Col3
------------------
ABC BBC CCD
BBV DDC
CCD RRD
From above 2nd and 3rd row the adjacent cells having the same value(BBV and CCD) and its merged. I tried with m_Grid.SetmergeCells(4) but its not working. How to acheive? Any sample code..
Reg,
Palav.
|
|
|
|
|
I know how to get the file type icon if this file is hello.cpp test.txt
but if this file name is such as a b 2 3, that does not have the type name
how to get icon of this file?
|
|
|
|
|
If it does not have a type name then it will not have a default icon.
The best things in life are not things.
|
|
|
|
|
In the simple win32 program, I'm having two buttons on the dialog. The difference between the two buttons is that one is dynamically created with dialog as parent and the other button is statically placed on the dialog. But the two buttons appears to be different in the font. When I debug, I found the statically placed button is inheriting the dialog font (i.e. "Arial") while the dynamically created button (using CreateWindow()) is not. Do I need to set any flag while dynamically creating the controls ?
I found the same problem with the other non owner draw controls like label, so modified the post.
|
|
|
|
|
You need to capture the WM_SETFONT message in your dialog box procedure and save the font information to use in your dynamic controls.
The best things in life are not things.
|
|
|
|
|
Thanks. I instead put a member variable for my own font. Because even the WM_SETFONT was returning me the system font rather than the font from the Dialog Template.
|
|
|
|
|
Accordint to the documentation here[^] you should get the font specified in your resource script.
The best things in life are not things.
|
|
|
|
|
Some further research yields further information ...
As you say the font returned from a WM_SETFONT message is the system font (very odd). However, when you create your dynamic control, if you send a WM_GETFONT message to your dialog it will return the actual font in use by the dialog. I guess you could do the same with any control that uses a different font.
The best things in life are not things.
|
|
|
|
|
i want to drag and drop images in same list control .
Rajesh
|
|
|
|
|
Here[^] are some suggestions.
The best things in life are not things.
|
|
|
|
|
Hi all . I want ask you , in OnClick(NMHDR* pNMHDR, LRESULT* pResult) , how can I know which item is selected to retrieve tree item data ?
I try in follow way but I get always null :
void CMyViewTree::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
CTreeCtrl& Tree = GetTreeCtrl();
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hSelItem = pNMTreeView->itemNew.hItem;
if(hSelItem)TRACE("%d\n",Tree.GetItemData(hSelItem));
else TRACE("null\n");
*pResult = 0;
}
Thank you.
|
|
|
|
|
|
I try this too , but it show me the previous item selected , not actual item ...
I know, my mistake , after the title seems to want the previous item , but I want to know whish item is selected .
|
|
|
|
|
Flaviu 2 wrote: I try this too , but it show me the previous item selected , not actual item
...
How are you verifying this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Like that :
void CMyListTree::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
CTreeCtrl& Tree = GetTreeCtrl();
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hItemSel = pNMTreeView->itemNew.hItem;
if(hItemSel)TRACE("%d\n",Tree.GetItemData(hItemSel));
else TRACE("null\n");
hItemSel = Tree.GetSelectedItem();
if(hItemSel)TRACE("%d\n",Tree.GetItemData(hItemSel));
else TRACE("null\n");
*pResult = 0;
}
|
|
|
|
|
You are doing the check in the wrong place, I think. You should capture the TVN_SELCHANGED notification as described here[^].
The best things in life are not things.
|
|
|
|
|
You should be handling TVN_SELCHANGED instead of NM_CLICK .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
|
Hi!
I need to set Image to a CButton through code in MFC. I don't want to set through properties. I need to read the image path from an XML file and set it to the Button. How to set image through code? I also need to set Mouse Over image to a button. There is no Mouse Over event for Buttons. How to set the Mouse Over image in the same manner as above(reading the image path from an XML file and set it to the button).
|
|
|
|