How to display collor or text in a COM ATL control - controls

I am doing a task to create a COM control which is similar to a picturebox in C#. I have create somt Test ATL Control and luckily it worked when I add it in Visual C#. I can change some properties of this control but I can not display it's Text and Picture properties even as my testing, these properties contained the value I set already.
My question is how can I display the Text, the Picture and the Color as I wanted?
Thank you
My control is the biggest control in the pic
enter image description here
enter image description here
enter image description here

Related

Excel-Addin with visible form

I have a query on the usage of windows form in excel add-in, application level.
Objective Statement:
Display customized windows form control, similar to a way a chart is being inserted into excel
Custom Pane
I have tried custom pane add-in but it seems to be on a entire workbook level, i need something on a worksheet level
Task Pane
I can't seem to use the task pane in application add-in for excel
Windows Form Control
When I click on a cell in excel i will lose focus to the windows form, i will need the windows to be together with the worksheet, but i can't use showdialog.
Thanks for the help in advance.
From your answer it is hard for me to figure out if you we are looking at a code solution here or something more high level, so I am going to assume that you are looking for a code solution, please correct me if I am wrong.
Have you considered using an OLE object or ActiveX?
There is an example from Microsoft here, how to develop an ActiveX control. (Here is some other walkthrough that I found helpful).
Just to give you a hint how it (the example mentioned above) looks like, here is the screenshot of the compiled example that I added onto the excel sheet:
ActiveX control can be added both manually, or by code, so I could imagine that you could also provide a COM Excel Add-in that would add some buttons onto the ribbon, that when pressed, would add the desired controls onto the sheet.

Set CEdit text in MFC Window designer

I do MFC form design in form designer. Is it possible to set somehow default CEdit text from designer without code writing? If not what is the best place to set CEdit text at application start?
No, you cannot set text from the designer.
If in a view, your best bet is to initialize in OnInitialUpdate().
If in a dialog, you want OnInitDialog().

Extracting Local Resource Image from Winforms Form/Button/Image Property

I have an existing Winforms app that has several forms with the same button images on the two primary buttons for each form (OK and Cancel). The images are set in the VS Designer by setting Image property of Button to "Local resource" and importing the desired image.
I do not have access to the original image files. How do I extract an image from the Image property of a Button control whose Image property has been set this way?
I found a much easier method than manually decoding the Base64.
Assuming your form is called Form1:
Expand Form1.cs in Solution Explorer.
Double click Form1.resx to open the Resource designer.
Right click on the image you'd like to extract.
Choose "Export To File...".
This applies to resources with Persistence set to "Embedded in .resx". If Persistence is "Linked at compile time" the image already exists as a file in your project's Resources directory.
Actually the images are not stored in the filesystem, but rather added to the resx file of your Form (e.g. MainForm.resx) as a base64-encoded serialized representation. If you know how to, you could base64-decode that string, save the result in a flatfile and name it correctly (you must know the image type for that).

How to highlight text on focus in windows phone 7?

How do you highlight a the text in a TextBox control in Windows Phone 7? I can't find a property setting on the control.
Is handling OnFocus event in the code-behind the only option?
You can highlight text using TextBox.Select(int start, int length).
There's actually a pretty great attached property that you can use to do this. You can see an original description of the solution of auto selecting text in a textbox and also see a project where I made user of it.

How to use the color picker dialog to set color properties in the property editor?

This sounds like a trivial question, but it's proved quite hard to google anything about this.
When editing Color-typed properties through the property editor (when designing WinForms), a little editor pops up with three tabs: Custom, Web and System. I want to set a custom color by using the standard color picker dialog because none of the listed Custom colors are suitable.
I am sure that this used to be possible by double-clicking a blank color on the Custom tab, but this just picks the color being double-clicked and closes the drop-down in my VS2008. Am I imagining this, or did it really use to be possible? Can I do this in VS2008 somehow?
Right click on a blank colour in the palette shown by the custom tab. Brings up the "Define Color" dialog (in VS2008 C# Express, and I imagine the same in other versions).
EDIT - Having discovered this by experimentation, the MSDN library describes it here.
Interestingly, no keyboard-only interface is described.

Resources