我想在a ToolTip
下方显示一条消息TextBox
,但也希望它们是正确对齐的.
我能够将ToolTip消息放在文本框的右边缘,所以我尝试按消息长度移动消息.
所以我尝试使用TextRenderer.MeasureText()来获取字符串长度,但是位置有点偏,如下所示.
private void button1_Click(object sender, EventArgs e)
{
ToolTip myToolTip = new ToolTip();
string test = "This is a test string.";
int textWidth = TextRenderer.MeasureText(test, SystemFonts.DefaultFont, textBox1.Size, TextFormatFlags.LeftAndRightPadding).Width;
int toolTipTextPosition_X = textBox1.Size.Width - textWidth;
myToolTip.Show(test, textBox1, toolTipTextPosition_X, textBox1.Size.Height);
}
Run Code Online (Sandbox Code Playgroud)
我尝试在MeasureText()函数中使用不同的标志,但它没有帮助,因为ToolTip消息有填充,我去了TextFormatFlags.LeftAndRightPadding.
要清楚,这就是我想要实现的目标:
我的问题是我无法在一天结束时关闭我的未平仓头寸,因为我使用的是兰科图表模式。如您所知,ranko 蜡烛时间不是固定的,所以我如何在 pine 脚本中使用 IST 时间在每天的特定时间退出。
在没有砖形图的情况下,我使用此代码来退出中毒
if (hour==15 and minute==29)
strategy.close_all("Day Close")
Run Code Online (Sandbox Code Playgroud) 我有一个脚本,我试图在 2 mA 与 line.new 交叉的地方绘制一个 X 我已经在另一个脚本中尝试了 line.new ,它似乎有效,所以我不知道为什么它不起作用这个脚本。我只是设置 y 但收到错误。
//@version=5
indicator(title="My MACD with crosses", shorttitle="My MACD", timeframe="", timeframe_gaps=true)
// Get User Input
i_showCross = input.bool(title="Show MA Crossovers", defval=true)
// Calculate MA's using user input selections
fast_ma = i_sma_source == "SMA" ? ta.sma(i_src, i_fast_length) : ta.ema(i_src, i_fast_length)
slow_ma = i_sma_source == "SMA" ? ta.sma(i_src, i_slow_length) : ta.ema(i_src, i_slow_length)
crossOver = ta.crossover(fast_ma, slow_ma)
crossUnder = ta.crossunder(slow_ma, fast_ma)
// show label
crossX = label.new(bar_index, na, str.tostring(fast_ma) + "crossed under " …
Run Code Online (Sandbox Code Playgroud) 这是一个二进制搜索程序。但是,如果我将排序后的数组作为输入,程序将始终显示NOT FOUND作为输出。
我是初学者,所以我尝试删除了if语句
void binary(int [],int,int,int);
void main()
{
int i,a[100],n,beg,end,val;
printf("enetr the size :\n");
scanf("%d",&n);
printf("enter the elements :\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("enter the value to be search");
scanf("%d",&val);
beg=0;
end=n-1;
binary(a,beg,end,val);
}
void binary(int a[],int end,int beg,int value)
{
int i,mid,count=0;
while(beg<=end)
{
mid=((beg+end)/2);
if(a[mid]==value)
{
printf("the value is find at the %d position ",mid);
count=1;
}
if(value<a[mid])
end=mid-1;
else
beg=mid+1;
}
if(count==0)
printf("NOT FOUND");
}
Run Code Online (Sandbox Code Playgroud)
尽管有输入,但将输出显示为NOT FOUND