我是WPF的新手,并没有试图将进度条放在按钮上.我之前提出的问题是:StackOverflow Post.任何有关如何正确执行此操作的帮助将不胜感激.我没有在StackOverflow上看到另一篇文章来解决这个问题.理想情况下,让按钮(1)的文本垂直居中(即通常显示在按钮中)和(2)文本下方的进度条会很棒.该按钮的默认高度为2倍,以便为进度条留出空间.我可以调整你想出的任何东西的位置和间距.我对正确完成绑定以更新进度条非常感兴趣.
谢谢!巴克
我在活动中有5个按钮.我的代码应该如下工作:1(正确)按钮按下它应该做的事情.其他4个按下,别的东西应该做...我不想用5 onclicklistener
if(Button1 press) {
do something
}
else if (button2 or button3 or button4 or button5 press)
{
something else to do
}
Run Code Online (Sandbox Code Playgroud) 我有一个Windows 8 C# - xaml应用程序.我有一个堆叠面板,里面有6个堆叠面板.每个堆叠面板有7个按钮.所以整个事情是6x7按钮形成一个日历.主堆栈面板放置在网格中.
现在按钮没有内容集.在后面的代码中,这些按钮的日期设置为内容.
我的问题是,对于不同的分辨率,网格扩展了堆栈面板,但内部的按钮更小,以适应内容.我想按钮扩展,以填满整个堆栈面板.主网格,主堆栈面板,子堆栈面板和按钮的高度和宽度设置为自动..
我一直试图实现这一目标.但是徒劳!有什么建议?
编辑:
有一个主网格,它包含BackButtonGrid,CalendarGrid,NotesGrid和StatusGrid.
CalendarGrid有一个
2个文本框显示一些值.
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Back button and page title -->
<Grid x:Name="BackButtonGrid" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
<TextBlock x:Name="pageTitle" Grid.Column="1" Text="Calendar" Style="{StaticResource PageHeaderTextStyle}"/>
</Grid>
<Grid x:Name="CalendarGrid" Width="Auto" Height="Auto" Grid.Column="1" Grid.Row="1" VerticalAlignment="Stretch">
<Grid.Background>
<ImageBrush …Run Code Online (Sandbox Code Playgroud)我正在做一个Tic-tac-toe项目,我遇到了一些困难.我只是对收藏品松懈,所以你可以看到问题.
事情是,我创建了9个按钮,单击时可以更改背景图像,并禁用它们自己.我已经设法让它为2名玩家运行,但我的愿望是创建某种AI.
我需要一个按钮集合,以便我可以比较它们的属性,并避免通常的逐个比较和大量和众多的If语句.
我真正想要的是能够测试同一行或列中的按钮是否具有相同的值(背景图像).到目前为止我使用的是一个描述符号值的字符串数组,但它完全脱离了按钮,并且输入所有代码需要花费大量时间.
如果不能按照我想象的方式完成,请告诉我们.我对建议持开放态度,并将非常感激.
哦,如果您需要任何代码或更多细节,请告诉我.
我正在使用一个方法:button_click(视图视图)在editText上设置文本,我有很多按钮,每个按钮都应该在特定的editText上设置文本.
有没有办法知道哪个按钮称为方法,以便我可以设置正确的editText文本?
这是方法的代码:
public void button_click(View view) {
// Create the dialog
final Dialog mDateTimeDialog = new Dialog(view.getContext());
// Inflate the root layout
LayoutInflater inflater = (LayoutInflater) view.getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
final RelativeLayout mDateTimeDialogView = (RelativeLayout) inflater.inflate(R.layout.datepick, null);
// Grab widget instance
final DateTimePicker mDateTimePicker = (DateTimePicker) mDateTimeDialogView
.findViewById(R.id.DateTimePicker);
mDateTimePicker.setDateChangedListener(this);
// Update demo edittext when the "OK" button is clicked
((Button) mDateTimeDialogView.findViewById(R.id.SetDateTime))
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mDateTimePicker.clearFocus();
// TODO Auto-generated method stub
String result_string = mDateTimePicker.getMonth()
+ …Run Code Online (Sandbox Code Playgroud) 我尝试在500x500窗口中创建一个按钮,问题是,按钮没有出现在窗口中,单击Windows单独触发按钮的过程/处理程序:
#include <windows.h>
LRESULT CALLBACK MainWindowHandler(HWND obj, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK ButtonHandler(HWND obj, UINT msg, WPARAM wParam, LPARAM lParam);
LPCSTR FrameClassName = "MainWindow";
LPCSTR ButtonClassName = "Button";
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX Frame;
HWND FrameHandle;
WNDCLASSEX Button;
HWND ButtonHandle;
MSG Msg;
Frame.cbSize = sizeof(WNDCLASSEX);
Frame.style = 0;
Frame.lpfnWndProc = MainWindowHandler;
Frame.cbClsExtra = 0;
Frame.cbWndExtra = 0;
Frame.hInstance = hInstance;
Frame.hIcon = LoadIcon(NULL, IDI_APPLICATION);
Frame.hCursor = LoadCursor(NULL, IDC_ARROW);
Frame.hbrBackground = …Run Code Online (Sandbox Code Playgroud) 我刚刚开始学习WPF.
我有一个带图像的按钮.喜欢Image+Text
<Button Height="67" Name="Button1" Width="228" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal" >
<Image Source="Images/add.png" Stretch="Uniform"></Image>
<TextBlock Text=" Create Company" VerticalAlignment="Center" FontSize="20"></TextBlock>
</StackPanel>
</Button>
Run Code Online (Sandbox Code Playgroud)
现在我想以上述格式添加更多按钮.所以我必须一次又一次地编写相同的代码.
所以我决定让一个customButton轻松完成我的工作.我试图创建自定义控件.
我在那里添加了一个名为Image的属性.现在我应该如何赋予该物业价值?
我走错了路吗?
我在http://www.harmonics.co.uk有一个Magento商店,我在产品上有PinIt按钮.
问题是当您单击它时,即使URL正确,它也不会从查询字符串中的media属性中获取图像.
我正在使用以下代码生成我的图像和产品页面上的PinIt按钮:
<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
$image = $this->helper('catalog/image')->init($_product, $_product->getImageUrl(), 'image')->resize(150, 150);
?>
// PinIt Anchor
<a class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo $_product->getProductUrl(); ?>&media=<?php echo $image; ?>&description=<?php echo $_product->getName(); ?>" title="Share on Pinterest"> </a>
Run Code Online (Sandbox Code Playgroud)
它曾经工作,但我认为Pinterest改变了按钮的工作方式,但我看不出如何.生成的代码看起来几乎相同,除了生成的URL替换:%3A和/%2F.
我已经尝试过替换字符串,但这也不起作用.任何想法的人.干杯.
我有一个表格布局,正在显示数据库中的值,该表格有七个列。.我正在以编程方式向表布局中添加行,以数据方式添加数据就可以了。列我需要添加两个按钮..我需要在同一列中的两个按钮,另一个在旁边。..我只能显示一个按钮..我如何在同一列的一行中显示两个按钮? ?? 有可能做到吗?请帮忙!!谢谢!
这是我以编程方式添加行的方式:
do
{
tr=new TableRow(this);
tr.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.WRAP_CONTENT));
firstCol=new TextView(this);
firstCol.setText("0");
firstCol.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
firstCol.setGravity(Gravity.CENTER);
tr.addView(firstCol);
secondCol=new TextView(this);
secondCol.setText(lead.getString(index0));
secondCol.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
secondCol.setGravity(Gravity.CENTER);
tr.addView(secondCol);
thirdCol=new TextView(this);
thirdCol.setText(lead.getString(index1));
thirdCol.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
thirdCol.setGravity(Gravity.CENTER);
tr.addView(thirdCol);
fourthCol=new TextView(this);
fourthCol.setText(lead.getString(index2));
fourthCol.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
fourthCol.setGravity(Gravity.CENTER);
tr.addView(fourthCol);
fifthCol=new TextView(this);
fifthCol.setText(lead.getString(index3));
fifthCol.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
fifthCol.setGravity(Gravity.CENTER);
tr.addView(fifthCol);
sixthCol=new TextView(this);
sixthCol.setText(lead.getString(index4));
sixthCol.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
sixthCol.setGravity(Gravity.CENTER);
tr.addView(sixthCol);
seventhCol=new Button(this);
seventhCol.setBackground(getApplicationContext().getResources().getDrawable(R.drawable.circ));
tr.addView(seventhCol);
lead_table.addView(tr);
tr.setOnClickListener(this);
}while(lead.moveToNext());
Run Code Online (Sandbox Code Playgroud)
这是表格布局:
<TableLayout
android:id="@+id/lead_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp" …Run Code Online (Sandbox Code Playgroud) button ×10
android ×3
c# ×3
wpf ×2
xaml ×2
buttonclick ×1
c ×1
collections ×1
java ×1
jbutton ×1
magento ×1
media ×1
pinterest ×1
progress-bar ×1
query-string ×1
stackpanel ×1
swing ×1
tablelayout ×1
tablerow ×1
vb.net ×1
winapi ×1
windows-8 ×1