I have created a custom task pane in VB.Net for Outlook using the Code given below and I would like to add more content to the header (image and a button) of the User Control instead of just the title. Is there a way I can achieve this?
myUserControl1 = New OutlookTaskPane
myUserControl1.TabStop = True
Dim width As Integer = myUserControl1.Width
myCustomTaskPane = Me.CustomTaskPanes.Add(myUserControl1, "My Custom Task Pane")
myCustomTaskPane.Width = width
myCustomTaskPane.Visible = True
myCustomTaskPane.DockPositionRestrict = Microsoft.Office.Core.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange
Let me know if there is any other way of achieving this please.
Thanks.
Unfortunately the TaskPane header is not customizable. Only Add-in Express supports similar customizations using their implementation of Advanced Form Regions (although only the header icon and header color can be changed and you can't add Windows Forms controls to it). Another option is to implement your own type of Task Pane so you have complete control over the UI; see https://code.msdn.microsoft.com/OlAdjacentWindows/.
Related
I have made a toolbar that has a Search Textbox, using the visual studio built in search for the toolwindowpane: https://learn.microsoft.com/pt-pt/previous-versions/visualstudio/visual-studio-2015/extensibility/adding-search-to-a-tool-window?view=vs-2015&redirectedfrom=MSDN
That is working just fine right now after overriding the methods, however i also added a toolbar to the toolwindow from the vsct file, however it is positioning the search and the toolbar in the same row:
Is there any way to position the search bar underneath the toolbar just like the solution explorer in visual studio? If not, is there a way to decrease the toolbar size so it uses the minimum space so it doesn't look weird like in the picture?
Thank you.
EDIT: Constructor of the class that inherits ToolWindowPane:
public CpcObjectsWindow() : base(null)
{
this.Caption = "CPC Objects";
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
// the object returned by the Content property.
this.Content = new CpcObjectsWindowControl();
this.ToolBar = new CommandID(new Guid(CpcExtensionPackage.guidCpcExtensionPackageCmdSet), CpcExtensionPackage.cpcObjectsToolbar);
this.ToolBarLocation = (int)VSTWT_LOCATION.VSTWT_TOP;
}
I tried to add search to a tool window , a search control appears at the top of the tool window.
I tried to search form the ToolWindowPane Class but there is not any property can set the size of search bar. I think that you can submit a feature request on DC.
I would like to add the custom IntelliCode prediction/inline suggestion in Visual Studio with extension. In VSCode, I can use vscode.InlineCompletionProvider/InlineCompletionItem to do that. What's the class/method that would do the same things in Visual Studio extension?
I had the same requirement but I did not find any API for that.
However, what you can do is use adornments to draw a text that looks like code.
Define the adornment:
[Export(typeof(AdornmentLayerDefinition))]
[Name("TextAdornment1")]
[Order(After = PredefinedAdornmentLayers.Text)]
private AdornmentLayerDefinition editorAdornmentLayer;
Get the layer and add a TextBlock:
_layer = view.GetAdornmentLayer("TextAdornment1");
// triggeringLine is your current line
var geometry = _view.TextViewLines.GetMarkerGeometry(triggeringLine.Extent);
var textBlock = new TextBlock
{
Width = 600,
Foreground = _textBrush,
Height = geometry.Bounds.Height,
FontFamily = new FontFamily(_settings.FontFamily),
FontSize = _fontSize,
Text = $"Your completion text"
};
// put the box at the end of your current line
Canvas.SetLeft(textBlock, geometry.Bounds.Right);
Canvas.SetTop(textBlock, geometry.Bounds.Top);
_layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, triggeringLine.Extent, "your tag", textBlock, (tag, ui) => { });
You can get the current editor settings as follows:
// Get TextEditor properties
var propertiesList = dte.get_Properties("FontsAndColors", "TextEditor");
// Get the items that are shown in the dialog in VS
var itemsList = (FontsAndColorsItems)propertiesList.Item("FontsAndColorsItems").Object;
// Get color for comments
var commentItem = itemsList.Cast<ColorableItems>().Single(i => i.Name=="Comment");
var colorBytes = BitConverter.GetBytes(commentItem.Foreground);
var commentColor = Color.FromRgb(colorBytes[2], colorBytes[1], colorBytes[0]);
// Get editor BG
var textItem = itemsList.Cast<ColorableItems>().Single(i => i.Name == "Plain Text");
var bgColorBytes = BitConverter.GetBytes(textItem.Background);
var bbgColor = Color.FromRgb(bgColorBytes[2], bgColorBytes[1], bgColorBytes[0]);
// Get font size in points
var fontSize = (short)propertiesList.Item("FontSize").Value;
// Get current font family
var fontFamily = (string)propertiesList.Item("FontFamily").Value;
The issue with this approach is that the styling and font size slightly differs from the editor. Even if you use the editor setting.
However I think that IntelliCode and GitHub Copilot use another technique. As you can see here:
GitHub Coilot
It seems as the whole code is already inserted to the editor but has a special styling/behaviour. So it is possible somehow, but I don't how to achieve that.
For more information on adornments look here for example:
Visual Studio Text Adornment VSIX using Roslyn
You can implement your custom language-based statement completion. Please take a look at:
Walkthrough: Displaying Statement Completion
Implementing Custom XAML Intellisense VS2017 Extension
Visual-studio – Custom Intellisense Extension
Custom Intellisense Extension
Another different option is using GitHub Copilot extension for Visual Studio, it predicts code using AI
I am currently trying to customize a context menu in Outlook. For the regulars I have had a series of issues which can be seen in this question and with this question.
I would like to adjust the background color a little.
Dim hBrush As IntPtr = NativeMethodsEX.CreateSolidBrush(ColorTranslator.ToWin32(System.Drawing.Color.Red))
Dim mi As New NativeMethodsEX.MenuInfo
With mi
.cbSize = Marshal.SizeOf(mi)
.fMask = NativeMethodsEX.MIM_STYLE Or NativeMethodsEX.MIM_BACKGROUND Or NativeMethodsEX.MIM_APPLYTOSUBMENUS
.dwStyle = NativeMethodsEX.MNS_NOCHECK
.hbrBack = hBrush
End With
NativeMethodsEX.SetMenuInfo(aHwnd, mi)
This code however produces this;.
How can I also change the background of the left hand side or what even is the class name of that part of the window. Also it has a border as well. What is its class name or how can I either remove it or change it?
I am designing an application and had to instantiate controls via code. The problem is that I am unable to change the background color. I tried to look all over the internet, but no succes. I have contacted the Microsoft support service, but no succes either.
I read that you normally change a color by using System.Color or System.ColorHelper. Both are not accesible in the application.
So how to solve the following problem:
TextBox^ txtID = ref new TextBox();
txtID->Background = ?;
I have the solution, first make a brush object and set the color and assign that color to your controls background. I used the following:
SolidColorBrush^ myBrush = ref new SolidColorBrush(Windows::UI::Colors::Red);
TextBox^ txtID = ref new TextBox();
txtID->Background = myBrush;
I've tried the following code found on the DevExpress site but I get a NullReferenceException
at the view.Bands.Clear()
Dim view As BandedGridView = TryCast(gridControl1.MainView, BandedGridView)
view.Bands.Clear()
'Create the bands layout.
Dim bandProdInf As GridBand = view.Bands.Add()
bandProdInf.Caption = "Notification Details - Drilling"
This would be the look of the gridview that I would like:
https://www.devexpress.com/Support/Center/Attachment/GetAttachmentFile/e5cb046f-fb25-46a4-9ae8-25ba612daa01
"Notification Details - Drilling" would appear as the title of the gridview.
The support team from devexpress provided the following right answer:
The GridView offers a built-in mechanism for showing a title via the ViewCaption property. Additionally you will want to set the GridView's OptionsView.ShowViewCaption property to True.
So you would do the following:
gridview1.ViewCaption = "Grid view title"
gridview1.OptionsView.ShowViewCaption = True
Captions must be enabled, they're disabled by default.
Add:
view.OptionsView.ShowViewCaption = true;